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
12 changes: 4 additions & 8 deletions optuna/pruners/_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@

def _check_value(value: Any) -> float:
try:
# For convenience, we allow users to report a value that can be cast to `float`.
value = float(value)
return float(value)
except (TypeError, ValueError):
message = "The `value` argument is of type '{}' but supposed to be a float.".format(
type(value).__name__
)
raise TypeError(message) from None

return value
raise TypeError(
f"The `value` argument is of type '{type(value).__name__}' but supposed to be a float."
) from None


class ThresholdPruner(BasePruner):
Expand Down