You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Preparation to fix#795, #796 and #798.
### Background
As part of the broader effort toward lazy, on-demand evaluation of
candidate sets (see linked issues), this PR removes the dependency on
the eagerly pre-computed, fully materialized `exp_rep` and `comp_rep`
public attributes of `SubspaceDiscrete`. The old design forced the full
candidate space to be computed and cached upfront, even when only a
subset is needed — blocking future subsampling policies and
backend-agnostic mechanisms required for handling large spaces.
The key step is giving `get_candidates` a clean, single-purpose method
signature as the sole access point for the experimental representation,
so that transformation into the computational representation happens
only when explicitly requested and only on the relevant data (the subset
selection will be enabled later).
### Out of scope
The return type of `get_candidates` is expected to be elevated to a
higher-level object in a follow-up (e.g. `TableCandidates` or a similar
abstraction). This PR deliberately keeps the return type as
`pd.DataFrame` to stay focused on the interface decoupling.
### Changes
**Make `exp_rep` private** (`baybe/searchspace/discrete.py`)
Renames the field to `_exp_rep` (with `alias="exp_rep"` for
serialization compatibility), updates the validator reference, and
replaces all internal accesses.
**Simplify `get_candidates` signature**
(`baybe/searchspace/discrete.py`)
Returns only the experimental representation (`pd.DataFrame`) instead of
a `tuple[pd.DataFrame, pd.DataFrame]`, avoiding wasteful upfront
computation of the computational representation.
**Update all internal call sites** (`baybe/campaign.py`,
`baybe/recommenders/`, `baybe/simulation/`, `baybe/searchspace/core.py`,
`baybe/acquisition/`)
Replaces tuple-unpacking calls to `get_candidates` and direct
`exp_rep`/`comp_rep` accesses with the new API throughout. Computational
representation is now computed on-demand, at the point of use.
**Update examples and tests** (`examples/`, `tests/`)
Adapts all affected examples and tests to the new `get_candidates`
return type.
**Deprecate `exp_rep` and `comp_rep` properties**
(`baybe/searchspace/discrete.py`)
Adds `DeprecationWarning` shims for `exp_rep` (pointing to
`get_candidates()`) and `comp_rep` (pointing to
`transform(get_candidates())`), with corresponding deprecation tests.
0 commit comments