View source: R/getCaretParamSet.R
getCaretParamSet | R Documentation |
Constructs a grid of tuning parameters from a learner of the caret
R-package. These values are then converted into a list of non-tunable
parameters (par.vals
) and a tunable
ParamHelpers::ParamSet (par.set
), which can be used by
tuneParams for tuning the learner. Numerical parameters will
either be specified by their lower and upper bounds or they will be
discretized into specific values.
getCaretParamSet(learner, length = 3L, task, discretize = TRUE)
learner |
( |
length |
( |
task |
(Task) |
discretize |
( |
(list(2)
). A list of parameters:
par.vals
contains a list of all constant tuning parameters
par.set
is a ParamHelpers::ParamSet, containing all the configurable
tuning parameters
if (requireNamespace("caret") && requireNamespace("mlbench")) {
library(caret)
classifTask = makeClassifTask(data = iris, target = "Species")
# (1) classification (random forest) with discretized parameters
getCaretParamSet("rf", length = 9L, task = classifTask, discretize = TRUE)
# (2) regression (gradient boosting machine) without discretized parameters
library(mlbench)
data(BostonHousing)
regrTask = makeRegrTask(data = BostonHousing, target = "medv")
getCaretParamSet("gbm", length = 9L, task = regrTask, discretize = FALSE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.