FTRL Proximal Implementation for Elastic Net Regression

Implementation of Follow The Regularized Leader (FTRL) Proximal algorithm, proposed by McMahan et al. (2013) , used for online training of large scale regression models using a mixture of L1 and L2 regularization.


Build Status codecov CRAN_Status_Badge CRAN Downloads

This is an R package of the FTRL Proximal algorithm for online learning of elastic net logistic regression models.

For more info on the algorithm please see Ad Click Prediction: a View from the Trenches by McMahan et al. (2013).

Installation

Easiest way to install is from within R using the latest CRAN version:

install.packages("FTRLProximal")

If you want the latest build from git you can install it directly from github using devtools:

devtools::install_github("while/FTRLProximal")

Usage

Simplest use case is to use the model similar to normal glm with a model formula.

# Set up dataset
p <- mlbench::mlbench.2dnormals(100,2)
dat <- as.data.frame(p)
 
# Train model
mdl <- ftrlprox(classes ~ ., dat, lambda = 1e-2, alpha = 1, a = 0.3)
 
# Print resulting coeffs
print(mdl)

It is also possible to update the trained model object once it is trained.

# Set up first dataset
p <- mlbench.2dnormals(100,2)
dat <- as.data.frame(p)
 
# Convert data.frame to model.matrix
X <- model.matrix(classes ~ ., dat)
 
# Train on first dataset
mdl <- ftrlprox(X, dat$classes, lambda = 1e-2, alpha = 1, a = 0.3)
 
# Generate more of the same data after the first training session
p <- mlbench.2dnormals(100,2)
dat <- as.data.frame(p)
 
# Update model using the new data.
mdl <- update(mdl, X, dat$classes)

For more example please see the documentation.

Changelog

0.2

  • Changed from using explicit lambda1 and lambda2 parameters to using lambda and mixing parameter alpha.

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("FTRLProximal")

0.3.0 by Vilhelm von Ehrenheim, 2 years ago


https://github.com/while/FTRLProximal


Report a bug at https://github.com/while/FTRLProximal/issues


Browse source code at https://github.com/cran/FTRLProximal


Authors: Vilhelm von Ehrenheim [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports Matrix, methods

Suggests testthat, covr, mlbench


See at CRAN