简体   繁体   English

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

[英]How to plot performance percentages using percentage on y axis and each metric on x axis?

Let's say I have the following metrics which I obtained from an estimator: 假设我有一个从估算器获得的以下指标:

aproach 1: 方式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: 方式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: 方式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

This metrics where obtained like this: 可以通过以下方式获得此指标:

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)

How can I plot this different aproaches performance with matplotlib?. 如何使用matplotlib绘制这种不同的性能? Let's say on the y axis the percentage and on the x the aproach?. 假设在y轴上为百分比,在x上为aproach?

@cel'answer is the correct one if you want to know what to plot. 如果您想知道要绘制的内容,@ cel'answer是正确的选择。 If your question is more about how to plot your numbers, seaborn has something called factor plot . 如果您的问题更多关于如何绘制数字, seaborn就有一个叫做factor plot东西。 Have a look at the tutorial here . 这里看看教程。

You can easily produce a graph like this (pretend the x axis has labels, and they are accuracy , f1 , precision , recall ): 你可以很容易产生这样的图形(假装x轴有标签,他们accuracyf1precisionrecall ): 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM