多分類評價指標python代碼

來源:互聯網
上載者:User

標籤:cas   允許   問題:   bsp   使用   信賴度   loss   amp   class   

from sklearn.metrics import precision_score,recall_score

print (precision_score(y_true, y_scores,average=‘micro‘))

sklearn.metrics模組實現了一些loss, score以及一些工具函數來計算分類效能。一些metrics可能需要正例、信賴度、或二分決策值的的機率估計。大多數實現允許每個sample提供一個對整體score來說帶權重的分布,通過sample_weight參數完成。

一些二分類(binary classification)使用的case:

  • matthews_corrcoef(y_true, y_pred)
  • precision_recall_curve(y_true, probas_pred)
  • roc_curve(y_true, y_score[, pos_label, …])

一些多分類(multiclass)使用的case:

  • confusion_matrix(y_true, y_pred[, labels])
  • hinge_loss(y_true, pred_decision[, labels, …])

一些多標籤(multilabel)的case:

  • accuracy_score(y_true, y_pred[, normalize, …])
  • classification_report(y_true, y_pred[, …])
  • f1_score(y_true, y_pred[, labels, …])
  • fbeta_score(y_true, y_pred, beta[, labels, …])
  • hamming_loss(y_true, y_pred[, classes])
  • jaccard_similarity_score(y_true, y_pred[, …])
  • log_loss(y_true, y_pred[, eps, normalize, …])
  • precision_recall_fscore_support(y_true, y_pred)
  • precision_score(y_true, y_pred[, labels, …])
  • recall_score(y_true, y_pred[, labels, …])
  • zero_one_loss(y_true, y_pred[, normalize, …])

還有一些可以同時用於二標籤和多標籤(不是多分類)問題:

  • average_precision_score(y_true, y_score[, …])
  • roc_auc_score(y_true, y_score[, average, …])

多分類評價指標python代碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.