Skip to content

Repository files navigation

FTRL Proximal

R-CMD-checkCodecov test coverageCRAN_Status_BadgeCRAN 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 datasetp<-mlbench::mlbench.2dnormals(100,2)
dat<- as.data.frame(p)
# Train modelmdl<- 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 datasetp<- mlbench.2dnormals(100,2)
dat<- as.data.frame(p)
# Convert data.frame to model.matrixX<- model.matrix(classes~., dat)
# Train on first datasetmdl<- ftrlprox(X, dat$classes, lambda=1e-2, alpha=1, a=0.3)
# Generate more of the same data after the first training sessionp<- 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.4

  • Registered native routines and disabled dynamic symbol lookup (required by CRAN since R 3.4).
  • Replaced printf with Rprintf in the C sources.
  • Bumped minimum R version to 3.5.0.
  • Cleaned up T/F usage, removed unused LazyData, refreshed roxygen docs.

0.3

  • Added prediction type "class".

0.2

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

About

R package for online training of regression models using FTRL Proximal

Topics

Resources

Stars

12 stars

Watchers

5 watching

Forks

Releases

Packages

Contributors

Languages