stable_normal_equations

Function stable_normal_equations 

Source
pub fn stable_normal_equations(
    a: &Array2<Float>,
    b: &Array1<Float>,
    rcond: Option<Float>,
) -> Result<Array1<Float>>
Expand description

Numerically stable solution to normal equations using QR decomposition

Solves the least squares problem min ||Ax - b||^2 using QR decomposition instead of forming A^T A explicitly, which improves numerical stability.

§Arguments

  • a - Design matrix of shape (n_samples, n_features)
  • b - Target values of shape (n_samples,)
  • rcond - Cutoff for small singular values. If None, use machine precision.

§Returns

  • Solution vector x of shape (n_features,)