Train a gradient boosting model, extract rules, and fit using LASSO
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)
Numeric vector or matrix / data frame of features i.e. independent variables
Numeric vector of outcome, i.e. dependent variable
Numeric vector or matrix / data frame of testing set features
Columns must correspond to columns in x
Numeric vector of testing set outcome
Integer: Initial number of trees to fit
Named list: Parameters for s.GBM
Float [0, 1]: alpha
for s.GLMNET, Default = 1
Float: lambda
for s.GLMNET. Default = NULL (will be determined automatically
by crossvalidation)
Named list: Parameters for s.GLMNET for the feature selection step
Matrix of cases by rules from a previoue rulefeat run. If provided, the GBM step is skipped. Default = NULL
Character: Name for feature set
Character: Name for outcome
String: the question you are attempting to answer with this model, in plain language.
Logical: If TRUE, print summary to screen.
Logical: if TRUE, produce plot using mplot3
Takes precedence over plot.fitted
and plot.predicted
Logical: if TRUE, plot True (y) vs Fitted
Logical: if TRUE, plot True (y.test) vs Predicted.
Requires x.test
and y.test
String: "zero", "dark", "box", "darkbox"
String: If defined, save log, 'plot.all' plots (see above) and RDS file of complete output
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)
rtMod object
Based on "Predictive Learning via Rule Ensembles" by Friedman and Popescu http://statweb.stanford.edu/~jhf/ftp/RuleFit.pdf
Friedman JH, Popescu BE, "Predictive Learning via Rule Ensembles", http://statweb.stanford.edu/~jhf/ftp/RuleFit.pdf