Skip to content
EvalSuite
Documentation menu

Classification

Precision

Implementedclassification.precision

Definition

Of the observations predicted positive, the fraction that are truly positive.

Formula

Precision = TP / (TP + FP)

Range: [0, 1]

Inputs and outputs

  • y_true: array of class labels
  • y_pred: array of predicted labels

Returns: float or per-class array

Assumptions

  • Multiclass and multilabel inputs require an explicit `average` (micro, macro, weighted, samples, or None).

Limitations

  • Undefined when there are no positive predictions; handled by `zero_division`.

Python API

PythonSince v0.1.0
import evalsuite as es

es.precision(y_true, y_pred, average="macro")

References

Primary references for this entry have not been added yet.

Implementation status