Error when I try to create plot in ML-Lesson 4

When I am trying to create plot I am getting error

TypeError: pdp_isolate() missing 1 required positional argument: ‘feature’

Anyone Please suggest how to fix this error?


Hi, I have encountered the same problem, you should refer to pdp’s documentation.

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

And then



Hi Chen.

I have referred pdp documentation.still i am facing the issue. Can you please share your steps to fix this error.


Hi, my code above doesn’t work?

It worked fine for me! you need to specify another argument model_features.

thanks @cican

Hi Cican,

Could you submit a pull request for this to be changed? Or would you like me to submit the request?


yes, please do that. Actually I don’t know how to submit a pull request.



I understand I maybe talking about this late, but I went instead with below code:

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