package sklearn

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `ConfusionMatrixDisplay
]
type t = [ `ConfusionMatrixDisplay | `Object ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val create : ?display_labels:[> `ArrayLike ] Np.Obj.t -> confusion_matrix:[> `ArrayLike ] Np.Obj.t -> unit -> t

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,), default=None Display labels for plot. If None, display labels are set from 0 to `n_classes - 1`.

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:[ `F of float | `Vertical | `Horizontal ] -> ?values_format:string -> ?ax:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

Plot 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 'd' or '.2g' whichever is shorter.

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`

val im_ : t -> Py.Object.t

Attribute im_: get value or raise Not_found if None.

val im_opt : t -> Py.Object.t option

Attribute im_: get value as an option.

val text_ : t -> Py.Object.t

Attribute text_: get value or raise Not_found if None.

val text_opt : t -> Py.Object.t option

Attribute text_: get value as an option.

val ax_ : t -> Py.Object.t

Attribute ax_: get value or raise Not_found if None.

val ax_opt : t -> Py.Object.t option

Attribute ax_: get value as an option.

val figure_ : t -> Py.Object.t

Attribute figure_: get value or raise Not_found if None.

val figure_opt : t -> Py.Object.t option

Attribute figure_: get value as an option.

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Stdlib.Format.formatter -> t -> unit

Pretty-print the object to a formatter.