Description Usage Arguments Value Author(s) See Also Examples
View source: R/modeling_procedure.r
A modeling procedure is an object containing all information necessary to
carry out and evaluate the performance of a predictive modeling task with
fit
, tune
, or evaluate
.
To use an out-of-the box algorithm with default values, only the
method
argument needs to be set. See emil
for a
list of available methods. To deviate from the defaults, e.g. by tuning
parameters or using a custom function for model fitting, set the appropriate
parameters as described below.
For a guide on how to implement a custom method see the documentaion page
extension
.
1 2 | modeling_procedure(method, parameter = list(), error_fun = NULL, fit_fun,
predict_fun, importance_fun)
|
method |
The name of the modeling method. Only needed to identify
plug-in functions, i.e. if you supply them yourself there is no need to
set |
parameter |
A list of model parameters. These will be fed to the fitting
function after the dataset ( When tuning more than one parameter, all combinations of parameter values
will be tested, if the elements of Parameters that should have vectors or lists as values, e.g. |
error_fun |
Performance measure used to evaluate procedures
and to tune parameters. See |
fit_fun |
The function to be used for model fitting. |
predict_fun |
The function to be used for model prediction. |
importance_fun |
The function to be used for calculating or extracting
feature importances. See |
An object of class modeling_procedure
.
Christofer Bäcklin
emil
, evaluate
,
fit
, tune
,
predict
, get_importance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # 1: Fit linear discriminants without tuning any parameter,
# since it has none
modeling_procedure("lda")
# 2: Tune random forest's `mtry` parameter, with 3 possible values
modeling_procedure("randomForest", list(mtry = list(100, 250, 1000)))
# 3: Tune random forest's `mtry` and `maxnodes` parameters simultaneously,
# with 3 values each, testing all 9 possible combinations
modeling_procedure("randomForest", list(mtry = list(100, 250, 1000),
maxnodes = list(5, 10, 25)))
# 4: Tune random forest's `mtry` and `maxnodes` parameters simultaneously,
# but only test 3 manually specified combinations of the two
modeling_procedure("randomForest", list(list(mtry = 100, maxnodes = 5),
list(mtry = 250, maxnodes = 10),
list(mtry = 1000, maxnodes = 25)))
# 5: Tune elastic net's `alpha` and `lambda` parameters. Since elastic net's
# fitting function can tune `lambda` internally in a more efficient way
# than the general framework is able to do, only tune `alpha` and pass all
# `lambda` values as a single argument.
modeling_procedure("glmnet", list(alpha = seq(0, 1, length.out=6),
lambda = list(seq(0, 5, length.out=30))))
# 6: Train elastic nets using the caret package's model fitting framework
if(requireNamespace("caret", quitely = TRUE)){
modeling_procedure("caret", list(method = "glmnet",
trControl = list(trainControl(verboseIter = TRUE, classProbs = TRUE))))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.