我正在进行监督机器学习。目前,通过使用scikit的metrics,打印出整个语料库的准确率。
我还希望打印出前 3 个主题和前 5 个主题的准确性。我怎样才能这样做?
model = LogisticRegression()
model = model.fit(matrix, label)
y_train_pred = model1.predict(matrix_test)
print(metrics.accuracy_score(label_test, y_train_pred))
最佳答案
您可以使用混淆矩阵:http://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusion_matrix.html
示例:http://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html
通过这种方式,您可以获得应用于每个类别预测的特定信息。
关于python - 如何以不同的方式打印模型的准确性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34971788/