Created
January 19, 2017 02:55
-
-
Save Keiku/2c640f4aabefc390825faba8f2aca5be to your computer and use it in GitHub Desktop.
iris example with mlr.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(mlr) | |
set.seed(123, "L'Ecuyer") | |
iris.task = classif.task = makeClassifTask(id = "iris-example", data = iris, target = "Species") | |
resamp = makeResampleDesc("CV", iters = 10L) | |
lrn = makeLearner("classif.rpart") | |
control.grid = makeTuneControlGrid() | |
ps = makeParamSet( | |
makeDiscreteParam("cp", values = seq(0,0.1,0.01)), | |
makeDiscreteParam("minsplit", values = c(10,20)) | |
) | |
getParamSet(lrn) | |
res = tuneParams(lrn, task = iris.task, resampling = resamp, control = control.grid, par.set = ps, measures = list(acc,timetrain)) | |
opt.grid = as.data.frame(res$opt.path) | |
print(opt.grid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment