Assertion issue in Chapter 12 (hypertuning)
I'm running the hyperparameter code:
progressr::with_progress(expr = { rr_spcv_svm = mlr3::resample(task = task, learner = at_ksvm, # outer resampling (performance level) resampling = perf_level, store_models = FALSE, encapsulate = "evaluate") })
and I get
Error in assert_learner(fallback, task_type = self$task_type) : Assertion on 'fallback' failed: Must inherit from class 'Learner', but has class 'NULL'.
I saw https://github.com/geocompx/geocompr/issues/1110 and tried downgrading my versions (to 0.90 of extralearners and 21.1 of mlr3, as the 0.90 of extra learners said it needed at least 21.1) but no success.
Is this a bug with a known fix?
If it helps, I'm using R 4.4.1 on Mac running 15.2
@maltenform It seems to be working when you remove encapsulate = "evaluate" (however, I cannot explain why this happens; maybe relates to https://github.com/mlr-org/mlr3/pull/1109/files ??, @jannes-m )
progressr::with_progress(expr = {
rr_spcv_svm = mlr3::resample(task = task,
learner = at_ksvm,
# outer resampling (performance level)
resampling = perf_level,
store_models = FALSE)
})
And so it does work! Have it running now. Thank you!
Well, leaving out the encapsulation parameter will use the default which is NA which means that one error due to only one failed model will stop the entire resampling. Hence, this is not desirable instead we would like to have a fallback learner in these cases.
In any case, this seems to be a mlr3 bug. Therefore, I have opened a corresponding issue, see https://github.com/mlr-org/mlr3/issues/1249
@jannes-m I do not fully understand the discussion in the related issue... Do we need to change anything in the book?
Hey @Nowosad, yes, we need to change something. Actually I wanted to wait until this is solved upstream. But since this might still take a while, I can also implement the solution as suggested in https://github.com/mlr-org/mlr3/issues/1249