_fit_coefficients
Signature
_fit_coefficients(
x: FloatVector,
y: FloatVector,
weights: FloatVector,
) -> tuple[float, float, float]
What problem it solves
Computes one update of the weighted linear-fit coefficients: slope, intercept, and weighted variance of x.
Input contract
x,y, andweightsmust already be validated by the caller.weightsmust contain strictly positive weights.xmust have a finite, non-zero weighted variance.
Where it is used
Failure modes
ValueErrorif the weighted variance ofxis not finiteValueErrorif the weighted variance ofxis too close to zero, meaning there are not enough distinct values to estimate the slope
Why it stays private
It is an internal building block of the lin_fit algorithm. Documenting it clarifies the calculation flow, but it would not make much sense as a separate public endpoint.