Skip to content

Latest commit

 

History

History
297 lines (180 loc) · 11.1 KB

CalibrationDisplay.md

File metadata and controls

297 lines (180 loc) · 11.1 KB

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

Constructors

constructor()

Signature

new CalibrationDisplay(opts?: object): CalibrationDisplay;

Parameters

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

Returns

CalibrationDisplay

Defined in: generated/calibration/CalibrationDisplay.ts:25

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

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.

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

Name Type Description
opts object -
opts.X? ArrayLike Input values.
opts.ax? any Axes object to plot on. If undefined, a new figure and axes is created.
opts.estimator? any Fitted classifier or a fitted Pipeline in which the last estimator is a classifier. The classifier must have a predict_proba method.
opts.kwargs? any Keyword arguments to be passed to matplotlib.pyplot.plot.
opts.n_bins? number Number 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? string Name for labeling curve. If undefined, the name of the estimator is used.
opts.pos_label? string | number | boolean The positive class when computing the calibration curve. By default, estimators.classes\_\[1\] is considered as the positive class.
opts.ref_line? boolean If 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? ArrayLike Binary target values.

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:145

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.

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

Name Type Description
opts object -
opts.ax? any Axes object to plot on. If undefined, a new figure and axes is created.
opts.kwargs? any Keyword arguments to be passed to matplotlib.pyplot.plot.
opts.n_bins? number Number 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? string Name for labeling curve.
opts.pos_label? string | number | boolean The positive class when computing the calibration curve. By default, estimators.classes\_\[1\] is considered as the positive class.
opts.ref_line? boolean If 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? ArrayLike The predicted probabilities of the positive class.
opts.y_true? ArrayLike True labels.

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:249

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

Name Type
py PythonBridge

Returns

Promise<void>

Defined in: generated/calibration/CalibrationDisplay.ts:68

plot()

Plot visualization.

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

Signature

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

Parameters

Name Type Description
opts object -
opts.ax? any Axes object to plot on. If undefined, a new figure and axes is created.
opts.kwargs? any Keyword arguments to be passed to matplotlib.pyplot.plot.
opts.name? string Name for labeling curve. If undefined, use estimator\_name if not undefined, otherwise no labeling is shown.
opts.ref_line? boolean If true, plots a reference line representing a perfectly calibrated classifier. Default Value true

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:345

Properties

_isDisposed

boolean = false

Defined in: generated/calibration/CalibrationDisplay.ts:23

_isInitialized

boolean = false

Defined in: generated/calibration/CalibrationDisplay.ts:22

_py

PythonBridge

Defined in: generated/calibration/CalibrationDisplay.ts:21

id

string

Defined in: generated/calibration/CalibrationDisplay.ts:18

opts

any

Defined in: generated/calibration/CalibrationDisplay.ts:19

Accessors

ax_

Axes with calibration curve.

Signature

ax_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:426

figure_

Figure containing the curve.

Signature

figure_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:453

line_

Calibration curve.

Signature

line_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/calibration/CalibrationDisplay.ts:399

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/calibration/CalibrationDisplay.ts:55

Signature

py(pythonBridge: PythonBridge): void;

Parameters

Name Type
pythonBridge PythonBridge

Returns

void

Defined in: generated/calibration/CalibrationDisplay.ts:59