Performance curves¶

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.
Parameters:  probs (np.ndarray) – vector of predicted probabilities
 ytrue (np.ndarray) – corresponding true classes

probs
¶ ordered vector of predicted probabilities
Type: np.ndarray

ytrue
¶ corresponding true classes
Type: np.ndarray

tp
¶ number of true positives (property computed from tn)
Type: np.ndarray

fp
¶ number of false positives (property computed from tn)
Type: np.ndarray

tn
¶ number of true negatives (property computed from tn)
Type: np.ndarray

fn
¶ number of false negatives (precomputed, not a property)
Type: np.ndarray

classmethod
from_results
(results, target_class=None, model_index=None)[source]¶ Construct an instance of Curves from test results.
Parameters:  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
Returns: curves (
Curves
) results (

precision
()[source]¶ Precision curve
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.