prediction_error#

ComparisonReport.metrics.prediction_error(*, data_source='test', subsample=1000, seed=None)[source]#

Plot the prediction error of a regression model.

Parameters:
data_source{“test”, “train”, “both”}, default=”test”

The data source to use.

  • “test” : use the test set provided when creating the report.

  • “train” : use the train set provided when creating the report.

  • “both” : use both the train and test sets to compute the metrics.

subsampleint, default=1_000

Maximum number of samples to show on the scatter plot.

seedint, default=None

The seed used to initialize the random number generator used for the subsampling.

Returns:
PredictionErrorDisplay

The prediction error display.

See also

PredictionErrorDisplay

Display class for prediction error plots.

Examples

>>> from sklearn.datasets import load_diabetes
>>> from sklearn.linear_model import Ridge
>>> from skore import evaluate
>>> X, y = load_diabetes(return_X_y=True)
>>> estimator_1 = Ridge(random_state=42)
>>> estimator_2 = Ridge(random_state=43)
>>> comparison_report = evaluate([estimator_1, estimator_2], X, y, splitter=0.2)
>>> display = comparison_report.metrics.prediction_error()
>>> display.plot(kind="actual_vs_predicted")