s_RuleFit: Rulefit [C, R]

View source: R/s_RuleFit.R

s_RuleFitR Documentation

Rulefit [C, R]

Description

Train a gradient boosting model, extract rules, and fit using LASSO

Usage

s_RuleFit(
  x,
  y = NULL,
  x.test = NULL,
  y.test = NULL,
  gbm.params = list(list(n.trees = 300, bag.fraction = 1, shrinkage = 0.1,
    interaction.depth = 3, ifw = TRUE)),
  meta.alpha = 1,
  meta.lambda = NULL,
  meta.extra.params = list(ifw = TRUE),
  cases.by.rules = NULL,
  x.name = NULL,
  y.name = NULL,
  n.cores = rtCores,
  question = NULL,
  print.plot = FALSE,
  plot.fitted = NULL,
  plot.predicted = NULL,
  plot.theme = rtTheme,
  outdir = NULL,
  save.mod = if (!is.null(outdir)) TRUE else FALSE,
  verbose = TRUE
)

Arguments

x

Numeric vector or matrix / data frame of features i.e. independent variables

y

Numeric vector of outcome, i.e. dependent variable

x.test

Numeric vector or matrix / data frame of testing set features Columns must correspond to columns in x

y.test

Numeric vector of testing set outcome

gbm.params

List of named lists: A list, each element of which is a named list of parameters for s_GBM. i.e. If you want to train a single GBM model, this could be: gbm.params = list( list( n.trees = 300, bag.fraction = 1, shrinkage = .1, interaction.depth = 3, ifw = TRUE ) ) if you wanted to train 2 GBM models, this could be: gbm.params = list( list( n.trees = 300, bag.fraction = 1, shrinkage = .1, interaction.depth = 3, ifw = TRUE ), list( n.trees = 500, bag.fraction = 1, shrinkage = .1, interaction.depth = 3, ifw = TRUE ) )

meta.alpha

Float [0, 1]: alpha for s_GLMNET

meta.lambda

Float: lambda for s_GLMNET. Default = NULL (will be determined automatically by crossvalidation)

meta.extra.params

Named list: Parameters for s_GLMNET for the feature selection step

cases.by.rules

Matrix of cases by rules from a previoue rulefit run. If provided, the GBM step is skipped. Default = NULL

x.name

Character: Name for feature set

y.name

Character: Name for outcome

n.cores

Integer: Number of cores to use

question

Character: the question you are attempting to answer with this model, in plain language.

print.plot

Logical: if TRUE, produce plot using mplot3 Takes precedence over plot.fitted and plot.predicted.

plot.fitted

Logical: if TRUE, plot True (y) vs Fitted

plot.predicted

Logical: if TRUE, plot True (y.test) vs Predicted. Requires x.test and y.test

plot.theme

Character: "zero", "dark", "box", "darkbox"

outdir

Character: If defined, save log, 'plot.all' plots (see above) and RDS file of complete output

save.mod

Logical: If TRUE, save all output to an RDS file in outdir save.mod is TRUE by default if an outdir is defined. If set to TRUE, and no outdir is defined, outdir defaults to paste0("./s.", mod.name)

verbose

Logical: If TRUE, print summary to screen.

Details

Based on "Predictive Learning via Rule Ensembles" by Friedman and Popescu http://statweb.stanford.edu/~jhf/ftp/RuleFit.pdf

Value

rtMod object

Author(s)

E.D. Gennatas

References

Friedman JH, Popescu BE, "Predictive Learning via Rule Ensembles", http://statweb.stanford.edu/~jhf/ftp/RuleFit.pdf


egenn/rtemis documentation built on Oct. 28, 2024, 6:30 a.m.