Skip to content

Commit

Permalink
fix: set check_values to FALSE to improve runtime of AcqFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Jul 6, 2024
1 parent f4e7a20 commit f135458
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/AcqFunction.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ AcqFunction = R6Class("AcqFunction",
self$surrogate_max_to_min = surrogate_mult_max_to_min(surrogate)
domain = generate_acq_domain(surrogate)
}
super$initialize(id = id, domain = domain, codomain = codomain, constants = constants, label = label, man = man)
super$initialize(id = id, domain = domain, codomain = codomain, constants = constants, check_values = FALSE, label = label, man = man)
},

#' @description
Expand Down
3 changes: 1 addition & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ output: github_document
```{r, include = FALSE}
lgr::get_logger("mlr3")$set_threshold("warn")
lgr::get_logger("bbotk")$set_threshold("warn")
```

# mlr3mbo
Expand Down Expand Up @@ -56,7 +55,7 @@ obfun = ObjectiveRFun$new(
domain = ps(x = p_dbl(lower = -10, upper = 10)),
codomain = ps(y1 = p_dbl(tags = "minimize")))
instance = OptimInstanceSingleCrit$new(
instance = oi(
objective = obfun,
terminator = trm("evals", n_evals = 10))
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ vignette](https://mlr3mbo.mlr-org.com/dev/articles/mlr3mbo.html).
`mlr3mbo` is built modular relying on the following
[R6](https://cran.r-project.org/package=R6) classes:

- `Surrogate`: Surrogate Model
- `AcqFunction`: Acquisition Function
- `AcqOptimizer`: Acquisition Function Optimizer
- `Surrogate`: Surrogate Model
- `AcqFunction`: Acquisition Function
- `AcqOptimizer`: Acquisition Function Optimizer

Based on these, Bayesian Optimization loops can be written, see, e.g.,
`bayesopt_ego` for sequential single-objective BO.
Expand Down Expand Up @@ -58,7 +58,7 @@ obfun = ObjectiveRFun$new(
domain = ps(x = p_dbl(lower = -10, upper = 10)),
codomain = ps(y1 = p_dbl(tags = "minimize")))

instance = OptimInstanceSingleCrit$new(
instance = oi(
objective = obfun,
terminator = trm("evals", n_evals = 10))

Expand All @@ -77,6 +77,7 @@ optimizer$optimize(instance)
```

## x x_domain y1
## <num> <list> <num>
## 1: 0.03897209 <list[1]> 0.001518824

Note that you can also use `bb_optimize` as a shorthand:
Expand Down Expand Up @@ -133,4 +134,5 @@ instance$result
```

## cp learner_param_vals x_domain classif.ce
## 1: -4.594102 <list[2]> <list[1]> 0.2109375
## <num> <list> <list> <num>
## 1: -4.381681 <list[2]> <list[1]> 0.2070312

0 comments on commit f135458

Please sign in to comment.