SauceCat / PDPbox

python partial dependence plot toolbox
http://pdpbox.readthedocs.io/en/latest/
MIT License
840 stars 129 forks source link

info_plots.actual_plot() got an error #60

Closed fenxouxiaoquan closed 3 years ago

fenxouxiaoquan commented 4 years ago

when i execute the follow code just like binary_classification tutorial: """ fig, axes, summary_df = info_plots.actual_plot( model=titanic_model, X=titanic_data[titanic_features], feature=['Embarked_C', 'Embarked_S', 'Embarked_Q'], feature_name='embarked' ) """ and got follow error: """ TypeError: predict_proba() argument after ** must be a mapping, not NoneType """ i also tried lgb.LGBMClassifier and lgb raw model on my own data but got same error. is there anyone knows how to fix it?

vickiwickinger commented 4 years ago

Hi,

the error message points to the following line in the source code prediction = predict(X, **predict_kwds) I just changed this line to prediction = predict(X) and then it worked again. Probably the scikit API changed in recent updated and it's not possible anymore to overload an additional None value.

mfgray commented 4 years ago

I ran in to this issue too. The info_plots.actual_plot() has the keyword argument predict_kwds which has the default value None, which seems to be causing the error with the argument unpacking (). I was getting the same error. """ `predict() argument after must be a mapping, not NoneType` """

I was able to get it to work by passing in an empty set as the keyword argument. I.e. when calling actual_plot pass in the following keyword arg: predict_kwds={}

Looking at the git commits it looks like the author had recently changed the default from an empty set to None.