validate_labels#
- scikitplot.api._utils.validate_labels(known_classes, passed_labels, argument_name)[source]#
- Validates the labels passed into arguments such as - true_labelsor- pred_labelsin functions like- plot_confusion_matrix.- This function checks for any duplicate labels and ensures that all passed labels are within the set of known classes. It raises a - ValueErrorif any issues are found.- Parameters:
- known_classesarray-like
- The set of classes that are known to appear in the data. 
- passed_labelsarray-like
- The labels that were passed in through the argument to be validated. 
- argument_namestr
- The name of the argument being validated. Used for error messages. 
 
- Raises:
- ValueError
- If there are duplicate labels in - passed_labelsor if any labels in- passed_labelsare not found in- known_classes.
 
 - Examples - >>> known_classes = ['A', 'B', 'C'] >>> passed_labels = ['A', 'B'] >>> import scikitplot as sp >>> sp.api._utils.validate_labels(known_classes, passed_labels, 'true_labels') 
