tuneParams
.
If the train function is called on it,
the search strategy and resampling are invoked
to select an optimal set of hyperparameter values. Finally, a model is fitted on the
complete training data with these optimal hyperparameters and returned.
See tuneParams
for more details.After training, the optimal hyperparameters (and other related information) can be retrieved with
getTuneResult
.
makeTuneWrapper(learner, resampling, measures, par.set, control,
show.info = getMlrOption("show.info"))
Learner
].ModelMultiplexer
,
makeModelMultiplexer
;
TuneControl
,
TuneControlCMAES
,
TuneControlGenSA
,
TuneControlGrid
,
TuneControlIrace
,
TuneControlRandom
,
makeTuneControlCMAES
,
makeTuneControlDesign
,
makeTuneControlGenSA
,
makeTuneControlGrid
,
makeTuneControlIrace
,
makeTuneControlRandom
;
getNestedTuneResultsOptPathDf
;
getNestedTuneResultsX
;
getTuneResult
;
makeModelMultiplexerParamSet
;
tuneParams
; tuneThreshold
Other wrapper: CostSensClassifModel
,
CostSensClassifWrapper
,
makeCostSensClassifWrapper
;
CostSensRegrModel
,
CostSensRegrWrapper
,
makeCostSensRegrWrapper
;
makeBaggingWrapper
;
makeDownsampleWrapper
;
makeFeatSelWrapper
;
makeFilterWrapper
;
makeImputeWrapper
;
makeMulticlassWrapper
;
makeOverBaggingWrapper
;
makeOversampleWrapper
,
makeUndersampleWrapper
;
makePreprocWrapperCaret
;
makePreprocWrapper
;
makeSMOTEWrapper
;
makeWeightedClassesWrapper
task = makeClassifTask(data = iris, target = "Species")
lrn = makeLearner("classif.ksvm")
# stupid mini grid
ps = makeParamSet(
makeDiscreteParam("C", values = 1:2),
makeDiscreteParam("sigma", values = 1:2)
)
ctrl = makeTuneControlGrid()
inner = makeResampleDesc("Holdout")
outer = makeResampleDesc("CV", iters = 2)
lrn = makeTuneWrapper(lrn, resampling = inner, par.set = ps, control = ctrl)
mod = train(lrn, task)
print(getTuneResult(mod))
# nested resampling for evaluation
# we also extract tuned hyper pars in each iteration
r = resample(lrn, task, outer, extract = getTuneResult)
print(r$extract)
getNestedTuneResultsOptPathDf(r)
getNestedTuneResultsX(r)
Run the code above in your browser using DataLab