量化預測質量之分類報告 sklearn.metrics.classification_report


classification_report的調用為:classification_report(y_true, y_pred, labels=None, target_names=None, sample_weight=None, digits=2, output_dict=False)

y_true : 真實值
y_pred : 預測值

from sklearn.metrics import classification_report

truey = np.array([0,0,1,1,0,0])
prey = np.array([1,0,1,0,0,0])
print(classification_report(truey,prey,target_names=['zhen','jia']))

1)fraction of true positives/false positive/false negative/true negative

True Positive (真正, TP)被模型預測為正的正樣本;

True Negative(真負 , TN)被模型預測為負的負樣本 ;

False Positive (假正, FP)被模型預測為正的負樣本;

False Negative(假負 , FN)被模型預測為負的正樣本;

2)precision/recall,准確率和召回率

系統檢索到的相關文檔(A)

系統檢索到的不相關文檔(B)

相關但是系統沒有檢索到的文檔(C)

 不相關但是被系統檢索到的文檔(D)

召回率R:R=A/(A+C)

精度P: P=A/(A+B). 

3)F1-score

F1分數可以看作是模型准確率和召回率的一種加權平均,它的最大值是1,最小值是0。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM