Draw a binary classifier’s precision-recall curve from its predictions.
Parameters
Name
Type
Description
Default
y_true
array_like
Whether each sample is positive: 1 or True for the positive class, or one-hot rows of two classes.
required
y_pred
array_like or dict of str to array_like
What model.predict returns: one sigmoid output per sample, as a column or flat, or two-class softmax rows, whose second column is the positive class’s score. Several models’ predictions by name draw a line each.
If the labels are not 0 and 1 (or two-class one-hot rows) or hold no positive sample, if there are no predictions, or if the predictions are not a score per sample or two-class rows.
Notes
Each line is named with its average precision and the precision a classifier guessing at random reaches – the share of positives – which is drawn as a dashed line, as :func:maidr.read_tensorboard_pr_curves draws TensorBoard’s PR curves.