Skip to content

Bug when batch size exceeds number of candidates #369

@AdrianSosic

Description

@AdrianSosic

When setting allow_repeated_recommendations=True it is perfectly valid to request more recommendations than there are candidates in the search space. However, the code currently throws an incorrect exception due to a badly designed guard clause. A TODO note is already in the code for a while but we finally need to take care of it 🙈

from baybe.parameters import NumericalDiscreteParameter
from baybe.recommenders import RandomRecommender

searchspace = NumericalDiscreteParameter("p", [0, 1]).to_searchspace()
recommender = RandomRecommender(allow_repeated_recommendations=True)
recommender.recommend(5, searchspace)
baybe.exceptions.NotEnoughPointsLeftError: Using the current settings, there are fewer than 5 possible data points left to recommend. This can be either because all data points have been measured at some point (while 'allow_repeated_recommendations' or 'allow_recommending_already_measured' being False) or because all data points are marked as 'dont_recommend'.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions