Skip to content

Commit

Permalink
Remove non-negativity restriction from beta
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianSosic committed Feb 18, 2025
1 parent 949b897 commit 6d1e22b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.12.2] - 2025-01-31
### Changed
- More robust settings for the GP fitting
- The `beta` parameter of `UCB` and `qUCB` can now also take negative values

## [0.12.1] - 2025-01-29
### Changed
Expand Down
24 changes: 10 additions & 14 deletions baybe/acquisition/acqfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
from baybe.acquisition.base import AcquisitionFunction
from baybe.searchspace import SearchSpace
from baybe.utils.basic import classproperty
from baybe.utils.sampling_algorithms import (
DiscreteSamplingMethod,
sample_numerical_df,
)
from baybe.utils.sampling_algorithms import DiscreteSamplingMethod, sample_numerical_df
from baybe.utils.validation import finite_float


########################################################################################
Expand Down Expand Up @@ -267,9 +265,12 @@ class UpperConfidenceBound(AcquisitionFunction):
beta: float = field(converter=float, validator=ge(0.0), default=0.2)
"""Trade-off parameter for mean and variance.
A value of zero makes the acquisition mechanism consider the posterior predictive
mean only, resulting in pure exploitation. Higher values shift the focus more and
more toward exploration.
* A value of zero makes the acquisition mechanism consider the posterior predictive
mean only, resulting in a risk-neutral behavior.
* Values larger than zero induce risk-seeking behavior, shifting the focus
more and more toward exploration.
* Values smaller than zero lead to favoring risk-averse decisions (a.k.a. "safe
bets"), with purely exploitative behavior in the limit.
"""


Expand All @@ -279,13 +280,8 @@ class qUpperConfidenceBound(AcquisitionFunction):

abbreviation: ClassVar[str] = "qUCB"

beta: float = field(converter=float, validator=ge(0.0), default=0.2)
"""Trade-off parameter for mean and variance.
A value of zero makes the acquisition mechanism consider the posterior predictive
mean only, resulting in pure exploitation. Higher values shift the focus more and
more toward exploration.
"""
beta: float = field(converter=float, validator=finite_float, default=0.2)
"""See :paramref:`UpperConfidenceBound.beta`."""


@define(frozen=True)
Expand Down
4 changes: 2 additions & 2 deletions tests/hypothesis_strategies/acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ def _qNIPV_strategy(draw: st.DrawFn):
acquisition_functions = st.one_of(
st.builds(ExpectedImprovement),
st.builds(ProbabilityOfImprovement),
st.builds(UpperConfidenceBound, beta=finite_floats(min_value=0.0)),
st.builds(UpperConfidenceBound, beta=finite_floats()),
st.builds(PosteriorMean),
st.builds(PosteriorStandardDeviation, maximize=st.sampled_from([True, False])),
st.builds(qPosteriorStandardDeviation),
st.builds(LogExpectedImprovement),
st.builds(qExpectedImprovement),
st.builds(qProbabilityOfImprovement),
st.builds(qUpperConfidenceBound, beta=finite_floats(min_value=0.0)),
st.builds(qUpperConfidenceBound, beta=finite_floats()),
st.builds(qSimpleRegret),
st.builds(qLogExpectedImprovement),
st.builds(
Expand Down

0 comments on commit 6d1e22b

Please sign in to comment.