Learn R Programming

rtemis (version 0.79)

s.RULEFEAT: ruleFeat [C, R]

Description

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

Usage

s.RULEFEAT(x, y = NULL, x.test = NULL, y.test = NULL,
  n.trees = 100, gbm.params = list(bag.fraction = 0.5, shrinkage =
  0.001, interaction.depth = 5, ipw = TRUE), meta.alpha = 1,
  meta.lambda = NULL, meta.extra.params = list(ipw = TRUE),
  cases.by.rules = NULL, x.name = NULL, y.name = NULL,
  question = NULL, verbose = TRUE, n.cores = rtCores,
  print.plot = TRUE, plot.fitted = NULL, plot.predicted = NULL,
  plot.theme = getOption("rt.fit.theme", "lightgrid"), outdir = NULL,
  save.mod = if (!is.null(outdir)) TRUE else FALSE)

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

n.trees

Integer: Initial number of trees to fit

gbm.params

Named list: Parameters for s.GBM

meta.alpha

Float [0, 1]: alpha for s.GLMNET, Default = 1

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 rulefeat run. If provided, the GBM step is skipped. Default = NULL

x.name

Character: Name for feature set

y.name

Character: Name for outcome

question

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

verbose

Logical: If TRUE, print summary to screen.

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

String: "zero", "dark", "box", "darkbox"

outdir

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

save.mod

Logical. If TRUE, save all output as 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)

Value

rtMod object

Details

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

References

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