Reputation: 3
I am using parameters optimization (random search) with mlr3 but it gives me the following error. I tried with other models too (kknn) but the same error comes in.
Error: Resampling 'cv' may not be instantiated
///My code is here
data = readARFF("xerces.arff")
index= sample(1:nrow(data), 0.7*nrow(data))
train= data[index,]
test= data[-index,]
task = TaskRegr$new("data", backend = train, target = "bug")
learner5=lrn("regr.randomForest")
resampling_cv = rsmp("cv", folds = 10L)
resampling_cv$instantiate(task)
measure= msr("regr.mae")
search_space = paradox::ParamSet$new(
params = list(paradox::ParamInt$new("ntree", lower = 100, upper = 500)))
terminator = trm("evals", n_evals = 30)
tuner = tnr("random_search")
at = AutoTuner$new(
learner = learner5,
resampling = resampling_cv,
measure = measure,
search_space = search_space,
terminator = terminator,
tuner = tuner, store_tuning_instance = TRUE,
store_benchmark_result = TRUE,
store_models = TRUE
)
Upvotes: 0
Views: 88
Reputation: 1491
You instantiate the resampling with resampling_cv$instantiate(task)
. Remove this line and it should work.
Upvotes: 1