tune(mlr)R Documentation

tune

Description

tune optimizes the hyperparameters of a learner for a classification or regression problem. Given some ranges for one or more hyperparameters, it estimates the performance of the learner for each possible combination of the proposed values by using a resampling method (e.g. cross-validation) and returns the best parameter set and its performance.

Usage

tune(learn.task, resample.instance, ranges, measure)

Arguments

learn.task [learn.task]
Specifies the learning task for the problem.
resample.instance [resample.instance]
Specifies the training and test indices of the resampled data.
ranges [list]
A list of named vectors/lists of possible values for each hyperparameter. You can also pass a list of such ranges by using [combine.ranges] in the rare case when it does not make sense to search a complete cross-product of range values.
measure [character/list]
Name of performance measure to optimize or a list describing your own performance measure. The default is mean misclassification error.

Value

A list containing the best parameter set, its aggregated performance over all resampling iterations, a measure of spread and a data frame containing the same values for all evaluated combinations of parameter values.

Examples

library(mlr) 
ct <- make.classif.task(learner="kernlab.svm.classif", data=iris, formula=Species~.)
ranges <- list(kernel="rbfdot", C=2^seq(-1,1), sigma=2^seq(-1,1))
ri <- make.cv.instance(size=nrow(iris), iters=3)  
tune(learn.task=ct, resample.instance=ri, ranges=ranges)

[Package mlr version 0.3.180 Index]