美文网首页
sklearn notes

sklearn notes

作者: 宣雄民 | 来源:发表于2019-05-25 17:10 被阅读0次

Difference between roc_auc_score() and auc()

  • AUC is not always area under the curve of a ROC curve. Area Under the Curve is an (abstract) area under some curve, so it is a more general thing than AUROC. With imbalanced classes, it may be better to find AUC for a precision-recall curve.
def roc_auc_score(y_true, y_score, average="macro", sample_weight=None):
    # <...> docstring <...>
    def _binary_roc_auc_score(y_true, y_score, sample_weight=None):
            # <...> bla-bla <...>

            fpr, tpr, tresholds = roc_curve(y_true, y_score,
                                            sample_weight=sample_weight)
            return auc(fpr, tpr, reorder=True)

    return _average_binary_score(
        _binary_roc_auc_score, y_true, y_score, average,
        sample_weight=sample_weight) 

This first gets a roc curve, and then calls auc() to get the area.

相关文章

网友评论

      本文标题:sklearn notes

      本文链接:https://www.haomeiwen.com/subject/cadzzqtx.html