Skip to content

Commit

Permalink
Make toggle_discrete_candidates always return a copy
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianSosic committed Nov 19, 2024
1 parent 75782d9 commit 66bc0ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions baybe/campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ def toggle_discrete_candidates( # noqa: DOC501
Useful for setting up the correct filtering mechanism.
Returns:
The discrete candidate set passing through the specified filter.
A new dataframe containing the discrete candidate set passing through the
specified filter.
"""
raise NotImplementedError(
f"Candidate toggling is not implemented for constraint specifications of "
Expand All @@ -334,7 +335,7 @@ def _(
idx = constraint.get_valid(df)

# Determine the candidate subset to be toggled
points = df.drop(index=idx) if anti else df.loc[idx]
points = df.drop(index=idx) if anti else df.loc[idx].copy()

if not dry_run:
self._searchspace_metadata.loc[points.index, _EXCLUDED] = exclude
Expand Down

0 comments on commit 66bc0ca

Please sign in to comment.