Skip to content

Commit

Permalink
Fix pdp plot
Browse files Browse the repository at this point in the history
Signed-off-by: Antoni Baum <antoni.baum@protonmail.com>
  • Loading branch information
Yard1 committed Mar 18, 2023
1 parent 80df135 commit bc80a3f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pycaret/internal/pycaret_experiment/supervised_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4285,13 +4285,17 @@ def pdp(show: bool = True):
from interpret.blackbox import PartialDependence

try:
pdp = PartialDependence(
predict_fn=model.predict_proba, data=test_X
) # classification
# interpret>=0.3.1
pdp = PartialDependence(model=model, data=test_X)
except AttributeError:
pdp = PartialDependence(
predict_fn=model.predict, data=test_X
) # regression
try:
pdp = PartialDependence(
predict_fn=model.predict_proba, data=test_X
) # classification
except AttributeError:
pdp = PartialDependence(
predict_fn=model.predict, data=test_X
) # regression

pdp_global = pdp.explain_global()
pdp_plot = pdp_global.visualize(list(test_X.columns).index(pdp_feature))
Expand Down

0 comments on commit bc80a3f

Please sign in to comment.