如何使用y轴上的百分比和x轴上的每个度量来绘制性能百分比?

时间:2015-03-15 05:58:11

标签: python python-2.7 matplotlib plot scikit-learn

我们说我从估算器中获得了以下指标:

aproach 1:

Accuracy: 0.492307692308
score: 0.492307692308
precision: 0.368678121457
recall: 0.492307692308
hamming loss: 0.0536130536131
Jaccard similarity: 0.946386946387
F-Beta Score: 0.902376921174

aproach 2:

Accuracy: 0.07692308
score: 0.307692308
precision: 0.8678121457
recall: 0.492307692308
hamming loss: 0.0536130536131
Jaccard similarity: 0.946386946387
F-Beta Score: 0.902376921174

aproach 3:

Accuracy: 0.432307692308
score: 0.412307692308
precision: 0.68678121457
recall: 0.2307692308
hamming loss: 0.0536130536131
Jaccard similarity: 0.946386946387
F-Beta Score: 0.902376921174

此指标的获取方式如下:

from sklearn.metrics.metrics import precision_score, recall_score, confusion_matrix, classification_report, accuracy_score, roc_auc_score, auc
print '\nAccuracy:', accuracy_score(y_test, prediction)
print '\nscore:', classifier.score(testing_matrix, y_test)
print '\nprecision:', precision_score(y_test, prediction)
print '\nrecall:', recall_score(y_test, prediction)
print 'Hamming loss:',hamming_loss(y_test,prediction)
print 'Jaccard similarity:',jaccard_similarity_score(y_test,prediction)
print 'F-Beta Score:',fbeta_score(y_test, prediction, average='macro', beta=0.5)

如何用matplotlib绘制这种不同的aproaches性能?让我们在y轴上说出百分比,并在x上说aproach?。

1 个答案:

答案 0 :(得分:1)

如果你想知道要绘制什么,那么

@ cel'answer是正确的。如果您的问题更多是关于如何绘制数字,seaborn有一个名为factor plot的内容。看一下教程here

您可以轻松生成这样的图形(假设x轴有标签,它们是accuracyf1precisionrecall): enter image description here