DocumentationClassesCalibrationDisplay

Class: 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.

For an example on how to use the visualization, see Probability Calibration curves.

Python Reference

Constructors

new CalibrationDisplay()

new CalibrationDisplay(opts?): CalibrationDisplay

Parameters

ParameterTypeDescription
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, pos_label is set to estimators.classes_\[1\] when using from_estimator and set to 1 when using from_predictions.
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:27

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/calibration/CalibrationDisplay.ts:25
_isInitializedbooleanfalsegenerated/calibration/CalibrationDisplay.ts:24
_pyPythonBridgeundefinedgenerated/calibration/CalibrationDisplay.ts:23
idstringundefinedgenerated/calibration/CalibrationDisplay.ts:20
optsanyundefinedgenerated/calibration/CalibrationDisplay.ts:21

Accessors

ax_

Get Signature

get ax_(): Promise<any>

Axes with calibration curve.

Returns Promise<any>

Defined in generated/calibration/CalibrationDisplay.ts:391


figure_

Get Signature

get figure_(): Promise<any>

Figure containing the curve.

Returns Promise<any>

Defined in generated/calibration/CalibrationDisplay.ts:418


line_

Get Signature

get line_(): Promise<any>

Calibration curve.

Returns Promise<any>

Defined in generated/calibration/CalibrationDisplay.ts:364


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/calibration/CalibrationDisplay.ts:57

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/calibration/CalibrationDisplay.ts:113


from_estimator()

from_estimator(opts): Promise<any>

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.

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

Parameters

ParameterTypeDescription
optsobject-
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.
opts.n_bins?numberNumber of bins to discretize the [0, 1] interval into when calculating the calibration curve. A bigger number requires more data.
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.
opts.strategy?"uniform" | "quantile"Strategy used to define the widths of the bins.
opts.X?ArrayLikeInput values.
opts.y?ArrayLikeBinary target values.

Returns Promise<any>

Defined in generated/calibration/CalibrationDisplay.ts:136


from_predictions()

from_predictions(opts): Promise<any>

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.

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

Parameters

ParameterTypeDescription
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.
opts.n_bins?numberNumber of bins to discretize the [0, 1] interval into when calculating the calibration curve. A bigger number requires more data.
opts.name?stringName for labeling curve.
opts.pos_label?string | number | booleanThe positive class when computing the calibration curve. By default pos_label is set to 1.
opts.ref_line?booleanIf true, plots a reference line representing a perfectly calibrated classifier.
opts.strategy?"uniform" | "quantile"Strategy used to define the widths of the bins.
opts.y_prob?ArrayLikeThe predicted probabilities of the positive class.
opts.y_true?ArrayLikeTrue labels.

Returns Promise<any>

Defined in generated/calibration/CalibrationDisplay.ts:229


init()

init(py): Promise<void>

Initializes the underlying Python resources.

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

Parameters

ParameterType
pyPythonBridge

Returns Promise<void>

Defined in generated/calibration/CalibrationDisplay.ts:70


plot()

plot(opts): Promise<any>

Plot visualization.

Extra keyword arguments will be passed to matplotlib.pyplot.plot.

Parameters

ParameterTypeDescription
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.
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.

Returns Promise<any>

Defined in generated/calibration/CalibrationDisplay.ts:313