CrossValidationReporter#

class skore.CrossValidationReporter(*args, **kwargs)[source]#

Evaluate estimator by cross-validation and output UI-friendly object.

Warning

Deprecation Notice: This class is deprecated in favor of skore.CrossValidationReport.

This class wraps scikit-learn’s sklearn.model_selection.cross_validate() function, to provide more context and facilitate the analysis. As such, the arguments are the same as the sklearn.model_selection.cross_validate() function.

For a user guide and in-depth example, see Cross-validation.

More precisely, upon initialization, this class does the following:

  • Detect the ML task being performed, based on the estimator and data

  • Based on the ML task, add appropriate metrics to compute during cross-validation

  • Perform the cross-validation itself

  • Clean the cross-validation results so that the output of the function is as close as possible to scikit-learn’s

Parameters:
estimatorestimator object implementing ‘fit’

The object to use to fit the data.

X{array-like, sparse matrix} of shape (n_samples, n_features)

The data to fit. Can be for example a list, or an array.

yarray-like of shape (n_samples,) or (n_samples, n_outputs), default=None

The target variable to try to predict in the case of supervised learning.

groupsarray-like of shape (n_samples,), default=None

See sklearn.model_selection.cross_validate().

scoringstr, callable, list, tuple, or dict, default=None

See sklearn.model_selection.cross_validate().

cvint, cross-validation generator or an iterable, default=None

See sklearn.model_selection.cross_validate().

n_jobsint, default=None

See sklearn.model_selection.cross_validate().

verboseint, default=0

See sklearn.model_selection.cross_validate().

paramsdict, default=None

See sklearn.model_selection.cross_validate().

pre_dispatchint or str, default=’2*n_jobs’

See sklearn.model_selection.cross_validate().

return_train_scorebool, default=False

See sklearn.model_selection.cross_validate().

return_estimatorbool, default=False

See sklearn.model_selection.cross_validate().

return_indicesbool, default=False

See sklearn.model_selection.cross_validate().

error_score‘raise’ or numeric, default=np.nan

See sklearn.model_selection.cross_validate().

Attributes:
cv_resultsdict

A dict of the form returned by scikit-learn’s sklearn.model_selection.cross_validate() function.

Xarray-like

The data that was fitted.

yarray-like or None

The target variable, or None if not provided.

plotsCrossValidationPlots

Various plots of the cross-validation results.

Examples

>>> from sklearn import datasets, linear_model
>>> from skore import CrossValidationReporter
>>> X, y = datasets.load_diabetes(return_X_y=True)
>>> lasso = linear_model.Lasso()
>>> reporter = CrossValidationReporter(lasso, X, y, cv=3)
>>> reporter
CrossValidationReporter(...)
property plots[source]#

Plots of the cross-validation results.