diff --git a/CHANGELOG.md b/CHANGELOG.md index 03dba78b6..8e6afe394 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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 diff --git a/README.md b/README.md index cc030d9ee..b7dc1dbb1 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/baybe/__init__.py b/baybe/__init__.py index 205464068..890d48408 100644 --- a/baybe/__init__.py +++ b/baybe/__init__.py @@ -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") @@ -52,7 +51,6 @@ def infer_version() -> str: # pragma: no cover __version__ = infer_version() __all__ = [ "__version__", - "BayBE", "Campaign", ] diff --git a/baybe/deprecation.py b/baybe/deprecation.py index 18a0f2889..e8cd190cf 100644 --- a/baybe/deprecation.py +++ b/baybe/deprecation.py @@ -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.""" diff --git a/baybe/strategies/__init__.py b/baybe/strategies/__init__.py index 6c4fd708c..418316928 100644 --- a/baybe/strategies/__init__.py +++ b/baybe/strategies/__init__.py @@ -2,7 +2,6 @@ from baybe.strategies.deprecation import ( SequentialStrategy, - Strategy, StreamingSequentialStrategy, TwoPhaseStrategy, ) @@ -11,5 +10,4 @@ "SequentialStrategy", "StreamingSequentialStrategy", "TwoPhaseStrategy", - "Strategy", ] diff --git a/baybe/strategies/deprecation.py b/baybe/strategies/deprecation.py index e4543930d..f41a3e618 100644 --- a/baybe/strategies/deprecation.py +++ b/baybe/strategies/deprecation.py @@ -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( diff --git a/baybe/surrogate.py b/baybe/surrogate.py deleted file mode 100644 index 6cf433683..000000000 --- a/baybe/surrogate.py +++ /dev/null @@ -1,11 +0,0 @@ -"""A temporary namespace alias for backward compatibility.""" - -import warnings - -warnings.warn( - "The use of `baybe.surrogate` is deprecated and will be disabled in " - "a future version. Use `baybe.surrogates` instead.", - DeprecationWarning, -) - -from baybe.surrogates import * # noqa: F401, E402, F403 diff --git a/baybe/targets/__init__.py b/baybe/targets/__init__.py index adcf66b02..11e8a3ba2 100644 --- a/baybe/targets/__init__.py +++ b/baybe/targets/__init__.py @@ -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", ] diff --git a/baybe/targets/deprecation.py b/baybe/targets/deprecation.py deleted file mode 100644 index 7b7c8e3bc..000000000 --- a/baybe/targets/deprecation.py +++ /dev/null @@ -1,22 +0,0 @@ -"""Temporary name aliases for backward compatibility.""" - -from __future__ import annotations - -import warnings -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from baybe.objectives.base import Objective as NewObjective - - -def Objective(*args, **kwargs) -> NewObjective: - """An ``Objective`` alias for backward compatibility.""" # noqa: D401 (imperative mood) - from baybe.objective import Objective as OldObjective - - warnings.warn( - "The use of `baybe.targets.Objective` is deprecated and will be disabled in " - "a future version. Use `baybe.objective.Objective` instead.", - DeprecationWarning, - ) - - return OldObjective(*args, **kwargs) diff --git a/baybe/telemetry.py b/baybe/telemetry.py index a89700b72..bc76451e7 100644 --- a/baybe/telemetry.py +++ b/baybe/telemetry.py @@ -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 diff --git a/docs/templates/custom-module-template.rst b/docs/templates/custom-module-template.rst index 828aa03b2..e96fe76cc 100644 --- a/docs/templates/custom-module-template.rst +++ b/docs/templates/custom-module-template.rst @@ -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 %} diff --git a/docs/userguide/campaigns.md b/docs/userguide/campaigns.md index ff18827e2..64d07d882 100644 --- a/docs/userguide/campaigns.md +++ b/docs/userguide/campaigns.md @@ -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 diff --git a/docs/userguide/objective.md b/docs/userguide/objectives.md similarity index 100% rename from docs/userguide/objective.md rename to docs/userguide/objectives.md diff --git a/docs/userguide/targets.md b/docs/userguide/targets.md index 74c2960b0..99f8bab89 100644 --- a/docs/userguide/targets.md +++ b/docs/userguide/targets.md @@ -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) diff --git a/docs/userguide/userguide.md b/docs/userguide/userguide.md index 64acb8951..772e84ffa 100644 --- a/docs/userguide/userguide.md +++ b/docs/userguide/userguide.md @@ -4,7 +4,7 @@ Campaigns Constraints Environment Vars -Objective +Objectives Parameters Recommenders Search Spaces diff --git a/examples/Multi_Target/Multi_Target_Header.md b/examples/Multi_Target/Multi_Target_Header.md index fb87f4a87..48e9287e3 100644 --- a/examples/Multi_Target/Multi_Target_Header.md +++ b/examples/Multi_Target/Multi_Target_Header.md @@ -1,4 +1,4 @@ # Multi Target These examples demonstrate BayBE's -{doc}`Multi-Target Capabilities `. \ No newline at end of file +{doc}`Multi-Target Capabilities `. \ No newline at end of file diff --git a/mypy.ini b/mypy.ini index c590a616d..50c1fd952 100644 --- a/mypy.ini +++ b/mypy.ini @@ -11,7 +11,7 @@ exclude = (?x)( | baybe/deprecation.py | baybe/exceptions.py | baybe/scaler.py - | baybe/surrogate.py + | baybe/simulation.py ) [mypy-gpytorch.*] diff --git a/tests/test_deprecations.py b/tests/test_deprecations.py index 74f89f3b1..f2595b534 100644 --- a/tests/test_deprecations.py +++ b/tests/test_deprecations.py @@ -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 @@ -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) @@ -65,7 +44,6 @@ def test_missing_recommender_type(config): @pytest.mark.parametrize( "test_objects", [ - (Strategy, {}), (TwoPhaseStrategy, {}), (SequentialStrategy, {"recommenders": RECOMMENDERS}), (StreamingSequentialStrategy, {"recommenders": RECOMMENDERS}),