Skip to content

Accepts a custom matplotlib.colors.Normalize object#42

Open
vaidyasm wants to merge 1 commit intososuneko:masterfrom
vaidyasm:enable_custom_norm
Open

Accepts a custom matplotlib.colors.Normalize object#42
vaidyasm wants to merge 1 commit intososuneko:masterfrom
vaidyasm:enable_custom_norm

Conversation

@vaidyasm
Copy link

In this PR, pdpbox.pdp.pdp_interact_plot() makes use of user specified (if any) matplotlib.colors.Normalize object as value for 'norm' key in 'plot_params' dictionary argument. A user initialized normalize object can be used & reused to obtain consistent normalization of 'marginal effect' being plotted. If this key is not set, the method is set to behave as unmodified version by passing None as norm to _pdp_inter_one().

This PR was created to address #39

Affect of this PR can be seen in following two plots.
The 'Before' plots uses full color scale regardless of the range of 'marginal effect' being plotted.
In the 'After' plots, color mappings are consistent with values of the 'marginal effect' being plotted.

Interaction plots with large variations in marginal effects can now be identified with cursory look at 'After' plots, without having to read off range from color scale.

Plot 1: Small Range of Marginal Effect

Before:
01_before_crop

After:
01_after_crop

Plot 2: Large Range of Marginal Effect

Before:
02_before_crop

After:
02_after_crop

…m' key in 'plot_params' dict passed as argument to 'pdpbox.pdp.pdp_interact_plot()' method.
@vaidyasm
Copy link
Author

@SauceCat
I was wondering how master branch build is passing in the first place as the errors are emanating from https://github.com/SauceCat/PDPbox/blob/master/pdpbox/pdp_plot_utils.py#L251

Error:
TypeError: clabel() got an unexpected keyword argument 'contour_label_fontsize'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant