MAIDR JavaScript API
    Preparing search index...

    Interface PrCurvePoint

    One point of a precision-recall curve: the recall a classifier reaches and the precision it keeps at one decision threshold.

    A precision-recall layer is PrCurvePoint[][], one array per curve, so several classifiers (or the classes of one, or the runs TensorBoard's PR Curves dashboard overlays) are compared in one layer the way a multi-line layer holds several series; z names the curve, as it names a line. Both rates are fractions of one. Listed in any order -- precision_recall_curve returns them from a recall of 1 down to 0 -- since the average precision is measured over the points sorted by x.

    Unlike a ROC curve, the chart is not read against a diagonal: a classifier that guesses keeps a precision equal to the share of positives in the data, at every recall. That share is the curve's prevalence, and the baseline it draws is a horizontal line.

    // one classifier on data that is 30% positive, three thresholds
    {
    type: 'pr_curve',
    axes: { x: { label: 'Recall' }, y: { label: 'Precision' } },
    data: [[
    { x: 0, y: 1, z: 'Logistic', prevalence: 0.3 },
    { x: 0.6, y: 0.8, threshold: 0.5, z: 'Logistic' },
    { x: 1, y: 0.3, threshold: 0, z: 'Logistic' },
    ]],
    }
    interface PrCurvePoint {
        z?: string;
        label?: string;
        yMin?: number;
        yMax?: number;
        x: number;
        y: number | null;
        threshold?: number | null;
        prevalence?: number | null;
        ap?: number | null;
    }

    Hierarchy (View Summary)

    Index

    Properties

    z?: string
    label?: string

    Ordinal level name announced in place of the raw numeric y, for a chart whose y axis is a category rather than a magnitude — a hypnogram's sleep stages, a Likert response, a severity grade. y stays numeric because it drives sonification, braille and the min/max range, so the human-readable name has to travel alongside it.

    An empty string counts as absent, so a producer that emits '' for an unnamed level gets the numeric announcement rather than a blank one. Omitting it entirely is the right shape for a continuous y.

    { x: 1.5, y: 3, label: 'REM' }
    
    yMin?: number

    Lower bound of the uncertainty around y, when the chart draws one.

    A fitted curve almost always comes with a band, and it is the reason the curve is drawn rather than a plain line: geom_smooth(se = TRUE) and sns.regplot both default to one. Carried on the sample rather than in a layer of its own so a reader hears the value and its interval at the same x — the comparison a band exists for is whether the trend is distinguishable from flat, and that cannot be made by navigating two layers in turn.

    Named to match ErrorBarPoint, so a producer that already computes an interval emits the same keys wherever it puts them.

    Both bounds are optional and independent: a one-sided interval is a real chart, and a sample missing its bounds still carries its value.

    yMax?: number

    Upper bound of the uncertainty around y. See LinePoint.yMin.

    x: number

    The recall at this threshold, from 0 to 1.

    y: number | null

    The precision at this threshold, from 0 to 1, or null for a gap.

    threshold?: number | null

    The decision threshold this point was scored at.

    The one number a reader can act on: without it the reader learns the rates but not how to get them. Optional because a curve drawn from rates alone is still a precision-recall curve -- and because precision_recall_curve returns one threshold fewer than points, the last point (recall 0, precision 1) having none.

    prevalence?: number | null

    The share of positives in the data this curve was scored on: the precision a classifier that guesses keeps at every recall, and so the height of the chart's chance baseline.

    Read from the first point of the curve that declares one, the way z names a series. When no point declares it, the baseline is not said: it cannot be recovered from the points with confidence.

    ap?: number | null

    The average precision of this curve, as the producer computed it.

    Read from the first point of the curve that declares one. When no point declares it, it is measured from the curve's own points the way sklearn.metrics.average_precision_score computes it: the sum, over each rise in recall, of the rise times the precision at its top.