MAIDR JavaScript API
    Preparing search index...

    Interface PrCurveDeclaration

    A precision-recall curve drawn as an ordinary line: a classifier's precision against its recall, one point per decision threshold.

    Nothing in a line series says its two axes are rates a classifier traded against each other, so read undeclared the curve is a line chart, correct about every number and silent about what the figure is read for: the threshold behind each point, the average precision, and how far the curve stands above a classifier that guesses. The series is read exactly as its line would be -- the same points, the same marks -- with x the recall and y the precision.

    Several curves are one figure, compared against each other, so following line series merge into this layer as further curves by default, as a survival curve's arms do. A following series carrying a pr_curve block of its own joins the layer too rather than starting another, so that each curve can say its own prevalence and ap: both are facts about the curve the block is written on, never about a curve merged in without one.

    // Highcharts, one classifier scored on data that is 30% positive
    { custom: { maidr: { type: 'pr_curve', prevalence: 0.3 } } }
    interface PrCurveDeclaration {
        title?: string;
        name?: string;
        type: PR_CURVE;
        threshold?: string;
        prevalence?: number;
        ap?: number;
        merge?: boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    title?: string

    Overrides the layer's announced title. Maps to MaidrLayer.title.

    Names the chart; use DeclarationBase.name to say which layer of it this is.

    name?: string

    Names this layer among sibling layers. Maps to MaidrLayer.name.

    Announced on a layer switch in place of the trace type, so a hue-split figure says "Male" and "Female" rather than "error_bar plot" twice.

    type: PR_CURVE

    TraceType.PR_CURVE — the string 'pr_curve'.

    threshold?: string

    Field holding the decision threshold each point was scored at. Maps to PrCurvePoint.threshold.

    The one number a reader can act on, and the one a line has nowhere to carry. Left out of a point where it resolves to no finite number -- precision_recall_curve returns one threshold fewer than points, so the last point routinely has none.

    'threshold', falling back to thresholds or cutoff

    prevalence?: number

    The share of positives in the data this curve was scored on, as a fraction of one. Maps to PrCurvePoint.prevalence on the curve's first point.

    The precision a classifier that guesses keeps at every recall, so it is the height of the chart's chance baseline. There is deliberately no default: it cannot be recovered from the curve, and a guessed baseline would tell a reader every curve beat it, or none did. A percentage is refused rather than rescaled, for the reason ForestDeclaration.weight gives.

    ap?: number

    The average precision of this curve, as the producer computed it, as a fraction of one. Maps to PrCurvePoint.ap on the curve's first point.

    Omitted, MAIDR measures it from the curve's own points the way sklearn.metrics.average_precision_score does, which agrees with the producer's figure whenever the curve carries every threshold.

    merge?: boolean

    Absorb following line series into this layer as further curves, as SurvivalDeclaration.merge absorbs further arms.

    On by default: the curves of a precision-recall figure are read against each other. Set false for curves that are genuinely separate charts.

    true