check_missing_label#

skactiveml.utils.check_missing_label(missing_label, target_type=None, name=None)[source]#

Check whether a missing label is compatible to a given target type.

Parameters:
missing_labelnumber or str or None or np.nan

Value to represent a missing label.

target_typenumpy.dtype or Type or tuple, default=None

The dtype or scalar type of the labels missing_label has to fit. If None, only missing_label itself is checked. A dtype of neither strings nor numbers, such as object, constrains no missing label. The label-mask functions then check the missing label against the values they see.

namestr, default=None

The name of the variable to which missing_label is not compatible. The name will be printed in error messages if it is not None.

Raises:
TypeError

If missing_label is no supported missing label, or is a string for numeric labels or a number for string labels.

ValueError

If missing_label is infinite.