Skip to content

Commit

Permalink
Release 0.9.0 (#217)
Browse files Browse the repository at this point in the history
The 0.9.0 release PR containing additional prior maintenance PRs (#198,
#211)
  • Loading branch information
AdrianSosic authored May 21, 2024
2 parents ae5bad0 + f4d0ae8 commit 3a67df4
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 106 deletions.
20 changes: 13 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## [0.9.0] - 2024-05-21
### Added
- `mypy` for search space and objectives
- Class hierarchy for objectives
- Deserialization is now also possible from optional class name abbreviations
- `AdditiveKernel`, `LinearKernel`, `MaternKernel`, `PeriodicKernel`,
`PiecewisePolynomialKernel`, `PolynomialKernel`, `ProductKernel`, `RBFKernel`,
`RFFKernel`, `RQKernel`, `ScaleKernel` classes for specifying kernels
- `GammaPrior`, `HalfCauchyPrior`, `NormalPrior`, `HalfNormalPrior`, `LogNormalPrior`
and `SmoothedBoxPrior` classes for specifying priors
`RFFKernel`, `RQKernel`, `ScaleKernel` classes
- `KernelFactory` protocol enabling context-dependent construction of kernels
- Preset mechanism for `GaussianProcessSurrogate`
- `hypothesis` strategies and roundtrip test for kernels, constraints, objectives,
priors and acquisition functions
- New acquisition functions: `qSR`, `qNEI`, `LogEI`, `qLogEI`, `qLogNEI`
- Serialization user guide
- `GammaPrior`, `HalfCauchyPrior`, `NormalPrior`, `HalfNormalPrior`, `LogNormalPrior`
and `SmoothedBoxPrior` classes
- Possibility to deserialize classes from optional class name abbreviations
- Basic deserialization tests using different class type specifiers
- Serialization user guide
- Environment variables user guide
- Utility for estimating memory requirements of discrete product search space
- `mypy` for search space and objectives

### Changed
- Reorganized acquisition.py into `acquisition` subpackage
Expand Down Expand Up @@ -61,6 +61,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `acquisition_function_cls` constructor parameter for `BayesianRecommender`
- `VarUCB` and `qVarUCB` acquisition functions

### Expired Deprecations (from 0.6.*)
- `BayBE` class
- `baybe.surrogate` module
- `baybe.targets.Objective` class
- `baybe.strategies.Strategy` class

## [0.8.2] - 2024-03-27
### Added
- Simulation user guide
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ In cases where we are confronted with multiple (potentially conflicting) targets
the `DesirabilityObjective` can be used instead. It allows to define additional
settings, such as how these targets should be balanced.
For more details, see the
[objectives section](https://emdgroup.github.io/baybe/userguide/objective.html)
[objectives section](https://emdgroup.github.io/baybe/userguide/objectives.html)
of the user guide.

### Defining the Search Space
Expand Down Expand Up @@ -307,7 +307,7 @@ host machine names are anonymized with via truncated hashing.
`telemetry` module.
- You can always deactivate all telemetry by setting the environment variable
`BAYBE_TELEMETRY_ENABLED` to `false` or `off`. For details please consult
[this page](https://emdgroup.github.io/baybe/_autosummary/baybe.telemetry.html).
[this page](https://emdgroup.github.io/baybe/userguide/envvars.html#telemetry).
- If you want to be absolutely sure, you can uninstall internet related packages such
as `opentelemetry*` or its secondary dependencies from the environment. Due to the
inability of specifying opt-out dependencies, these are installed by default, but the
Expand Down
2 changes: 0 additions & 2 deletions baybe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import warnings

from baybe.campaign import Campaign
from baybe.deprecation import BayBE

# Show deprecation warnings
warnings.filterwarnings("default", category=DeprecationWarning, module="baybe")
Expand Down Expand Up @@ -52,7 +51,6 @@ def infer_version() -> str: # pragma: no cover
__version__ = infer_version()
__all__ = [
"__version__",
"BayBE",
"Campaign",
]

Expand Down
16 changes: 0 additions & 16 deletions baybe/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@

import warnings

from attrs import define

from baybe import Campaign


@define
class BayBE(Campaign):
"""A :class:`baybe.campaign.Campaign` alias for backward compatibility."""

def __attrs_pre_init__(self):
warnings.warn(
"The 'BayBE' class is deprecated and will be removed in a future version. "
"Please use the 'Campaign' class instead.",
DeprecationWarning,
)


def compatibilize_config(config: dict) -> dict:
"""Turn a legacy-format config into the new format."""
Expand Down
2 changes: 0 additions & 2 deletions baybe/strategies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from baybe.strategies.deprecation import (
SequentialStrategy,
Strategy,
StreamingSequentialStrategy,
TwoPhaseStrategy,
)
Expand All @@ -11,5 +10,4 @@
"SequentialStrategy",
"StreamingSequentialStrategy",
"TwoPhaseStrategy",
"Strategy",
]
12 changes: 0 additions & 12 deletions baybe/strategies/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
)


def Strategy(*args, **kwargs) -> TwoPhaseMetaRecommender:
"""A ``Strategy`` alias for backward compatibility.""" # noqa: D401 (imperative mood)
warnings.warn(
f"Using 'Strategy' directly is deprecated and will be removed in a future "
f"version. Please use 'recommenders.{TwoPhaseMetaRecommender.__name__}' class "
f"instead.",
DeprecationWarning,
)

return TwoPhaseMetaRecommender(*args, **kwargs)


def TwoPhaseStrategy(*args, **kwargs) -> TwoPhaseMetaRecommender:
"""A ``TwoPhaseStrategy`` alias for backward compatibility.""" # noqa: D401 (imperative mood)
warnings.warn(
Expand Down
11 changes: 0 additions & 11 deletions baybe/surrogate.py

This file was deleted.

2 changes: 0 additions & 2 deletions baybe/targets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""BayBE targets."""

from baybe.targets.deprecation import Objective
from baybe.targets.enum import TargetMode, TargetTransformation
from baybe.targets.numerical import NumericalTarget

__all__ = [
"NumericalTarget",
"Objective",
"TargetMode",
"TargetTransformation",
]
22 changes: 0 additions & 22 deletions baybe/targets/deprecation.py

This file was deleted.

5 changes: 4 additions & 1 deletion baybe/telemetry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""Telemetry functionality for BayBE."""
"""Telemetry functionality for BayBE.
For more details, see https://emdgroup.github.io/baybe/userguide/envvars.html#telemetry
"""

import getpass
import hashlib
Expand Down
2 changes: 1 addition & 1 deletion docs/templates/custom-module-template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
:template: custom-module-template.rst
:recursive:
{% for item in modules %}
{% if not item in ("baybe.deprecation", "baybe.surrogate", "baybe.strategies.deprecation", "baybe.targets.deprecation", "baybe.objectives.deprecation") %}
{% if not item in ("baybe.deprecation", "baybe.strategies.deprecation", "baybe.objectives.deprecation") %}
{{ item }}
{%- endif %}
{%- endfor %}
Expand Down
2 changes: 1 addition & 1 deletion docs/userguide/campaigns.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe the underlying optimization problem at hand:

| Campaign Specification | BayBE Class |
|:-------------------------------------------|:------------------------------------------------------------------------------------------|
| What should be optimized in the campaign? | `Objective` ([class](baybe.objectives.base.Objective) / [user guide](./objective)) |
| What should be optimized in the campaign? | `Objective` ([class](baybe.objectives.base.Objective) / [user guide](./objectives)) |
| Which experimental factors can be altered? | `SearchSpace` ([class](baybe.searchspace.core.SearchSpace) / [user guide](./searchspace)) |

Apart from this basic configuration, it is possible to further define the specific
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/userguide/targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ experiment and the machine learning core behind BayBE.
In general, it is expected that you create one [`Target`](baybe.targets.base.Target)
object for each of your observables.
The way BayBE treats multiple targets is then controlled via the
[`Objective`](../../userguide/objective).
[`Objective`](../../userguide/objectives).

## NumericalTarget
Besides the `name`, a [`NumericalTarget`](baybe.targets.numerical.NumericalTarget)
Expand Down
2 changes: 1 addition & 1 deletion docs/userguide/userguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Campaigns <campaigns>
Constraints <constraints>
Environment Vars <envvars>
Objective <objective>
Objectives <objectives>
Parameters <parameters>
Recommenders <recommenders>
Search Spaces <searchspace>
Expand Down
2 changes: 1 addition & 1 deletion examples/Multi_Target/Multi_Target_Header.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Multi Target

These examples demonstrate BayBE's
{doc}`Multi-Target Capabilities </userguide/objective>`.
{doc}`Multi-Target Capabilities </userguide/objectives>`.
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exclude = (?x)(
| baybe/deprecation.py
| baybe/exceptions.py
| baybe/scaler.py
| baybe/surrogate.py
| baybe/simulation.py
)

[mypy-gpytorch.*]
Expand Down
24 changes: 1 addition & 23 deletions tests/test_deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest

from baybe import BayBE, Campaign
from baybe import Campaign
from baybe.acquisition.base import AcquisitionFunction
from baybe.exceptions import DeprecationError
from baybe.objective import Objective as OldObjective
Expand All @@ -17,37 +17,16 @@
FPSRecommender,
RandomRecommender,
)
from baybe.searchspace import SearchSpace
from baybe.strategies import (
SequentialStrategy,
Strategy,
StreamingSequentialStrategy,
TwoPhaseStrategy,
)
from baybe.targets import Objective as ObjectiveFromTargets
from baybe.targets.base import Target
from baybe.targets.numerical import NumericalTarget
from baybe.utils.interval import Interval


def test_deprecated_baybe_class(parameters, objective):
"""Using the deprecated ``BayBE`` class raises a warning."""
with pytest.warns(DeprecationWarning):
BayBE(SearchSpace.from_product(parameters), objective)


def test_moved_objective(targets):
"""Importing ``Objective`` from ``baybe.targets`` raises a warning."""
with pytest.warns(DeprecationWarning):
ObjectiveFromTargets(mode="SINGLE", targets=targets)


def test_renamed_surrogate():
"""Importing from ``baybe.surrogate`` raises a warning."""
with pytest.warns(DeprecationWarning):
from baybe.surrogate import GaussianProcessSurrogate # noqa: F401


def test_missing_recommender_type(config):
"""Specifying a recommender without a corresponding type raises a warning."""
dict_ = json.loads(config)
Expand All @@ -65,7 +44,6 @@ def test_missing_recommender_type(config):
@pytest.mark.parametrize(
"test_objects",
[
(Strategy, {}),
(TwoPhaseStrategy, {}),
(SequentialStrategy, {"recommenders": RECOMMENDERS}),
(StreamingSequentialStrategy, {"recommenders": RECOMMENDERS}),
Expand Down

0 comments on commit 3a67df4

Please sign in to comment.