npu.plot.classification_plot_utils
Classes
- class npu.plot.classification_plot_utils.ClassificationPlotUtils
- Author:
Alberto M. Esmoris Pena
Util functions to handle classification plots.
- static do_confusion_matrix_plot(cmat, class_names, ignore_classes=None, cmat_format=None, normalization_strategy=None, title=None)
Handle the plot of the confusion matrix on the given figure and axes.
See below an example of format specification dictionary for the confusion matrix (i.e., cmat_format):
{ "cmap": "Greens", "values_format": ".3f", "fontsize": 10, "fontweight": "bold", "fontcolor": "black", "stroke_width": 2, "stroke_foreground": "white", "colorbar_labelsize": 11, "tick_labelsize": 11, "tick_length": 3.0, "tick_width": 1.0, "xlabel_rotation": 70, "xlabel_size": 11, "ylabel_rotation": 20, "ylabel_size": 11, "border_size": 2 }
- Parameters:
cmat (
np.ndarray) – The confusion matrix to be plotted.title (str or None) – Optional title to be assigned to the axes where the confusion matrix is represented.
- Variables:
class_names (list) – The name for each class.
ignore_classes (list of str) – The list of classes that must be ignored when computing the evaluations. In other words, those samples that are labeled (not predicted) as one of the ignored classes will not be considered when calculating the evaluation metrics.
cmat_format (dict or None) – The key-word arguments governing the format of the confusion matrix.
normalization_strategy (str or None) – The type of normalization strategy to be applied to the confusion matrix when plotting it. Either None or a string from
["row", "col", "full"].
- static do_class_distributions_subplots(yhat_count, y_count, class_names, pred_title='Predictions', ref_title='Reference')
Handle two bar subplots, one for the distribution of predictions on the different classes, the other for the distribution of the references.
- Variables:
yhat_count (
np.ndarray) – The count of cases per predicted entity label, including the -1 label to represent missing entities.y_count (
np.ndarray) – The count of cases per reference entity label, including the -1 label to represent non-correspondent predictions.class_names (list) – The name for each class.
- Parameters:
pred_title (str) – The title for the predictions-based subplot.
ref_title (str) – The title for the reference-based subplot.