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


(ritika) #1

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?

Thanks,
Ritika


(shikun chen) #2

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

plot_pdp(feat_name='YearMade')


(ritika) #3

Hi Chen.

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

Thanks,
Ritika


(shikun chen) #4

Hi, my code above doesn’t work?

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


(ritika) #5

thanks @cican


(oxidising) #6

Hi Cican,

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

Thanks


(shikun chen) #7

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

Thanks!