CrossValidationReport.create_estimator_report#

CrossValidationReport.create_estimator_report(*, X_test=None, y_test=None, test_data=None)[source]

Create an estimator report from the cross-validation report.

This method creates a new EstimatorReport with the same estimator and the same data as the cross-validation report. It is useful to evaluate and deploy a model that was deemed optimal with cross-validation. Provide a held out test set to properly evaluate the performance of the model.

Parameters:
X_test{array-like, sparse matrix} of shape (n_samples, n_features)

Testing data. It should have the same structure as the training data.

y_testarray-like of shape (n_samples,) or (n_samples, n_outputs)

Testing target.

test_datadict or None

When estimator is a skrub SkrubLearner, bindings for variables contained in the DataOp that was used to create this learner (e.g. {"X": X_df, "other_table": df, ...}).

Returns:
EstimatorReport

The estimator report.

Examples

>>> from sklearn.datasets import make_classification
>>> from sklearn.ensemble import RandomForestClassifier
>>> from sklearn.model_selection import train_test_split
>>> from skore import evaluate
>>> X, y = make_classification(random_state=42)
>>> X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)
>>> forest_report = evaluate(
...     RandomForestClassifier(random_state=42), X_train, y_train, splitter=5
... )
>>> final_report = forest_report.create_estimator_report(
...     X_test=X_test, y_test=y_test
... )
>>> final_report.metrics.summarize().frame()