View source: R/s_LightRuleFit.R
s_LightRuleFit | R Documentation |
Train a LightGBM gradient boosting model, extract rules, and fit using LASSO
s_LightRuleFit(
x,
y = NULL,
x.test = NULL,
y.test = NULL,
lgbm.mod = NULL,
n_trees = 200,
num_leaves = 32L,
max_depth = 4,
learning_rate = 0.1,
subsample = 0.666,
subsample_freq = 1L,
lambda_l1 = 0,
lambda_l2 = 0,
objective = NULL,
importance = FALSE,
lgbm.ifw = TRUE,
lgbm.grid.resample.params = setup.resample(resampler = "kfold", n.resamples = 5),
glmnet.ifw = TRUE,
alpha = 1,
lambda = NULL,
glmnet.grid.resample.params = setup.resample(resampler = "kfold", n.resamples = 5),
grid.resample.params = setup.resample("kfold", 5),
gridsearch.type = "exhaustive",
metric = NULL,
maximize = NULL,
grid.verbose = FALSE,
save.gridrun = FALSE,
weights = NULL,
empirical_risk = TRUE,
cases_by_rules = NULL,
save_cases_by_rules = FALSE,
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,
trace = 0,
.gs = FALSE
)
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 |
y.test |
Numeric vector of testing set outcome |
lgbm.mod |
rtMod object created by s_LightGBM. If provided, the gradient boosting step is skipped. |
num_leaves |
Integer: [gS] Maximum tree leaves for base learners. |
max_depth |
Integer: [gS] Maximum tree depth for base learners, <=0 means no limit. |
learning_rate |
Numeric: [gS] Boosting learning rate |
subsample |
Numeric: [gS] Subsample ratio of the training set. |
subsample_freq |
Integer: Subsample every this many iterations |
lambda_l1 |
Numeric: [gS] L1 regularization term |
lambda_l2 |
Numeric: [gS] L2 regularization term |
objective |
(Default = NULL) |
importance |
Logical: If |
alpha |
[gS] Float [0, 1]: The elasticnet mixing parameter:
|
lambda |
[gS] Float vector: Best left to NULL, |
grid.resample.params |
List: Output of setup.resample defining grid search parameters. |
gridsearch.type |
Character: Type of grid search to perform: "exhaustive" or "randomized". |
metric |
Character: Metric to minimize, or maximize if
|
maximize |
Logical: If TRUE, |
grid.verbose |
Logical: Passed to |
save.gridrun |
Logical: If |
weights |
Numeric vector: Weights for cases. For classification, |
empirical_risk |
Logical: If TRUE, calculate empirical risk |
cases_by_rules |
Matrix of cases by rules from a previoue rulefit run. If provided, the GBM step is skipped. |
save_cases_by_rules |
Logical: If TRUE, save cases_by_rules to object |
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 |
plot.fitted |
Logical: if TRUE, plot True (y) vs Fitted |
plot.predicted |
Logical: if TRUE, plot True (y.test) vs Predicted.
Requires |
plot.theme |
Character: "zero", "dark", "box", "darkbox" |
outdir |
Path to output directory.
If defined, will save Predicted vs. True plot, if available,
as well as full model output, if |
save.mod |
Logical: If TRUE, save all output to an RDS file in |
verbose |
Logical: If TRUE, print summary to screen. |
trace |
Integer: Verbosity level |
.gs |
(Internal use only) |
Based on "Predictive Learning via Rule Ensembles" by Friedman and Popescu http://statweb.stanford.edu/~jhf/ftp/RuleFit.pdf
rtMod
object
E.D. Gennatas
Friedman JH, Popescu BE, "Predictive Learning via Rule Ensembles", http://statweb.stanford.edu/~jhf/ftp/RuleFit.pdf
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.