Compute Detection Error Tradeoff (DET) for different probability thresholds.
Note
This metric is used for evaluation of ranking and error tradeoffs of a binary classification task.
Read more in the User Guide.
Added in version 0.24.
Changed in version 1.7: An arbitrary threshold at infinity is added to represent a classifier that always predicts the negative class, i.e. fpr=0
and fnr=1
, unless fpr=0
is already reached at a finite threshold.
True binary labels. If labels are not either {-1, 1} or {0, 1}, then pos_label should be explicitly given.
Target scores, can either be probability estimates of the positive class, confidence values, or non-thresholded measure of decisions (as returned by “decision_function” on some classifiers). For decision_function scores, values greater than or equal to zero should indicate the positive class.
The label of the positive class. When pos_label=None
, if y_true
is in {-1, 1} or {0, 1}, pos_label
is set to 1, otherwise an error will be raised.
Sample weights.
Whether to drop thresholds where true positives (tp) do not change from the previous or subsequent threshold. All points with the same tp value have the same fnr
and thus same y coordinate.
Added in version 1.7.
False positive rate (FPR) such that element i is the false positive rate of predictions with score >= thresholds[i]. This is occasionally referred to as false acceptance probability or fall-out.
False negative rate (FNR) such that element i is the false negative rate of predictions with score >= thresholds[i]. This is occasionally referred to as false rejection or miss rate.
Decreasing thresholds on the decision function (either predict_proba
or decision_function
) used to compute FPR and FNR.
Changed in version 1.7: An arbitrary threshold at infinity is added for the case fpr=0
and fnr=1
.
Examples
>>> import numpy as np >>> from sklearn.metrics import det_curve >>> y_true = np.array([0, 0, 1, 1]) >>> y_scores = np.array([0.1, 0.4, 0.35, 0.8]) >>> fpr, fnr, thresholds = det_curve(y_true, y_scores) >>> fpr array([0.5, 0.5, 0. ]) >>> fnr array([0. , 0.5, 0.5]) >>> thresholds array([0.35, 0.4 , 0.8 ])
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4