Last active
May 27, 2022 16:55
-
-
Save rkdgusrn1212/8186976b422a8a37504ac378770248f4 to your computer and use it in GitHub Desktop.
Partial Dependence Plot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib import pyplot as plt | |
from pdpbox import pdp | |
#my_model, val_X, feature_list | |
# isolate pdp | |
pdp_iso = pdp.pdp_isolate(model=my_model, dataset=val_X, model_features=feature_list, feature='feature1') | |
pdp.pdp_plot(pdp_iso, 'feature1') | |
plt.show() | |
# interact pdp | |
pdp_inter = pdp.pdp_interact(model=my_model, dataset=val_X, model_features=feature_list, features=['feature1', 'feature2']) | |
pdp.pdp_interact_plot(pdp_interact_out=pdp_inter, feature_names=['feature1', 'feature2'], plot_type='contour') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment