Documentation
Classes
CalibrationDisplay

CalibrationDisplay

Calibration curve (also known as reliability diagram) visualization.

It is recommended to use from\_estimator or from\_predictions to create a CalibrationDisplay. All parameters are stored as attributes.

Read more about calibration in the User Guide and more about the scikit-learn visualization API in Visualizations.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new CalibrationDisplay(opts?: object): CalibrationDisplay;

Parameters

NameTypeDescription
opts?object-
opts.estimator_name?stringName of estimator. If undefined, the estimator name is not shown.
opts.pos_label?string | number | booleanThe positive class when computing the calibration curve. By default, estimators.classes\_\[1\] is considered as the positive class.
opts.prob_pred?ArrayLikeThe mean predicted probability in each bin.
opts.prob_true?ArrayLikeThe proportion of samples whose class is the positive class (fraction of positives), in each bin.
opts.y_prob?ArrayLikeProbability estimates for the positive class, for each sample.

Returns

CalibrationDisplay

Defined in: generated/calibration/CalibrationDisplay.ts:25 (opens in a new tab)

Methods

dispose()

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Signature

dispose(): Promise<void>;

Returns

Promise<void>

Defined in: generated/calibration/CalibrationDisplay.ts:122 (opens in a new tab)

from_estimator()

Plot calibration curve using a binary classifier and data.

A calibration curve, also known as a reliability diagram, uses inputs from a binary classifier and plots the average predicted probability for each bin against the fraction of positive classes, on the y-axis.

Extra keyword arguments will be passed to matplotlib.pyplot.plot (opens in a new tab).

Read more about calibration in the User Guide and more about the scikit-learn visualization API in Visualizations.

Signature

from_estimator(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeInput values.
opts.ax?anyAxes object to plot on. If undefined, a new figure and axes is created.
opts.estimator?anyFitted classifier or a fitted Pipeline in which the last estimator is a classifier. The classifier must have a predict_proba method.
opts.kwargs?anyKeyword arguments to be passed to matplotlib.pyplot.plot (opens in a new tab).
opts.n_bins?numberNumber of bins to discretize the [0, 1] interval into when calculating the calibration curve. A bigger number requires more data. Default Value 5
opts.name?stringName for labeling curve. If undefined, the name of the estimator is used.
opts.pos_label?string | number | booleanThe positive class when computing the calibration curve. By default, estimators.classes\_\[1\] is considered as the positive class.
opts.ref_line?booleanIf true, plots a reference line representing a perfectly calibrated classifier. Default Value true
opts.strategy?"uniform" | "quantile"Strategy used to define the widths of the bins. Default Value 'uniform'
opts.y?ArrayLikeBinary target values.

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:145 (opens in a new tab)

from_predictions()

Plot calibration curve using true labels and predicted probabilities.

Calibration curve, also known as reliability diagram, uses inputs from a binary classifier and plots the average predicted probability for each bin against the fraction of positive classes, on the y-axis.

Extra keyword arguments will be passed to matplotlib.pyplot.plot (opens in a new tab).

Read more about calibration in the User Guide and more about the scikit-learn visualization API in Visualizations.

Signature

from_predictions(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.ax?anyAxes object to plot on. If undefined, a new figure and axes is created.
opts.kwargs?anyKeyword arguments to be passed to matplotlib.pyplot.plot (opens in a new tab).
opts.n_bins?numberNumber of bins to discretize the [0, 1] interval into when calculating the calibration curve. A bigger number requires more data. Default Value 5
opts.name?stringName for labeling curve.
opts.pos_label?string | number | booleanThe positive class when computing the calibration curve. By default, estimators.classes\_\[1\] is considered as the positive class.
opts.ref_line?booleanIf true, plots a reference line representing a perfectly calibrated classifier. Default Value true
opts.strategy?"uniform" | "quantile"Strategy used to define the widths of the bins. Default Value 'uniform'
opts.y_prob?ArrayLikeThe predicted probabilities of the positive class.
opts.y_true?ArrayLikeTrue labels.

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:249 (opens in a new tab)

init()

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Signature

init(py: PythonBridge): Promise<void>;

Parameters

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/calibration/CalibrationDisplay.ts:68 (opens in a new tab)

plot()

Plot visualization.

Extra keyword arguments will be passed to matplotlib.pyplot.plot (opens in a new tab).

Signature

plot(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.ax?anyAxes object to plot on. If undefined, a new figure and axes is created.
opts.kwargs?anyKeyword arguments to be passed to matplotlib.pyplot.plot (opens in a new tab).
opts.name?stringName for labeling curve. If undefined, use estimator\_name if not undefined, otherwise no labeling is shown.
opts.ref_line?booleanIf true, plots a reference line representing a perfectly calibrated classifier. Default Value true

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:345 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/calibration/CalibrationDisplay.ts:23 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/calibration/CalibrationDisplay.ts:22 (opens in a new tab)

_py

PythonBridge

Defined in: generated/calibration/CalibrationDisplay.ts:21 (opens in a new tab)

id

string

Defined in: generated/calibration/CalibrationDisplay.ts:18 (opens in a new tab)

opts

any

Defined in: generated/calibration/CalibrationDisplay.ts:19 (opens in a new tab)

Accessors

ax_

Axes with calibration curve.

Signature

ax_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:426 (opens in a new tab)

figure_

Figure containing the curve.

Signature

figure_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:453 (opens in a new tab)

line_

Calibration curve.

Signature

line_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:399 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/calibration/CalibrationDisplay.ts:55 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/calibration/CalibrationDisplay.ts:59 (opens in a new tab)