为什么我的分类精度达到100%

时间:2019-10-03 21:45:15

标签: machine-learning classification confusion-matrix

我不知道为什么我的准确性得分f1都是100%。 代码如下:

x = f2.iloc[:,:5]
y = f2.loc[:,'rain_tomorrow']

X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.2)

from sklearn.metrics import confusion_matrix
from sklearn.tree import DecisionTreeClassifier

dt = DecisionTreeClassifier(max_depth=2).fit(X_train, y_train)
tree_predicted = dt.predict(X_test)
confusion = confusion_matrix(y_test, tree_predicted)

print('Decision tree classifier (max_depth = 2)\n', confusion)

0 个答案:

没有答案