我正在寻找可以帮助我绘制混淆矩阵的人。我在大学的学期论文中需要这个。但是我在编程方面的经验很少。
在图片中,您可以看到分类报告以及 myy_test和X_testmy 案例的结构dtree_predictions。
如果有人可以帮助我,我会很高兴,因为我尝试了很多事情,但我只是没有得到解决方案,只有错误消息。
X_train, X_test, y_train, y_test = train_test_split(X, Y_profile, test_size = 0.3, random_state = 30)
dtree_model = DecisionTreeClassifier().fit(X_train,y_train)
dtree_predictions = dtree_model.predict(X_test)
print(metrics.classification_report(dtree_predictions, y_test))
precision recall f1-score support
0 1.00 1.00 1.00 222
1 1.00 1.00 1.00 211
2 1.00 1.00 1.00 229
3 0.96 0.97 0.96 348
4 0.89 0.85 0.87 93
5 0.86 0.86 0.86 105
6 0.94 0.93 0.94 116
7 1.00 1.00 1.00 364
8 0.99 0.97 0.98 …Run Code Online (Sandbox Code Playgroud) python decision-tree confusion-matrix scikit-learn multilabel-classification