Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions optuna/study/_tell.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,18 @@ def _check_state_and_values(


def _check_values_are_feasible(study: Study, values: Sequence[float]) -> str | None:
float_cast = float
isnan = math.isnan

for v in values:
# TODO(Imamura): Construct error message taking into account all values and do not early
# return `value` is assumed to be ignored on failure so we can set it to any value.
try:
float(v)
float_cast(v)
except (ValueError, TypeError):
return f"The value {repr(v)} could not be cast to float"

if math.isnan(v):
if isnan(v):
return f"The value {v} is not acceptable"

if len(study.directions) != len(values):
Expand Down