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.
Constructors
new CalibrationDisplay()
new CalibrationDisplay(
opts
?):CalibrationDisplay
Parameters
Parameter | 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, pos_label is set to estimators.classes_\[1\] when using from_estimator and set to 1 when using from_predictions . |
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:27
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/calibration/CalibrationDisplay.ts:25 |
_isInitialized | boolean | false | generated/calibration/CalibrationDisplay.ts:24 |
_py | PythonBridge | undefined | generated/calibration/CalibrationDisplay.ts:23 |
id | string | undefined | generated/calibration/CalibrationDisplay.ts:20 |
opts | any | undefined | generated/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
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
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. |
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. |
opts.strategy ? | "uniform" | "quantile" | Strategy used to define the widths of the bins. |
opts.X ? | ArrayLike | Input values. |
opts.y ? | ArrayLike | Binary 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
Parameter | 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. |
opts.name ? | string | Name for labeling curve. |
opts.pos_label ? | string | number | boolean | The positive class when computing the calibration curve. By default pos_label is set to 1. |
opts.ref_line ? | boolean | If 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 ? | ArrayLike | The predicted probabilities of the positive class. |
opts.y_true ? | ArrayLike | True 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
Parameter | Type |
---|---|
py | PythonBridge |
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
Parameter | 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. |
Returns Promise
<any
>