Class: ConfusionMatrixDisplay
Confusion Matrix visualization.
It is recommend to use from_estimator
or from_predictions
to create a ConfusionMatrixDisplay
. All parameters are stored as attributes.
Read more in the User Guide.
Constructors
new ConfusionMatrixDisplay()
new ConfusionMatrixDisplay(
opts
?):ConfusionMatrixDisplay
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.confusion_matrix ? | ArrayLike [] | Confusion matrix. |
opts.display_labels ? | ArrayLike | Display labels for plot. If undefined , display labels are set from 0 to n_classes \- 1 . |
Returns ConfusionMatrixDisplay
Defined in generated/metrics/ConfusionMatrixDisplay.ts:25
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/metrics/ConfusionMatrixDisplay.ts:23 |
_isInitialized | boolean | false | generated/metrics/ConfusionMatrixDisplay.ts:22 |
_py | PythonBridge | undefined | generated/metrics/ConfusionMatrixDisplay.ts:21 |
id | string | undefined | generated/metrics/ConfusionMatrixDisplay.ts:18 |
opts | any | undefined | generated/metrics/ConfusionMatrixDisplay.ts:19 |
Accessors
ax_
Get Signature
get ax_():
Promise
<any
>
Axes with confusion matrix.
Returns Promise
<any
>
Defined in generated/metrics/ConfusionMatrixDisplay.ts:471
figure_
Get Signature
get figure_():
Promise
<any
>
Figure containing the confusion matrix.
Returns Promise
<any
>
Defined in generated/metrics/ConfusionMatrixDisplay.ts:498
im_
Get Signature
get im_():
Promise
<any
>
Image representing the confusion matrix.
Returns Promise
<any
>
Defined in generated/metrics/ConfusionMatrixDisplay.ts:417
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/metrics/ConfusionMatrixDisplay.ts:40
text_
Get Signature
get text_():
Promise
<ArrayLike
[]>
Array of matplotlib axes. undefined
if include_values
is false.
Returns Promise
<ArrayLike
[]>
Defined in generated/metrics/ConfusionMatrixDisplay.ts:444
Methods
dispose()
dispose():
Promise
<void
>
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Returns Promise
<void
>
Defined in generated/metrics/ConfusionMatrixDisplay.ts:96
from_estimator()
from_estimator(
opts
):Promise
<any
>
Plot Confusion Matrix given an estimator and some data.
Read more in the User Guide.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.ax ? | any | Axes object to plot on. If undefined , a new figure and axes is created. |
opts.cmap ? | string | Colormap recognized by matplotlib. |
opts.colorbar ? | boolean | Whether or not to add a colorbar to the plot. |
opts.display_labels ? | ArrayLike | Target names used for plotting. By default, labels will be used if it is defined, otherwise the unique labels of y_true and y_pred will be used. |
opts.estimator ? | any | Fitted classifier or a fitted Pipeline in which the last estimator is a classifier. |
opts.im_kw ? | any | Dict with keywords passed to matplotlib.pyplot.imshow call. |
opts.include_values ? | boolean | Includes values in confusion matrix. |
opts.labels ? | ArrayLike | List of labels to index the confusion matrix. This may be used to reorder or select a subset of labels. If undefined is given, those that appear at least once in y_true or y_pred are used in sorted order. |
opts.normalize ? | "all" | "true" | "pred" | Either to normalize the counts display in the matrix: |
opts.sample_weight ? | ArrayLike | Sample weights. |
opts.text_kw ? | any | Dict with keywords passed to matplotlib.pyplot.text call. |
opts.values_format ? | string | Format specification for values in confusion matrix. If undefined , the format specification is ‘d’ or ‘.2g’ whichever is shorter. |
opts.X ? | ArrayLike | Input values. |
opts.xticks_rotation ? | number | "vertical" | "horizontal" | Rotation of xtick labels. |
opts.y ? | ArrayLike | Target values. |
Returns Promise
<any
>
Defined in generated/metrics/ConfusionMatrixDisplay.ts:115
from_predictions()
from_predictions(
opts
):Promise
<any
>
Plot Confusion Matrix given true and predicted labels.
Read more in the User Guide.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.ax ? | any | Axes object to plot on. If undefined , a new figure and axes is created. |
opts.cmap ? | string | Colormap recognized by matplotlib. |
opts.colorbar ? | boolean | Whether or not to add a colorbar to the plot. |
opts.display_labels ? | ArrayLike | Target names used for plotting. By default, labels will be used if it is defined, otherwise the unique labels of y_true and y_pred will be used. |
opts.im_kw ? | any | Dict with keywords passed to matplotlib.pyplot.imshow call. |
opts.include_values ? | boolean | Includes values in confusion matrix. |
opts.labels ? | ArrayLike | List of labels to index the confusion matrix. This may be used to reorder or select a subset of labels. If undefined is given, those that appear at least once in y_true or y_pred are used in sorted order. |
opts.normalize ? | "all" | "true" | "pred" | Either to normalize the counts display in the matrix: |
opts.sample_weight ? | ArrayLike | Sample weights. |
opts.text_kw ? | any | Dict with keywords passed to matplotlib.pyplot.text call. |
opts.values_format ? | string | Format specification for values in confusion matrix. If undefined , the format specification is ‘d’ or ‘.2g’ whichever is shorter. |
opts.xticks_rotation ? | number | "vertical" | "horizontal" | Rotation of xtick labels. |
opts.y_pred ? | ArrayLike | The predicted labels given by the method predict of an classifier. |
opts.y_true ? | ArrayLike | True labels. |
Returns Promise
<any
>
Defined in generated/metrics/ConfusionMatrixDisplay.ts:231
init()
init(
py
):Promise
<void
>
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Parameters
Parameter | Type |
---|---|
py | PythonBridge |
Returns Promise
<void
>
Defined in generated/metrics/ConfusionMatrixDisplay.ts:53
plot()
plot(
opts
):Promise
<any
>
Plot visualization.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.ax ? | any | Axes object to plot on. If undefined , a new figure and axes is created. |
opts.cmap ? | string | Colormap recognized by matplotlib. |
opts.colorbar ? | boolean | Whether or not to add a colorbar to the plot. |
opts.im_kw ? | any | Dict with keywords passed to matplotlib.pyplot.imshow call. |
opts.include_values ? | boolean | Includes values in confusion matrix. |
opts.text_kw ? | any | Dict with keywords passed to matplotlib.pyplot.text call. |
opts.values_format ? | string | Format specification for values in confusion matrix. If undefined , the format specification is ‘d’ or ‘.2g’ whichever is shorter. |
opts.xticks_rotation ? | number | "vertical" | "horizontal" | Rotation of xtick labels. |
Returns Promise
<any
>