validation#
Checks to ensure valid inputs for various methods.
Functions:
|
Ensures we can do list-based indexing into |
Ensures input is not None. |
|
|
Checks that |
|
Checks that |
Converts different types of label objects to 1D numpy array and checks their validity. |
- cleanlab.internal.validation.assert_indexing_works(X, idx=None, length_X=None)[source]#
Ensures we can do list-based indexing into
X
andy
.length_X
is an optional argument since sparse matrixX
does not support:len(X)
and we want this method to work for sparseX
(in addition to many other types ofX
).- Return type:
None
- cleanlab.internal.validation.assert_nonempty_input(X)[source]#
Ensures input is not None.
- Return type:
None
- cleanlab.internal.validation.assert_valid_class_labels(y, allow_missing_classes=True, allow_one_class=False)[source]#
Checks that
labels
is properly formatted, i.e. a 1D numpy array where labels are zero-based integers (not multi-label).- Return type:
None
- cleanlab.internal.validation.assert_valid_inputs(X, y, pred_probs=None, multi_label=False, allow_missing_classes=True, allow_one_class=False)[source]#
Checks that
X
,labels
,pred_probs
are correctly formatted.- Return type:
None
- cleanlab.internal.validation.labels_to_array(y)[source]#
Converts different types of label objects to 1D numpy array and checks their validity.
- Parameters:
y (
Union[LabelLike
,np.generic]
) – Labels to convert to 1D numpy array. Can be a list, numpy array, pandas Series, or pandas DataFrame.- Return type:
ndarray
- Returns:
labels_array (
np.ndarray
) – 1D numpy array of labels.