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.
Constructors
new PredictionErrorDisplay()
new PredictionErrorDisplay(
opts?):PredictionErrorDisplay
Parameters
| Parameter | Type | Description |
|---|---|---|
opts? | object | - |
opts.y_pred? | ArrayLike | Prediction values. |
opts.y_true? | ArrayLike | True values. |
Returns PredictionErrorDisplay
Defined in generated/metrics/PredictionErrorDisplay.ts:27
Properties
| Property | Type | Default value | Defined in |
|---|---|---|---|
_isDisposed | boolean | false | generated/metrics/PredictionErrorDisplay.ts:25 |
_isInitialized | boolean | false | generated/metrics/PredictionErrorDisplay.ts:24 |
_py | PythonBridge | undefined | generated/metrics/PredictionErrorDisplay.ts:23 |
id | string | undefined | generated/metrics/PredictionErrorDisplay.ts:20 |
opts | any | undefined | generated/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
| Parameter | Type |
|---|---|
pythonBridge | PythonBridge |
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
| 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 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? | any | Dictionary with keyword passed to the matplotlib.pyplot.plot call to draw the optimal line. |
opts.random_state? | number | Controls the randomness when subsample is not undefined. See Glossary for details. |
opts.scatter_kwargs? | any | Dictionary with keywords passed to the matplotlib.pyplot.scatter call. |
opts.subsample? | number | Sampling 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? | ArrayLike | Input values. |
opts.y? | ArrayLike | Target 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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.ax? | any | Axes 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? | any | Dictionary with keyword passed to the matplotlib.pyplot.plot call to draw the optimal line. |
opts.random_state? | number | Controls the randomness when subsample is not undefined. See Glossary for details. |
opts.scatter_kwargs? | any | Dictionary with keywords passed to the matplotlib.pyplot.scatter call. |
opts.subsample? | number | Sampling 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? | ArrayLike | Predicted target values. |
opts.y_true? | ArrayLike | True 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
| Parameter | Type |
|---|---|
py | PythonBridge |
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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.ax? | any | Axes 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? | any | Dictionary with keyword passed to the matplotlib.pyplot.plot call to draw the optimal line. |
opts.scatter_kwargs? | any | Dictionary with keywords passed to the matplotlib.pyplot.scatter call. |
Returns Promise<any>