brainvat / Hefin-I-Rhys-Machine-Learning-with-R-the-tidyverse-and-mlr

Exercises from Hefin I. Rhys' book, "Machine Learning with R, the tidyverse and mlr" by Manning Press
7 stars 9 forks source link

Benchmarking kNN, random forest, and XGBoost #1

Open kamaulindhardt opened 3 years ago

kamaulindhardt commented 3 years ago

I get the following error:

**Error in benchmark(learners, fuelTask, holdout) : Assertion on 'design' failed: Must be of type 'data.frame', not 'list'.**

When trying to benchmark the kNN, Random Forest and XGBoost models in chapter 12

kknnWrapper <- makeTuneWrapper(kknn, resampling = kFold,
                                par.set = kknnParamSpace,
                                control = gridSearch)

forestWrapper <- makeTuneWrapper(forest, resampling = kFold,
                                par.set = forestParamSpace,
                                control = randSearch)
xgbWrapper <- makeTuneWrapper(xgb, resampling = kFold,
                                  par.set = xgbParamSpace,
                                  control = randSearch)

learners = list(kknnWrapper, forestWrapper, xgbWrapper)

holdout <- makeResampleDesc("Holdout")

bench <- benchmark(learners, fuelTask, holdout)

Should I update mlr package or is there a way around it?

kamaulindhardt commented 3 years ago

SOLVED:

I solved it by simply specifying the package, like this:

bench <- mlr::benchmark(learners, fuelTask, holdout)