簡體   English   中英

如何使sklearn模型達到預定的精度或召回某個類?

[英]How to make sklearn model reach a predefine precision or recall on some class?

例如,我用以下分數訓練了貝葉斯(SVM,RandomForest或其他東西)模型:

Model:
             precision    recall  f1-score   support

         neg     0.0622    0.9267    0.1166       191
         pos     0.9986    0.7890    0.8815     12647

avg / total       0.98      0.79      0.87     12838

我的老板告訴我, neg精度太低,可以接受召回率的60%,不需要那么高。 因此,我需要一種通過將召回率限制為60%來獲得最佳精度的方法。但是我沒有在sklearn中找到類似的功能。

有什么方法可以以最precision訓練模型,而召回率可以限制為特定值? (或達到neg 20%的精度,不在乎召回)

sklearn如下實現精確調用權衡: http ://scikit-learn.org/stable/auto_examples/model_selection/plot_precision_recall.html

一種方法是使用precision_recall_curve() ,然后在圖形上找到具有所需召回率的點。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM