dataeval.core.uap¶
- dataeval.core.uap(labels, scores)¶
Estimate the empirical mean precision for the upperbound average precision.
Warning
This function is experimental and may change or be removed in future releases.
Uses the FR Test Statistic based approach.
- Parameters:¶
- Returns:¶
The empirical mean precision estimate.
- Return type:¶
float
- Raises:¶
ValueError – If unique classes M < 2.
Notes
This function calculates the empirical mean precision using the
average_precision_scorefrom scikit-learn, weighted by the class distribution.Examples
>>> y_true = np.array([0, 0, 1, 1]) >>> y_scores = np.array([0.1, 0.4, 0.35, 0.8]) >>> uap(y_true, y_scores) 0.8333333333333333>>> y_true = np.array([0, 0, 1, 1, 2, 2]) >>> y_scores = np.array( ... [ ... [0.7, 0.2, 0.1], ... [0.4, 0.3, 0.3], ... [0.1, 0.8, 0.1], ... [0.2, 0.3, 0.5], ... [0.4, 0.4, 0.2], ... [0.1, 0.2, 0.7], ... ] ... ) >>> uap(y_true, y_scores) 0.7777777777777777