#1766·visdom

pr_curve() baseline always shows 1.0 instead of true class prevalence

Author: piyush182004Created Aug 26, 2026Updated Aug 26, 2026

Bug

When pr_curve() is called with precomputed precision/recall points (rather than raw y_true/y_score), the "Baseline" line drawn on the chart is meant to represent the true class prevalence (fraction of positive examples). Instead, it always evaluates to 1.0 regardless of the actual data.

py/visdom/init.py, ~line 3047 (before fix): positive_rate = float(precision[0]) if float(recall[0]) == 0.0 else None

precision[0] after sorting is always the (precision=1, recall=0) sentinel point that sklearn's precision_recall_curve() appends by convention — not a measure of prevalence. Precision and recall are both ratios and don't preserve the underlying class counts, so true prevalence cannot actually be recovered from precomputed points alone.

Verified

Across 10 varied datasets with real prevalence ranging from 5% to 95%, the displayed baseline was 1.0 every time. Confirmed live in the browser: a dataset with ~28% true prevalence showed a flat baseline pinned at the top of the chart.

Fix:- #1765