From 07f344a3e509286678fe0e53e4004adc9fa94306 Mon Sep 17 00:00:00 2001 From: Martin Fitzner Date: Mon, 15 Jul 2024 11:00:38 +0200 Subject: [PATCH 1/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30a45fb99..aa35ced9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Interval` class now supports degenerate intervals containing only one element - `add_fake_results` now directly processes `Target` objects instead of a `Campaign` - `path` argument in plotting utility is now optional and defaults to `Path(".")` +- `UnusedObjectWarning` by non-predictive recommenders is now ignored during simulations ### Removed - Support for Python 3.9 removed due to new [BoTorch requirements](https://github.com/pytorch/botorch/pull/2293) From 9bbe6cf55ddaf57861c590c64993a33eedff5d4d Mon Sep 17 00:00:00 2001 From: Martin Fitzner Date: Mon, 15 Jul 2024 11:00:30 +0200 Subject: [PATCH 2/2] Ignore warning --- baybe/simulation/scenarios.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/baybe/simulation/scenarios.py b/baybe/simulation/scenarios.py index 63daf83a3..5e03f6783 100644 --- a/baybe/simulation/scenarios.py +++ b/baybe/simulation/scenarios.py @@ -2,6 +2,7 @@ from __future__ import annotations +import warnings from collections.abc import Callable from copy import deepcopy from dataclasses import dataclass @@ -11,7 +12,7 @@ import pandas as pd from baybe.campaign import Campaign -from baybe.exceptions import NothingToSimulateError +from baybe.exceptions import NothingToSimulateError, UnusedObjectWarning from baybe.simulation.core import simulate_experiment if TYPE_CHECKING: @@ -136,7 +137,15 @@ def unpack_simulation_results(array: DataArray) -> pd.DataFrame: # Simulate and unpack result_variable = "simulation_result" batch_simulator = make_xyzpy_callable(result_variable) - da_results = batch_simulator.run_combos(combos)[result_variable] + + with warnings.catch_warnings(): + warnings.filterwarnings( + "ignore", + category=UnusedObjectWarning, + module="baybe.recommenders.pure.nonpredictive.base", + ) + da_results = batch_simulator.run_combos(combos)[result_variable] + df_results = unpack_simulation_results(da_results) return df_results