Follow the regularized leader
linfa-ftrl provides a pure Rust implementations of follow the regularized leader, proximal, model.
The Big Picture
linfa-ftrl is a crate in the linfa ecosystem, an effort to create a toolkit for classical Machine Learning implemented in pure Rust, akin to Python's scikit-learn.
Current state
The linfa-ftrl crate provides Follow The Regularized Leader - Proximal model with L1 and L2 regularization from Logistic Regression, and primarily used for CTR prediction. It actively stores z and n values, needed to calculate weights.
Without L1 and L2 regularization, it is identical to online gradient descent.
See also:
Examples
There is a usage example in the examples/ directory. To run, use:
use *;
use ;
use ;
use ;
// load Winequality dataset
let = winequality
.map_targets
.split_with_ratio;
let params = params
.alpha
.beta
.l1_ratio
.l2_ratio;
let valid_params = params.clone.check_unwrap;
let mut model = new;
// Bootstrap each row from the train dataset to imitate online nature of the data flow
let mut rng = seed_from_u64;
let mut row_iter = train.bootstrap_samples;
for _ in 0..train.nsamples
let val_predictions = model.predict;
println!;
# ResultOk