Equal Error Rate in Python

后端 未结 5 1852
离开以前
离开以前 2021-02-04 09:50

Could anybody tell me how could I compute Equal Error Rate(EER) from ROC Curve in python? In scikit-learn there is method to compute roc curve and auc but could not find the met

5条回答
  •  忘掉有多难
    2021-02-04 10:28

    Equal error rate (EER) is where your false pos rate (fpr) == false neg rate (fnr) [smaller is better]

    using fpr, tpr and thresholds your are getting from roc sklearn computation, you can use this function to get EER:

    def compute_eer(fpr,tpr,thresholds):
        """ Returns equal error rate (EER) and the corresponding threshold. """
        fnr = 1-tpr
        abs_diffs = np.abs(fpr - fnr)
        min_index = np.argmin(abs_diffs)
        eer = np.mean((fpr[min_index], fnr[min_index]))
        return eer, thresholds[min_index]
    

提交回复
热议问题