TypeError:plot\u partial\u dependence()获得意外的关键字参数“kind”

2024-04-29 15:38:13 发布

您现在位置:Python中文网/ 问答频道 /正文

是否有人知道此代码是如何:

from sklearn.inspection import plot_partial_dependence


X=df.drop("heart_attack", axis=1)
y=df["heart_attack"]

for i in range(25):
    features= [i]
    plot_partial_dependence(model_reg, X, features, kind='both')  

导致此错误的原因

TypeError: plot_partial_dependence() got an unexpected keyword argument 'kind'

我几乎是从scikit_在ICE上学习和PDP这里https://scikit-learn.org/stable/modules/partial_dependence.html复制了这篇文档。如果我不使用kind作为属性,但我想使用ICE绘图,它就可以工作


Tags: 代码fromimportdfplotsklearnscikitpartial