Skip to main content

fit

Function fit 

Source
pub fn fit(
    x: &[f64],
    y: &[f64],
    n: usize,
    p: usize,
    lambda: f64,
    max_iter: usize,
    tol: f64,
) -> Result<LassoModel, LearningError>
Expand description

Fit lasso with penalty lambda ≥ 0 by coordinate descent. lambda = 0 reduces to OLS (up to the iteration tolerance). Fails closed on shape mismatch / n < 2.