aupr

improvelib.metrics.aupr(y_true, y_prob)

Compute the Precision-Recall curve AUC. Uses sklearn.metrics.precision_recall_curve() and sklearn.metrics.auc().

Used in compute_metrics and can be used directly.

Parameters:

y_truenp.ndarray

Ground truth.

y_probnp.ndarray

Target scores made by the model.

Returns:

auprfloat

The computed Precision-Recall curve AUC.

Example

This function is called by compute_metrics which is called by compute_performance_scores, which also saves the scores.

You can use this function directly, for example during model training like so:

import improvelib.metrics as metr
aupr_to_monitor = metr.aupr(y_true, y_pred)