Pbpbox error on pdp_interact_plot

Hi,

I ran the code to generate the interact plots in lecture 4 but I end up with the following error.

TypeError: clabel() got an unexpected keyword argument ‘contour_label_fontsize’

Anyone else had a similar issue?

I think the issue has something to do with matplotlib, I’m currently running V3.0.0

Solved it, its to do with matplotlib version 3. I updated pdp_plot_utils.py and replaced

251 inter_ax.clabel(c2, contour_label_fontsize=fontsize, inline=1)
with
251 inter_ax.clabel(c2, fontsize=fontsize, inline=1)

But now mine only plots the contour graph and not the other two.

https://github.com/SauceCat/PDPbox/blob/master/CHANGELOG.md
According to the pdpbox change logs, the latest pdp_interact_plot no longer support plotting single pdp. So it can no longer automatically plot those two pdp for us. Maybe you can try plotting them yourself and putting them together.

PDPbox was updated after the video and the pdp.pdp_interact_plot() function is now returning 1 graph instead of three. To have the notebook working as in the lectures you need to do the following:

pip install pdpbox==0.1.0
conda install matplotlib=2.2.3

Then, you need to change the calls to pdp_interact() (I believe there are 3 in total) from pdp_interact(m, x, feats, x.columns) to pdp_interact(m, x, feats) and it should work

1 Like

solved it ,replace pdp_plot_utils.py and restart jupyter notebook

That does not solve it, as it should output three plots instead of one.

As far as I remember the API has been changed. It now only outputs a single plot. If you want to reproduce the exact same plot from the course, you’ll have to add the other plots manually. But the important information is there.

I am going from memory, though, so might be wrong

I fix this problem by editing the pdp_plot_utils.py

vim ~/anaconda3/envs/gpu/lib/python3.6/site-packages/pdpbox/pdp_plot_utils.py

search for “inter_ax.clabel(c2, contour_label_fontsize”

/inter_ax.clabel(c2, contour_label_fontsize

and change “contour_label_fontsize=fontsize” to “fontsize=fontsize”

3 Likes

work for my kaggle thx

Thanks, it worked for me too :slight_smile: