Python错误TypeError:fit()缺少2个必需的位置参数:“X”和“y”

2024-06-07 22:55:08 发布

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

我的错误代码是TypeError:fit()缺少2个必需的位置参数:“X”和“y”

这是我的密码

from sklearn import tree

#[height,weight,shoe size]

X = [181,80,44], [177,70,43], [160,60,38], [154, 54,37]

Y = ['male','female','female','female']

clf = tree.DecisionTreeClassifier

clf = clf.fit(X,Y)

prediciton = clf.predict([[190,70,43]])

'print'(prediciton)

Tags: fromimporttree密码参数sklearnfemalefit

热门问题