Learn R Programming

rFTRLProximal (version 1.0.0)

FTRLProx_Hashing: Feature Hashing for FTRL-Proximal Model

Description

Feature Hashing for FTRL-Proximal Algorithm. A wrapper of hashed.model.matrix function in the FeatureHashing package. Please always use this function to generate sparse matrix for training and prediction.

Usage

FTRLProx_Hashing(formula = ~., data, hash.size, signed.hash, verbose = TRUE)

Arguments

formula
formula or a character vector of column names (will be expanded to a formula)
data
a data.frame or data.table. The original data.
hash.size
positive integer. The hash size of feature hashing.
signed.hash
logical value. Indicating if the hashed value is multipled by random sign. This will reduce the impact of collision. Disable it will enhance the speed.
verbose
logical value. Indicating if the progress bar is displayed or not.

Value

an object of class "dgCMatrix"

Examples

Run this code
library(data.table)
library(FeatureHashing)
data(ipinyou)
m.train <- FTRLProx_Hashing(~ 0 + ., ipinyou.train[, -"IsClick", with = FALSE],
                            hash.size = 2^13, signed.hash = FALSE, verbose = TRUE)
m.test <- FTRLProx_Hashing(~ 0 + ., ipinyou.test[,-"IsClick", with = FALSE],
                           hash.size = 2^13, signed.hash = FALSE, verbose = TRUE)

Run the code above in your browser using DataLab