From 535c418c0ef88cf81539e982d50cef50ecfbbf81 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Mon, 13 Jan 2025 10:32:52 +0100 Subject: [PATCH] feat(check): better error message when measure's minimize is NA (#485) --- R/helper.R | 3 +++ man/AutoTuner.Rd | 1 + man/mlr_tuners_cmaes.Rd | 4 ++-- tests/testthat/test_Tuner.R | 12 ++++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/R/helper.R b/R/helper.R index dde0d77f..c2e45241 100644 --- a/R/helper.R +++ b/R/helper.R @@ -1,6 +1,9 @@ measures_to_codomain = function(measures) { measures = as_measures(measures) domains = map(measures, function(s) { + if (is.na(s$minimize)) { + stopf("Measure %s has its `minimize` field set to NA, which is disallowed when tuning.", s$id) + } p_dbl(tags = ifelse(s$minimize, "minimize", "maximize")) }) names(domains) = ids(measures) diff --git a/man/AutoTuner.Rd b/man/AutoTuner.Rd index 2624968c..6e40de4f 100644 --- a/man/AutoTuner.Rd +++ b/man/AutoTuner.Rd @@ -199,6 +199,7 @@ Hash (unique identifier) for this partial object, excluding some components whic \if{html}{\out{
Inherited methods