-
-
Notifications
You must be signed in to change notification settings - Fork 407
Description
When I use the example code from makeModelMultiplexer and use my task instead of the iris task, tuning does not work. With the iris task, it does work. With my task without a model multiplexer (single learners), tuning works, too.
Can you please help me figure out what the problem is?
# download data into working directory
# http://www.salvirt.com/?smd_process_download=1&download_id=4128
# description of data set: http://www.salvirt.com/b2bdataset/
data = read.csv2("Salvirt_B2B_ML_dataset.csv", header = TRUE)
task = makeClassifTask(data = data, target = "Status")
# this code is taken from ?makeModelMultiplexer
# the only change is using "task" instead of "iris.task" in tuneParams
set.seed(123)
library(BBmisc)
bls = list(
makeLearner("classif.ksvm"),
makeLearner("classif.randomForest")
)
lrn = makeModelMultiplexer(bls)
ps = makeModelMultiplexerParamSet(lrn,
makeNumericParam("sigma", lower = -10, upper = 10, trafo = function(x) 2^x),
makeIntegerParam("ntree", lower = 1L, upper = 500L)
)
rdesc = makeResampleDesc("CV", iters = 2L)
ctrl = makeTuneControlRandom(maxit = 10L)
res = tuneParams(lrn, task, rdesc, par.set = ps, control = ctrl)
[Tune] Started tuning learner ModelMultiplexer for parameter set:
Type len Def Constr Req Tunable Trafo
selected.learner discrete - - classif.ksvm,classif.randomForest - TRUE -
classif.ksvm.sigma numeric - - -10 to 10 Y TRUE Y
classif.randomForest.ntree integer - - 1 to 500 Y TRUE -
With control class: TuneControlRandom
Imputation value: 1
[Tune-x] 1: selected.learner=classif.rand...; ntree=152
[Tune-y] 1: mmce.test.mean= NA; time: 0.0 min
[Tune-x] 2: selected.learner=classif.rand...; ntree=420
[Tune-y] 2: mmce.test.mean= NA; time: 0.0 min
[Tune-x] 3: selected.learner=classif.rand...; ntree=244
[Tune-y] 3: mmce.test.mean= NA; time: 0.0 min
[Tune-x] 4: selected.learner=classif.rand...; ntree=365
[Tune-y] 4: mmce.test.mean= NA; time: 0.0 min
[Tune-x] 5: selected.learner=classif.rand...; ntree=69
[Tune-y] 5: mmce.test.mean= NA; time: 0.0 min
[Tune-x] 6: selected.learner=classif.ksvm; sigma=0.00389
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 224, 218
# if I do not use a model multiplexer, tuning works fine
ps2 = makeParamSet(makeNumericParam("sigma", lower = -10, upper = 10, trafo = function(x) 2^x))
tuneParams("classif.ksvm", task, rdesc, par.set = ps2, control = ctrl)
ps3 = makeParamSet(makeIntegerParam("ntree", lower = 1L, upper = 500L))
tuneParams("classif.randomForest", task, rdesc, par.set = ps3, control = ctrl)