The direct answer
Interpret R-squared relative to the declared target-mean baseline on the same admitted cases. Preserve the residual evidence and explicitly classify constant targets before relying on a finite displayed value. A negative score can be meaningful; a convenience replacement for a non-finite score is not fresh evidence of predictive quality.
Give a displayed regression score its missing comparison
A fictional AI evaluation report displays a negative regression score. Another report displays zero after every target in its selected cases became identical. Treating both as ordinary failed predictions would erase an important distinction: one can be a meaningful comparison, while the other can reflect a special reporting policy.
This original worksheet selects one scalar-output, unweighted regression evaluation with complete paired case identities. It excludes fitting, multioutput averaging, sample weighting, custom objects and silent missing-case removal. The ordinary positive is an interpretable metric receipt for a fixed admitted evaluation, not a model purchase, deployment or data-release decision.
Keep the mathematical definition and API reporting policy separate
The scikit-learn 1.9.1 evaluation guide defines R² as one minus the sum of squared prediction residuals divided by the sum of squared target deviations from their mean. Its target variance is dataset-dependent, so scores need not be meaningfully comparable across different datasets. The documented coefficient is unadjusted.
The r2_score reference permits negative scores; for a nonconstant target, always predicting its mean gives zero. For constant targets, perfect predictions produce NaN and imperfect predictions negative infinity without the convenience fix. By default, force_finite replaces those cases with one and zero respectively. Disabling it prevents that replacement. Fewer than two samples also yields NaN.
These successfully read maintained bodies identify documentation version 1.9.1, not an installed evaluator. Our application policy keeps target classification and the effective reporting option beside the displayed result. It never discovers those settings from whether the number looks reasonable.
Work an original three-case comparison on paper
Invent three admitted case labels R-A, R-B and R-C with targets 2, 4 and 6 in the same fictional unit. Their arithmetic mean is 4. The squared deviations from that mean are 4, 0 and 4, giving denominator 8. These are teaching assignments, not observed labels, model outputs or constructed arrays.
| Paper prediction plan | Squared residual sum | Substitution into the declared rule |
|---|---|---|
| Always predict 4: values 4, 4, 4 | 4 + 0 + 4 = 8 | 1 − 8/8 = 0 |
| Always predict 0: values 0, 0, 0 | 4 + 16 + 36 = 56 | 1 − 56/8 = −6 |
The first plan has nonzero errors despite its zero relative score. The second has seven times the baseline squared-error sum, producing the negative coefficient. Rejecting its sign as impossible would hide the result rather than correct a demonstrated adapter defect.
This is elementary real-number derivation, not captured library behavior. Actual finite representations, arithmetic bounds, residual extraction and complete result capture remain separate unknown prerequisites. No claim is made about rounding, cancellation or overflow in an installed numeric path.
Route a constant target through an explicit separate disposition
Now propose a different teaching report whose admitted targets are all 4. Its mean-deviation denominator is zero. Our policy records that degeneracy before admitting an ordinary baseline-relative interpretation. It does not silently pool these cases with the earlier three-case report or manufacture target variation.
The documented constant-target reporting branches explain why a finite zero can have a different origin from the first table’s zero. Preserve a separate field for the applicable constant-target condition and effective fallback policy. Do not relabel a replacement as an independently observed residual comparison, or convert a missing value into a success indicator.
Changing the option is a changed evaluation proposal, not a method for improving predictions. This worksheet recommends no universal option setting or production acceptance cutoff. A team may retain a constant-case diagnostic under its own policy while withholding the ordinary nonconstant-target interpretation.
Keep an interpretation receipt with a conditional positive
| Field | Independent evidence required |
|---|---|
| Cases and roles | Complete paired target/prediction identities and admitted revisions. |
| Task meaning | One scalar target, common unit, permitted evaluation population and evidence role. |
| Target disposition | Supported nonconstant classification or explicit degeneracy handling. |
| Metric evidence | Declared residual comparison, baseline and supported numerical adapter. |
| Reporting policy | Effective finite-fallback option and retained non-finite/error disposition. |
| Separate decision | Predeclared task criterion, per-case review, independent evidence and current rights. |
The useful positive conditionally admits only the fixed nonconstant report’s interpretation when every field is independently established. Its coefficient remains associated with those cases and that policy. A strong-looking aggregate cannot replace a mandatory per-record requirement or justify changing the evaluation population after seeing results.
Actual labels, predictions, association, dtype, bounds, constant-target classifier, runtime adapter, unit, independence, representativeness, utility and current audience rights are unknown and unimplemented here. Any missing premise blocks a real positive. Keep the holdout exposure contract separate.
Review eight independent interpretation cards
| Condition | Proposed disposition |
|---|---|
| Complete applicable nonconstant-target receipt and every prerequisite hold | Conditionally admit that fixed interpretation only |
| The original mean-prediction paper plan has coefficient zero | Retain its nonzero residual evidence |
| The original poor plan has coefficient minus six | Do not reject the sign as impossible |
| Targets are constant | Use the explicit degeneracy disposition, not an ordinary comparison |
| A constant-case finite fallback is displayed | Preserve the branch and option rather than treating it as new quality evidence |
| A good aggregate hides a task-critical per-case failure | Keep the separate acceptance requirement effective |
| Cases are missing, reordered, weighted or multioutput | Outside this declared profile; no silent repair |
| The coefficient fits but independence or release rights are unknown | Withhold generalization, ranking and release claims |
Report the narrow evidence instead of a universal ranking
This guide establishes no population accuracy, probability calibration, confidence interval, causal effect or generalization result. It supplies no metric implementation or automatic model-selection service. The existing scalar-tolerance and shape worksheets answer different questions and remain unchanged.
Boundary is prelaunch with planned request-path checks. No estimator, import, numerical value, array, metric call, fitting, scoring, plot, model, API or runtime fixture was constructed or executed. The existing synthetic policy checks establish different behavior.
Primary sources
Official references supporting the guidance. Examples in this guide are synthetic and are not reports of a production incident.