package sklearn
Module Metrics.ConfusionMatrixDisplaySource
Confusion Matrix visualization.
It is recommend to use :func:`~sklearn.metrics.plot_confusion_matrix` to create a :class:`ConfusionMatrixDisplay`. All parameters are stored as attributes.
Read more in the :ref:`User Guide <visualizations>`.
Parameters ---------- confusion_matrix : ndarray of shape (n_classes, n_classes) Confusion matrix.
display_labels : ndarray of shape (n_classes,) Display labels for plot.
Attributes ---------- im_ : matplotlib AxesImage Image representing the confusion matrix.
text_ : ndarray of shape (n_classes, n_classes), dtype=matplotlib Text, or None Array of matplotlib axes. `None` if `include_values` is false.
ax_ : matplotlib Axes Axes with confusion matrix.
figure_ : matplotlib Figure Figure containing the confusion matrix.
val plot :
?include_values:bool ->
?cmap:[ `S of string | `Matplotlib_Colormap of Py.Object.t ] ->
?xticks_rotation:[ `Vertical | `Horizontal | `F of float ] ->
?values_format:string ->
?ax:Py.Object.t ->
t ->
Py.Object.tPlot visualization.
Parameters ---------- include_values : bool, default=True Includes values in confusion matrix.
cmap : str or matplotlib Colormap, default='viridis' Colormap recognized by matplotlib.
xticks_rotation : 'vertical', 'horizontal' or float, default='horizontal' Rotation of xtick labels.
values_format : str, default=None Format specification for values in confusion matrix. If `None`, the format specification is '.2g'.
ax : matplotlib axes, default=None Axes object to plot on. If `None`, a new figure and axes is created.
Returns ------- display : :class:`~sklearn.metrics.ConfusionMatrixDisplay`
Attribute im_: get value or raise Not_found if None.
Attribute im_: get value as an option.
Attribute text_: get value or raise Not_found if None.
Attribute text_: get value as an option.
Attribute ax_: get value or raise Not_found if None.
Attribute ax_: get value as an option.
Attribute figure_: get value or raise Not_found if None.
Attribute figure_: get value as an option.
Pretty-print the object to a formatter.