Module rustlearn::factorization::factorization_machines [] [src]

A factorization machine model implemented using stochastic gradient descent.

A factorization machine (Rendle 2008) model combines the advantages of linear and factorization models. In this implementation, it approximates second-order feature interactions (as in a quadratic SVM) via reduced-rank matrix factorization. This allows it to estimate feature interactions even in sparse datasets (like recommender systems) where traditional polynomial SVMs fail.

The complexity of the model is controlled by the dimensionality of the factorization matrix: a higher setting will make the model more expressive at the expense of training time and risk of overfitting.


The model supports multithreaded model fitting via asynchronous stochastic gradient descent (Hogwild).


use rustlearn::prelude::*;
use rustlearn::factorization::factorization_machines::Hyperparameters;
use rustlearn::datasets::iris;

let (X, y) = iris::load_data();

let mut model = Hyperparameters::new(4, 10)
                                .one_vs_rest();, &y).unwrap();

let prediction = model.predict(&X).unwrap();



A two-class factorization machine implemented using stochastic gradient descent.


Hyperparameters for a FactorizationMachine