pub struct ElasticNetFit {Show 14 fields
pub lambda: f64,
pub alpha: f64,
pub intercept: f64,
pub coefficients: Vec<f64>,
pub fitted_values: Vec<f64>,
pub residuals: Vec<f64>,
pub n_nonzero: usize,
pub iterations: usize,
pub converged: bool,
pub r_squared: f64,
pub adj_r_squared: f64,
pub mse: f64,
pub rmse: f64,
pub mae: f64,
}Expand description
Result of an elastic net fit.
Contains the fitted model coefficients, convergence information, and diagnostic metrics.
§Fields
lambda- The regularization strength usedalpha- The elastic net mixing parameter (0 = Ridge, 1 = Lasso)intercept- Intercept coefficient (never penalized)coefficients- Slope coefficients (may be sparse for high alpha)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 = elastic_net_fit(&x, &y, &options).unwrap();
// Access fit results
println!("Lambda: {}, Alpha: {}", fit.lambda, fit.alpha);
println!("Non-zero coefficients: {}", fit.n_nonzero);
println!("Converged: {}", fit.converged);
println!("R²: {}", fit.r_squared);Fields§
§lambda: f64§alpha: 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§
Source§impl Clone for ElasticNetFit
impl Clone for ElasticNetFit
Source§fn clone(&self) -> ElasticNetFit
fn clone(&self) -> ElasticNetFit
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ElasticNetFit
impl Debug for ElasticNetFit
Auto Trait Implementations§
impl Freeze for ElasticNetFit
impl RefUnwindSafe for ElasticNetFit
impl Send for ElasticNetFit
impl Sync for ElasticNetFit
impl Unpin for ElasticNetFit
impl UnwindSafe for ElasticNetFit
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