[−][src]Crate linfa_elasticnet
Elastic Net
This library contains an elastic net implementation for linear regression models. It linearily combines l1 and l2 penalties of the lasso and ridge methods and offers therefore a greater flexibility for feature selection. With increasing penalization certain parameters become zero, their corresponding variables are dropped from the model.
See also:
Example
use linfa::traits::Fit; use linfa_elasticnet::{ElasticNet, Result}; fn main() -> Result<()> { let dataset = linfa_datasets::diabetes(); let model = ElasticNet::params() .l1_ratio(0.8) .penalty(0.3) .fit(&dataset)?; Ok(()) }
Implementation
The coordinate descent algorithm is used to solve the lasso and ridge problem. It optimizes each parameter seperately, holding all the others fixed. This cycles as long as the coefficients have not stabilized or the maximum number of iterations is reached.
See also:
Structs
ElasticNet | Elastic Net model |
ElasticNetParams | Linear regression with both L1 and L2 regularization |
Enums
Error |
Type Definitions
Result |