skactiveml.utils.check_scalar#
- skactiveml.utils.check_scalar(x, name, target_type, min_inclusive=True, max_inclusive=True, min_val=None, max_val=None)[source]#
Validate scalar parameters type and value.
- Parameters
- xobject
The scalar parameter to validate.
- namestr
The name of the parameter to be printed in error messages.
- target_typetype or tuple
Acceptable data types for the parameter.
- min_valfloat or int, optional (default=None)
The minimum valid value the parameter can take. If None (default) it is implied that the parameter does not have a lower bound.
- min_inclusivebool, optional (default=True)
If true, the minimum valid value is inclusive, otherwise exclusive.
- max_valfloat or int, optional (default=None)
The maximum valid value the parameter can take. If None (default) it is implied that the parameter does not have an upper bound.
- max_inclusivebool, optional (default=True)
If true, the maximum valid value is inclusive, otherwise exclusive.
- Raises
- TypeError
If the parameter’s type does not match the desired type.
- ValueError
If the parameter’s value violates the given bounds.