Tunes the Hyperparameters for a given task and learner. Tries to find the best parameter set to tune for the given learner.

hyperopt(task, learner = NULL, par.config = NULL,
  hyper.control = NULL, show.info = getMlrOptions()$show.info)

Arguments

task

[Task] The Task

learner

[Learner] The learner that is subject to the Hyperparameter Tuning. If no learner is given the learner referenced in the par.config will be used, if available.

par.config

[ParConfig] The Parameter Configuration

hyper.control

[HyperControl] The Hyperparameter Control Object

show.info

[logical(1)]
Print verbose output on console? Default is set via configureMlr.

Value

[TuneResult]

Examples

# the shortest way of hyperparameter optimization hyperopt(iris.task, "classif.svm")
#> [Tune] Started tuning learner classif.svm for parameter set:
#> Type len Def Constr Req Tunable Trafo #> cost numeric - 0 -15 to 15 - TRUE Y #> gamma numeric - -2 -15 to 15 - TRUE Y
#> With control class: TuneControlMBO
#> Imputation value: 1
#> [Tune-x] 1: cost=7.65e-05; gamma=43.3
#> [Tune-y] 1: mmce.test.mean=0.7466667; time: 0.0 min
#> [Tune-x] 2: cost=0.423; gamma=0.0585
#> [Tune-y] 2: mmce.test.mean=0.0466667; time: 0.0 min
#> [Tune-x] 3: cost=171; gamma=0.00102
#> [Tune-y] 3: mmce.test.mean=0.0400000; time: 0.0 min
#> [Tune-x] 4: cost=0.000709; gamma=4.42e-05
#> [Tune-y] 4: mmce.test.mean=0.6800000; time: 0.0 min
#> [Tune-x] 5: cost=2.13e+03; gamma=510
#> [Tune-y] 5: mmce.test.mean=0.7466667; time: 0.0 min
#> [Tune-x] 6: cost=10.4; gamma=2.44e+04
#> [Tune-y] 6: mmce.test.mean=0.7733333; time: 0.0 min
#> [Tune-x] 7: cost=2.88e+04; gamma=4.49
#> [Tune-y] 7: mmce.test.mean=0.0800000; time: 0.0 min
#> [Tune-x] 8: cost=0.00853; gamma=0.262
#> [Tune-y] 8: mmce.test.mean=0.6800000; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> Warning: NAs introduced by coercion to integer range
#> [Tune-x] 9: cost=170; gamma=0.00104
#> [Tune-y] 9: mmce.test.mean=0.0400000; time: 0.0 min
#> [Tune-x] 10: cost=2.72; gamma=0.00205
#> [Tune-y] 10: mmce.test.mean=0.1200000; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> [Tune-x] 11: cost=2.71e+04; gamma=0.0242
#> [Tune-y] 11: mmce.test.mean=0.0400000; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> [Tune-x] 12: cost=0.985; gamma=0.000268
#> [Tune-y] 12: mmce.test.mean=0.6800000; time: 0.0 min
#> Warning: Stopped because hard maximum generation limit was hit.
#> [Tune-x] 13: cost=8.65; gamma=0.0231
#> [Tune-y] 13: mmce.test.mean=0.0333333; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> [Tune-x] 14: cost=39.6; gamma=0.0379
#> [Tune-y] 14: mmce.test.mean=0.0333333; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> [Tune-x] 15: cost=5.91e+03; gamma=0.00895
#> [Tune-y] 15: mmce.test.mean=0.0400000; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> [Tune-x] 16: cost=3.07e-05; gamma=0.0121
#> [Tune-y] 16: mmce.test.mean=0.6800000; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> Warning: NAs introduced by coercion to integer range
#> Warning: Stopped because hard maximum generation limit was hit.
#> [Tune-x] 17: cost=9.75e+03; gamma=0.224
#> [Tune-y] 17: mmce.test.mean=0.0666667; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> Warning: Stopped because hard maximum generation limit was hit.
#> [Tune-x] 18: cost=3.27e+04; gamma=0.0017
#> [Tune-y] 18: mmce.test.mean=0.0266667; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> Warning: NAs introduced by coercion to integer range
#> Warning: Stopped because hard maximum generation limit was hit.
#> [Tune-x] 19: cost=657; gamma=0.00253
#> [Tune-y] 19: mmce.test.mean=0.0333333; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> Warning: NAs introduced by coercion to integer range
#> Warning: Stopped because hard maximum generation limit was hit.
#> [Tune-x] 20: cost=3.23e+04; gamma=0.0771
#> [Tune-y] 20: mmce.test.mean=0.0800000; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> Warning: Stopped because hard maximum generation limit was hit.
#> [Tune-x] 21: cost=2.6; gamma=0.0537
#> [Tune-y] 21: mmce.test.mean=0.0400000; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> Warning: NAs introduced by coercion to integer range
#> Warning: Stopped because hard maximum generation limit was hit.
#> [Tune-x] 22: cost=54.6; gamma=0.00496
#> [Tune-y] 22: mmce.test.mean=0.0266667; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> Warning: Stopped because hard maximum generation limit was hit.
#> [Tune-x] 23: cost=0.773; gamma=0.016
#> [Tune-y] 23: mmce.test.mean=0.0933333; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> Warning: NAs introduced by coercion to integer range
#> Warning: Stopped because hard maximum generation limit was hit.
#> [Tune-x] 24: cost=3.26e+04; gamma=1.04
#> [Tune-y] 24: mmce.test.mean=0.0733333; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> Warning: Stopped because hard maximum generation limit was hit.
#> [Tune-x] 25: cost=8.34e+03; gamma=0.000998
#> [Tune-y] 25: mmce.test.mean=0.0400000; time: 0.0 min
#> Warning: NAs introduced by coercion to integer range
#> Warning: Stopped because hard maximum generation limit was hit.
#> [Tune] Result: cost=3.27e+04; gamma=0.0017 : mmce.test.mean=0.0266667
#> Tune result: #> Op. pars: cost=3.27e+04; gamma=0.0017 #> mmce.test.mean=0.0266667
# manually defining the paramer space configuration par.config = makeParConfig( par.set = makeParamSet( makeIntegerParam("mtry", lower = 1, upper = 4), makeDiscreteParam("ntree", values = c(10, 25, 50)) ), par.vals = list(replace = FALSE), learner.name = "randomForest" ) hyperopt(bh.task, par.config = par.config)
#> [Tune] Started tuning learner regr.randomForest for parameter set:
#> Type len Def Constr Req Tunable Trafo #> mtry integer - - 1 to 4 - TRUE - #> ntree discrete - - 10,25,50 - TRUE -
#> With control class: TuneControlGrid
#> Imputation value: Inf
#> [Tune-x] 1: mtry=1; ntree=10
#> [Tune-y] 1: mse.test.mean=21.7826125; time: 0.0 min
#> [Tune-x] 2: mtry=2; ntree=10
#> [Tune-y] 2: mse.test.mean=14.7064988; time: 0.0 min
#> [Tune-x] 3: mtry=3; ntree=10
#> [Tune-y] 3: mse.test.mean=12.0903043; time: 0.0 min
#> [Tune-x] 4: mtry=4; ntree=10
#> [Tune-y] 4: mse.test.mean=12.2171300; time: 0.0 min
#> [Tune-x] 5: mtry=1; ntree=25
#> [Tune-y] 5: mse.test.mean=20.5001724; time: 0.0 min
#> [Tune-x] 6: mtry=2; ntree=25
#> [Tune-y] 6: mse.test.mean=13.5851321; time: 0.0 min
#> [Tune-x] 7: mtry=3; ntree=25
#> [Tune-y] 7: mse.test.mean=11.6376053; time: 0.0 min
#> [Tune-x] 8: mtry=4; ntree=25
#> [Tune-y] 8: mse.test.mean=10.6482737; time: 0.0 min
#> [Tune-x] 9: mtry=1; ntree=50
#> [Tune-y] 9: mse.test.mean=20.5619157; time: 0.0 min
#> [Tune-x] 10: mtry=2; ntree=50
#> [Tune-y] 10: mse.test.mean=13.4090302; time: 0.0 min
#> [Tune-x] 11: mtry=3; ntree=50
#> [Tune-y] 11: mse.test.mean=11.7444533; time: 0.0 min
#> [Tune-x] 12: mtry=4; ntree=50
#> [Tune-y] 12: mse.test.mean=11.0163396; time: 0.0 min
#> [Tune] Result: mtry=4; ntree=25 : mse.test.mean=10.6482737
#> Tune result: #> Op. pars: mtry=4; ntree=25 #> mse.test.mean=10.6482737