- class Orange.evaluation.performance_curves.Curves(ytrue, probs)[source]¶
Computation of performance curves (ca, f1, precision, recall and the rest of the zoo) from test results.
The class works with binary classes. Attribute probs contains ordered probabilities and all curves represent performance statistics if an instance is classified as positive if it equals or exceeds the threshold in probs, that is, sensitivity[i] is the sensitivity of the classifier that classifies an instances as positive if the probability of being positive is at least probs[i].
Class can be constructed by giving probs and ytrue, or from test results (see
Curves.from_results). The latter removes instances with missing class values or predicted probabilities.
The class treats all results as obtained from a single run instead of computing separate curves and fancy averaging.
probs (np.ndarray) -- vector of predicted probabilities
ytrue (np.ndarray) -- corresponding true classes
ordered vector of predicted probabilities
corresponding true classes
number of true positives (property computed from tn)
number of false positives (property computed from tn)
number of true negatives (property computed from tn)
number of false negatives (precomputed, not a property)
- classmethod from_results(results, target_class=None, model_index=None)[source]¶
Construct an instance of Curves from test results.
Orange.evaluation.testing.Results) -- test results
target_class (int) -- target class index; if the class is binary, this defaults to 1, otherwise it must be given
model_index (int) -- model index; if there is only one model, this argument can be omitted
The last element represents precision at threshold 1. Unless such a probability appears in the data, the precision at this point is undefined. To avoid this, we copy the previous value to the last.
The first value is undefined (no negative instances). To avoid this, we copy the second value into the first.