SauceCat / PDPbox

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

Cannot use pdp.pdp_isolate() on multiclass problem #58

Open pvester opened 4 years ago

pvester commented 4 years ago

I have a random forrest model that gives output in the format array([[0, 1]], dtype=uint8) or array([[1, 0]], dtype=uint8). I cant figure out how to use pdp_isolate... my code is here and erorr message:

CODE: from matplotlib import pyplot as plt from pdpbox import pdp, get_dataset, info_plots

pdp_inc = pdp.pdp_isolate(model=model, dataset=pd.DataFrame(features.iloc[0]).T, model_features=features.columns.tolist(), feature='r1') pdp.pdp_plot(pdp_inc, 'SCI_Mainframe') plt.show()

ERROR: TypeError: list indices must be integers or slices, not tuple

I dont know what to do. I have spend a couple hours looking for soluytion whitout luck