【发布时间】:2016-06-04 23:06:48
【问题描述】:
我正在使用 scikit-learn 将文本文档 (22000) 分类为 100 个类。我使用 scikit-learn 的混淆矩阵方法来计算混淆矩阵。
model1 = LogisticRegression()
model1 = model1.fit(matrix, labels)
pred = model1.predict(test_matrix)
cm=metrics.confusion_matrix(test_labels,pred)
print(cm)
plt.imshow(cm, cmap='binary')
这就是我的混淆矩阵的样子:
[[3962 325 0 ..., 0 0 0]
[ 250 2765 0 ..., 0 0 0]
[ 2 8 17 ..., 0 0 0]
...,
[ 1 6 0 ..., 5 0 0]
[ 1 1 0 ..., 0 0 0]
[ 9 0 0 ..., 0 0 9]]
但是,我没有收到清晰易读的情节。有没有更好的方法来做到这一点?
【问题讨论】:
标签: python matplotlib matrix scikit-learn text-classification