diff --git a/book/chapters/chapter15/predsets_valid_inttune.qmd b/book/chapters/chapter15/predsets_valid_inttune.qmd index 042d1ba89..35a4a42f3 100644 --- a/book/chapters/chapter15/predsets_valid_inttune.qmd +++ b/book/chapters/chapter15/predsets_valid_inttune.qmd @@ -316,7 +316,8 @@ ggplot(data = d, aes(x = eta, y = nrounds, color = logloss)) + geom_point() + theme_minimal() ``` -This also works with an `r ref("AutoTuner")`, which will use the internally optimized `nrounds`, as well as the offline tuned `eta` for the final model fit. This means that there is no validation or early stopping when training the final model, and we use as much data as possible. +This also works with an `r ref("AutoTuner")`, which will use the internally optimized `nrounds`, as well as the offline tuned `eta` for the final model fit. +This means that there is no validation or early stopping when training the final model, and we use as much data as possible. ```{r} at = auto_tuner( @@ -330,9 +331,13 @@ at = auto_tuner( at$train(tsk_sonar) ``` -If we were to resample the `AutoTuner` from above, we would still get valid performance estimates. This is because the test set of the outer resampling is *never* used as validation data, since the final model fit does not perform any validation. The validation data generated during the hyperparameter tuning uses the test set of the inner resampling, which is a subset of the training set of the outer resampling. +If we were to resample the `AutoTuner` from above, we would still get valid performance estimates. +This is because the test set of the outer resampling is *never* used as validation data, since the final model fit does not perform any validation. +The validation data generated during the hyperparameter tuning uses the test set of the inner resampling, which is a subset of the training set of the outer resampling. -However, care must be taken when using the test set of a resampling for validation. Whether this is OK depends on the context and purpose of the resampling. If the purpose of resampling is to get an unbiased performance estimate of algorithms, some of which stop early and some of which don't, this is not OK. In such a situation, the former would have an unfair advantage over the latter. The example below illustrates such a case where this would not be a fair comparison between the two learners. +However, care must be taken when using the test set of a resampling for validation. Whether this is OK depends on the context and purpose of the resampling. +If the purpose of resampling is to get an unbiased performance estimate of algorithms, some of which stop early and some of which don't, this is not OK. +In such a situation, the former would have an unfair advantage over the latter. The example below illustrates such a case where this would not be a fair comparison between the two learners. ```{r} lrn_xgb$param_set$set_values( @@ -347,7 +352,8 @@ bmr = benchmark(design) bmr$aggregate(msr("classif.ce")) ``` -At last, we will cover how to enable internal tuning when manually specifying a search space with the `ps()` function instead of the `to_tune()`-mechanism. While the latter is more convenient and therefore usually recommended, manually defining a search space gives you for more flexibility with respect to parameter transformations, see e.g. @sec-tune-trafo. Below, we define the search space from the previous example. To mark the `nrounds` parameter for internal tuning we have to tag it with `"internal_tuning"` and specify the aggregation function, in this case to take the average number of rounds across the folds. +At last, we will cover how to enable internal tuning when manually specifying a search space with the `ps()` function instead of the `to_tune()`-mechanism. +While the latter is more convenient and therefore usually recommended, manually defining a search space gives you for more flexibility with respect to parameter transformations, see e.g. @sec-tune-trafo. Below, we define the search space from the previous example. To mark the `nrounds` parameter for internal tuning we have to tag it with `"internal_tuning"` and specify the aggregation function, in this case to take the average number of rounds across the folds. ```{r} search_space = ps( diff --git a/book/renv.lock b/book/renv.lock index 2352b5ed3..c8cd914a1 100644 --- a/book/renv.lock +++ b/book/renv.lock @@ -3874,8 +3874,14 @@ }, "mlr3tuning": { "Package": "mlr3tuning", - "Version": "1.1.0", - "Source": "Repository" + "Version": "1.1.0.9000", + "Source": "GitHub", + "RemoteType": "github", + "RemoteHost": "api.github.com", + "RemoteUsername": "mlr-org", + "RemoteRepo": "mlr3tuning", + "RemoteRef": "main", + "RemoteSha": "61802edaba88dd3051b9148e5aaa2b1aa43c818f" }, "mlr3tuningspaces": { "Package": "mlr3tuningspaces",