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 thesklearn.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
- scoringstr, callable, list, tuple, or dict, default=None
- cvint, cross-validation generator or an iterable, default=None
- n_jobsint, default=None
- verboseint, default=0
- paramsdict, default=None
- pre_dispatchint or str, default=’2*n_jobs’
- return_train_scorebool, default=False
- return_estimatorbool, default=False
- return_indicesbool, default=False
- error_score‘raise’ or numeric, default=np.nan
- 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(...)