validation#
Checks to ensure valid inputs for various methods.
Functions:
| 
 | Checks that  | 
| 
 | Checks that  | 
| Ensures input is not None. | |
| 
 | Ensures we can do list-based indexing into  | 
| Converts different types of label objects to 1D numpy array and checks their validity. | 
- 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_probsare correctly formatted.- Return type:
- None
 
- cleanlab.internal.validation.assert_valid_class_labels(y, allow_missing_classes=True, allow_one_class=False)[source]#
- Checks that - labelsis properly formatted, i.e. a 1D numpy array where labels are zero-based integers (not multi-label).- Return type:
- None
 
- cleanlab.internal.validation.assert_nonempty_input(X)[source]#
- Ensures input is not None. - Return type:
- None
 
- cleanlab.internal.validation.assert_indexing_works(X, idx=None, length_X=None)[source]#
- Ensures we can do list-based indexing into - Xand- y.- length_Xis an optional argument since sparse matrix- Xdoes not support:- len(X)and we want this method to work for sparse- X(in addition to many other types of- X).- 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.