pub struct LassoFit {}Expand description
Result of a lasso regression fit.
Contains the fitted model coefficients, convergence information, and diagnostic metrics.
§Fields
lambda- The regularization strength usedintercept- Intercept coefficient (never penalized)coefficients- Slope coefficients (some may be exactly zero due to L1 penalty)fitted_values- Predicted values on training dataresiduals- Residuals (y - fitted_values)n_nonzero- Number of non-zero coefficients (excluding intercept)iterations- Number of coordinate descent iterations performedconverged- Whether the algorithm convergedr_squared- Coefficient of determinationadj_r_squared- Adjusted R²mse- Mean squared errorrmse- Root mean squared errormae- Mean absolute error
§Example
let fit = lasso_fit(&x, &y, &options).unwrap();
// Check convergence and sparsity
println!("Converged: {}", fit.converged);
println!("Non-zero coefficients: {}", fit.n_nonzero);
println!("Iterations: {}", fit.iterations);
// Access model coefficients
println!("Intercept: {}", fit.intercept);
println!("Slopes: {:?}", fit.coefficients);Fields§
§lambda: f64§intercept: f64§coefficients: Vec<f64>§fitted_values: Vec<f64>§residuals: Vec<f64>§n_nonzero: usize§iterations: usize§converged: bool§r_squared: f64§adj_r_squared: f64§mse: f64§rmse: f64§mae: f64Trait Implementations§
Auto Trait Implementations§
impl Freeze for LassoFit
impl RefUnwindSafe for LassoFit
impl Send for LassoFit
impl Sync for LassoFit
impl Unpin for LassoFit
impl UnwindSafe for LassoFit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more