我正在使用基于Jupyter 笔记本['male', 'female']的 sklearn 运行一个非常基本的性别分类器。DecisionTreeClassifier[height, weight, shoe size]
当我继续运行模型时,对于相同的输入,预测会从male变为。female
我不明白这怎么可能。模型的构建不应该是完全确定的,因此每次针对特定输入输出相同的预测吗?
这是我的代码:
X = [[190, 90, 43], [165, 65, 38], [170, 70, 39], [160, 56, 36], [190, 88, 45],
[164, 63, 37]]
Y = ['male', 'female', 'male', 'female', 'male', 'female']
clf = tree.DecisionTreeClassifier()
clf.fit(X, Y)
print(clf.predict([[200, 70, 37]]))

