Skip to content

PV twin intercept drifts, biasing daytime predictions #134

Closed

Description

@frahlg

Follow-up to #133.

Problem

`pvmodel.Model.Features()` returns `x[0] = 1.0` — a constant intercept term in the RLS regression. There's no physical basis for this: PV output is proportional to clear-sky irradiance (passes through origin). The intercept only exists in the feature vector because it's the standard textbook formulation.

Consequence: RLS has a free parameter `Beta[0]` that drifts wherever it minimizes training residual. This biases daytime predictions by a constant `Beta[0]` amount — typically 5-15 % on a 10 kW system.

The night-gate in #133 masks the symptom at night but doesn't address the daytime offset. Both are the same underlying bug.

Fix options

  1. Set `Features[0] = 0` — backward-compatible (persisted `Beta[0]` becomes a dead coefficient that multiplies zero). Smallest diff, no migration.
  2. Drop `NFeat` from 7 to 6 — principled but requires schema migration for persisted models.

Lean toward option 1.

Test plan

  • Pin `Beta[0] = 5000` on a fresh model, verify `Predict` returns the physics-prior value (or learned minus intercept), not `prior + 5000`.
  • Run full suite — prediction accuracy on existing fixtures should stay within tolerance.
  • Recommend `POST /api/pvmodel/reset` after deploy so RLS re-learns without the drifted intercept. Not required — existing models continue to work, just with the old bias gradually fading as new samples retrain the other coefficients.

Activity

  1. added 3 commits that reference this issue on Apr 19, 2026
    d4da244
    5f1a8ce
    772df01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions