TunedModel {MachineShop} | R Documentation |
Model tuning over a grid of parameter values.
TunedModel( model, grid = MachineShop::settings("grid"), fixed = list(), control = MachineShop::settings("control"), metrics = NULL, stat = MachineShop::settings("stat.train"), cutoff = MachineShop::settings("cutoff") )
model |
model function, function name, or call defining the model to be tuned. |
grid |
single integer or vector of integers whose positions or names
match the parameters in the model's pre-defined tuning grid if one exists
and which specify the number of values used to construct the grid;
|
fixed |
list of fixed parameter values to combine with those in
|
control |
control function, function name, or call defining the resampling method to be employed. |
metrics |
metric function, function name, or vector of these with which to calculate performance. If not specified, default metrics defined in the performance functions are used. Model selection is based on the first calculated metric. |
stat |
function or character string naming a function to compute a summary statistic on resampled metric values for model tuning. |
cutoff |
argument passed to the |
The expand_modelgrid
function enables manual extraction and
viewing of grids created automatically when a TunedModel
is fit.
factor
, numeric
, ordered
,
Surv
TunedModel
class object that inherits from MLModel
.
## Requires prior installation of suggested package gbm to run ## May require a long runtime # Automatically generated grid model_fit <- fit(sale_amount ~ ., data = ICHomes, model = TunedModel(GBMModel)) varimp(model_fit) (tuned_model <- as.MLModel(model_fit)) summary(tuned_model) plot(tuned_model, type = "l") # Randomly sampled grid points fit(sale_amount ~ ., data = ICHomes, model = TunedModel(GBMModel, grid = Grid(size = 1000, random = 5))) # User-specified grid fit(sale_amount ~ ., data = ICHomes, model = TunedModel(GBMModel, grid = expand_params(n.trees = c(50, 100), interaction.depth = 1:2, n.minobsinnode = c(5, 10))))