DocumentationClassesPredictionErrorDisplay

Class: PredictionErrorDisplay

Visualization of the prediction error of a regression model.

This tool can display “residuals vs predicted” or “actual vs predicted” using scatter plots to qualitatively assess the behavior of a regressor, preferably on held-out data points.

See the details in the docstrings of from_estimator or from_predictions to create a visualizer. All parameters are stored as attributes.

For general information regarding scikit-learn visualization tools, read more in the Visualization Guide. For details regarding interpreting these plots, refer to the Model Evaluation Guide.

Python Reference

Constructors

new PredictionErrorDisplay()

new PredictionErrorDisplay(opts?): PredictionErrorDisplay

Parameters

ParameterTypeDescription
opts?object-
opts.y_pred?ArrayLikePrediction values.
opts.y_true?ArrayLikeTrue values.

Returns PredictionErrorDisplay

Defined in generated/metrics/PredictionErrorDisplay.ts:27

Properties

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

Accessors

ax_

Get Signature

get ax_(): Promise<any>

Axes with the different matplotlib axis.

Returns Promise<any>

Defined in generated/metrics/PredictionErrorDisplay.ts:408


errors_lines_

Get Signature

get errors_lines_(): Promise<any>

Residual lines. If with_errors=False, then it is set to undefined.

Returns Promise<any>

Defined in generated/metrics/PredictionErrorDisplay.ts:354


figure_

Get Signature

get figure_(): Promise<any>

Figure containing the scatter and lines.

Returns Promise<any>

Defined in generated/metrics/PredictionErrorDisplay.ts:435


line_

Get Signature

get line_(): Promise<any>

Optimal line representing y_true \== y_pred. Therefore, it is a diagonal line for kind="predictions" and a horizontal line for kind="residuals".

Returns Promise<any>

Defined in generated/metrics/PredictionErrorDisplay.ts:327


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/metrics/PredictionErrorDisplay.ts:42


scatter_

Get Signature

get scatter_(): Promise<any>

Scatter data points.

Returns Promise<any>

Defined in generated/metrics/PredictionErrorDisplay.ts:381

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/PredictionErrorDisplay.ts:98


from_estimator()

from_estimator(opts): Promise<any>

Plot the prediction error given a regressor and some data.

For general information regarding scikit-learn visualization tools, read more in the Visualization Guide. For details regarding interpreting these plots, refer to the Model Evaluation Guide.

Parameters

ParameterTypeDescription
optsobject-
opts.ax?anyAxes object to plot on. If undefined, a new figure and axes is created.
opts.estimator?anyFitted regressor or a fitted Pipeline in which the last estimator is a regressor.
opts.kind?"actual_vs_predicted" | "residual_vs_predicted"The type of plot to draw:
opts.line_kwargs?anyDictionary with keyword passed to the matplotlib.pyplot.plot call to draw the optimal line.
opts.random_state?numberControls the randomness when subsample is not undefined. See Glossary for details.
opts.scatter_kwargs?anyDictionary with keywords passed to the matplotlib.pyplot.scatter call.
opts.subsample?numberSampling the samples to be shown on the scatter plot. If float, it should be between 0 and 1 and represents the proportion of the original dataset. If int, it represents the number of samples display on the scatter plot. If undefined, no subsampling will be applied. by default, 1000 samples or less will be displayed.
opts.X?ArrayLikeInput values.
opts.y?ArrayLikeTarget values.

Returns Promise<any>

Defined in generated/metrics/PredictionErrorDisplay.ts:117


from_predictions()

from_predictions(opts): Promise<any>

Plot the prediction error given the true and predicted targets.

For general information regarding scikit-learn visualization tools, read more in the Visualization Guide. For details regarding interpreting these plots, refer to the Model Evaluation Guide.

Parameters

ParameterTypeDescription
optsobject-
opts.ax?anyAxes object to plot on. If undefined, a new figure and axes is created.
opts.kind?"actual_vs_predicted" | "residual_vs_predicted"The type of plot to draw:
opts.line_kwargs?anyDictionary with keyword passed to the matplotlib.pyplot.plot call to draw the optimal line.
opts.random_state?numberControls the randomness when subsample is not undefined. See Glossary for details.
opts.scatter_kwargs?anyDictionary with keywords passed to the matplotlib.pyplot.scatter call.
opts.subsample?numberSampling the samples to be shown on the scatter plot. If float, it should be between 0 and 1 and represents the proportion of the original dataset. If int, it represents the number of samples display on the scatter plot. If undefined, no subsampling will be applied. by default, 1000 samples or less will be displayed.
opts.y_pred?ArrayLikePredicted target values.
opts.y_true?ArrayLikeTrue target values.

Returns Promise<any>

Defined in generated/metrics/PredictionErrorDisplay.ts:199


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/metrics/PredictionErrorDisplay.ts:55


plot()

plot(opts): Promise<any>

Plot visualization.

Extra keyword arguments will be passed to matplotlib’s plot.

Parameters

ParameterTypeDescription
optsobject-
opts.ax?anyAxes object to plot on. If undefined, a new figure and axes is created.
opts.kind?"actual_vs_predicted" | "residual_vs_predicted"The type of plot to draw:
opts.line_kwargs?anyDictionary with keyword passed to the matplotlib.pyplot.plot call to draw the optimal line.
opts.scatter_kwargs?anyDictionary with keywords passed to the matplotlib.pyplot.scatter call.

Returns Promise<any>

Defined in generated/metrics/PredictionErrorDisplay.ts:276