Partial Dependency plot errors -- lesson2


I’m trying trying to execute the partial dependency plot code in lesson2

Here is the code.

def plot_pdp(feat, clusters=None, feat_name=None):
    feat_name = feat_name or feat
    p = pdp.pdp_isolate(m, x, feature=feat)
    return pdp.pdp_plot(p, feat_name, plot_lines=True, 
                        cluster=clusters is not None, n_cluster_centers=clusters)

NOw when I run the below cell I’m getting the following error.

TypeError                                 Traceback (most recent call last)
<ipython-input-64-c4a157344b21> in <module>
----> 1 plot_pdp('YearMade')

<ipython-input-63-e8078eb1bf9d> in plot_pdp(feat, clusters, feat_name)
      1 def plot_pdp(feat, clusters=None, feat_name=None):
      2     feat_name = feat_name or feat
----> 3     p = pdp.pdp_isolate(m, x, feature=feat)
      4     return pdp.pdp_plot(p, feat_name, plot_lines=True, 
      5                         cluster=clusters is not None, n_cluster_centers=clusters)

TypeError: pdp_isolate() missing 1 required positional argument: 'model_features'

I’m not sure what parameters to pass for ‘model_features’ any inputs would help.

I’m using pdp plot version 0.2.0

A fix for this was merged yesterday - you’ll just need to update your copy of the notebook.


Thanks for the reply. You mean fix is given in fasai repo rite? or I need to update the pdp plot version?

Fix is in the repo, just do a pull :slight_smile: