10000 Include entire range in `check_scalar` error message · Issue #22691 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
Include entire range in check_scalar error message #22691
Open
@thomasjpfan

Description

@thomasjpfan

Currently docstrings description for scalar ranges uses the interval syntax:

Values must be in the range `[0.0, inf)`.

While the error message uses a different notation:

from sklearn.utils.validation import check_scalar

check_scalar(-1.0, "alpha", target_type=float, min_val=0.0)
# ValueError: alpha == -1.0, must be >= 0.0.

Should we update this notation to be consistent with the docstring? i.e:

# ValueError: alpha == -1.0, must be in the range [0.0, inf)

(I am assuming that inf is always an open boundary)

CC @glemaitre

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0