Skip to content

Commit 87f4f41

Browse files
authored
fix(at): unused AB and check on required params (#472)
* fixes * ...
1 parent 3e7cbf8 commit 87f4f41

7 files changed

+8
-18
lines changed

R/AutoTuner.R

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ AutoTuner = R6Class("AutoTuner",
143143
) {
144144
learner = assert_learner(as_learner(learner, clone = TRUE))
145145

146-
if (!is.null(search_space) && length(learner$param_set$get_values(type = "only_token")) > 0) {
146+
if (!is.null(search_space) && length(learner$param_set$get_values(type = "only_token", check_required = FALSE)) > 0) {
147147
stop("If the values of the ParamSet of the Learner contain TuneTokens you cannot supply a search_space.")
148148
}
149149

@@ -288,13 +288,6 @@ AutoTuner = R6Class("AutoTuner",
288288
),
289289

290290
active = list(
291-
#' @field internal_valid_scores
292-
#' Retrieves the inner validation scores as a named `list()`.
293-
#' Returns `NULL` if learner is not trained yet.
294-
internal_valid_scores = function() {
295-
self$state$internal_valid_scores
296-
},
297-
298291
#' @field archive [ArchiveBatchTuning]\cr
299292
#' Archive of the [TuningInstanceBatchSingleCrit].
300293
archive = function() self$tuning_instance$archive,

R/TuningInstanceAsyncMulticrit.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ TuningInstanceAsyncMultiCrit = R6Class("TuningInstanceAsyncMultiCrit",
5858
callbacks = assert_async_tuning_callbacks(as_callbacks(callbacks))
5959

6060
# tune token and search space
61-
if (!is.null(search_space) && length(learner$param_set$get_values(type = "only_token"))) {
61+
if (!is.null(search_space) && length(learner$param_set$get_values(type = "only_token", check_required = FALSE))) {
6262
stop("If the values of the ParamSet of the Learner contain TuneTokens you cannot supply a search_space.")
6363
}
6464

R/TuningInstanceAsyncSingleCrit.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ TuningInstanceAsyncSingleCrit = R6Class("TuningInstanceAsyncSingleCrit",
6868
callbacks = assert_async_tuning_callbacks(as_callbacks(callbacks))
6969

7070
# tune token and search space
71-
if (!is.null(search_space) && length(learner$param_set$get_values(type = "only_token"))) {
71+
if (!is.null(search_space) && length(learner$param_set$get_values(type = "only_token", check_required = FALSE))) {
7272
stop("If the values of the ParamSet of the Learner contain TuneTokens you cannot supply a search_space.")
7373
}
7474

R/TuningInstanceBatchMulticrit.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ TuningInstanceBatchMultiCrit = R6Class("TuningInstanceBatchMultiCrit",
8787
callbacks = assert_batch_tuning_callbacks(as_callbacks(callbacks))
8888

8989
# tune token and search space
90-
if (!is.null(search_space) && length(learner$param_set$get_values(type = "only_token"))) {
90+
if (!is.null(search_space) && length(learner$param_set$get_values(type = "only_token", check_required = FALSE))) {
9191
stop("If the values of the ParamSet of the Learner contain TuneTokens you cannot supply a search_space.")
9292
}
9393

@@ -129,7 +129,7 @@ TuningInstanceBatchMultiCrit = R6Class("TuningInstanceBatchMultiCrit",
129129

130130
# set learner parameter values
131131
if (search_space_from_tokens) {
132-
learner$param_set$values = learner$param_set$get_values(type = "without_token")
132+
learner$param_set$values = learner$param_set$get_values(type = "without_token", check_required = TRUE)
133133
}
134134

135135
if (!is.null(self$internal_search_space) && self$internal_search_space$has_trafo) {

R/TuningInstanceBatchSingleCrit.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ TuningInstanceBatchSingleCrit = R6Class("TuningInstanceBatchSingleCrit",
137137
callbacks = assert_batch_tuning_callbacks(as_callbacks(callbacks))
138138

139139
# tune token and search space
140-
if (!is.null(search_space) && length(learner$param_set$get_values(type = "only_token"))) {
140+
if (!is.null(search_space) && length(learner$param_set$get_values(type = "only_token", check_required = FALSE))) {
141141
stop("If the values of the ParamSet of the Learner contain TuneTokens you cannot supply a search_space.")
142142
}
143143

man/AutoTuner.Rd

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/mlr_tuners_cmaes.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)