EstimatorReport#
- class skore.EstimatorReport(estimator, *, fit='auto', X_train=None, y_train=None, X_test=None, y_test=None)[source]#
Report for a fitted estimator.
This class provides a set of tools to quickly validate and inspect a scikit-learn compatible estimator.
- Parameters:
- estimatorestimator object
Estimator to make the report from. When the estimator is not fitted, it is deep-copied to avoid side-effects. If it is fitted, it is cloned instead.
- fit{“auto”, True, False}, default=”auto”
Whether to fit the estimator on the training data. If “auto”, the estimator is fitted only if the training data is provided.
- X_train{array-like, sparse matrix} of shape (n_samples, n_features) or None
Training data.
- y_trainarray-like of shape (n_samples,) or (n_samples, n_outputs) or None
Training target.
- X_test{array-like, sparse matrix} of shape (n_samples, n_features) or None
Testing data. It should have the same structure as the training data.
- y_testarray-like of shape (n_samples,) or (n_samples, n_outputs) or None
Testing target.
- Attributes:
- estimator_estimator object
The cloned or copied estimator.
- estimator_name_str
The name of the estimator.
See also
skore.sklearn.cross_validation.report.CrossValidationReport
Report of cross-validation results.
Examples
>>> from sklearn.datasets import make_classification >>> from sklearn.model_selection import train_test_split >>> from sklearn.linear_model import LogisticRegression >>> X, y = make_classification(random_state=42) >>> X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) >>> estimator = LogisticRegression().fit(X_train, y_train) >>> from skore import EstimatorReport >>> report = EstimatorReport(estimator, X_test=X_test, y_test=y_test)
- cache_predictions(response_methods='auto', n_jobs=None)[source]#
Cache estimator’s predictions.
- Parameters:
- response_methods“auto” or list of str, default=”auto”
The response methods to precompute. If “auto”, the response methods are inferred from the ml task: for classification we compute the response of the
predict_proba
,decision_function
andpredict
methods; for regression we compute the response of thepredict
method.- n_jobsint or None, default=None
The number of jobs to run in parallel. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors.
Examples
>>> from sklearn.datasets import load_breast_cancer >>> from sklearn.linear_model import LogisticRegression >>> from sklearn.model_selection import train_test_split >>> from skore import EstimatorReport >>> X_train, X_test, y_train, y_test = train_test_split( ... *load_breast_cancer(return_X_y=True), random_state=0 ... ) >>> classifier = LogisticRegression(max_iter=10_000) >>> report = EstimatorReport( ... classifier, ... X_train=X_train, ... y_train=y_train, ... X_test=X_test, ... y_test=y_test, ... ) >>> report.cache_predictions() >>> report._cache {...}
- clear_cache()[source]#
Clear the cache.
Examples
>>> from sklearn.datasets import load_breast_cancer >>> from sklearn.linear_model import LogisticRegression >>> from sklearn.model_selection import train_test_split >>> from skore import EstimatorReport >>> X_train, X_test, y_train, y_test = train_test_split( ... *load_breast_cancer(return_X_y=True), random_state=0 ... ) >>> classifier = LogisticRegression(max_iter=10_000) >>> report = EstimatorReport( ... classifier, ... X_train=X_train, ... y_train=y_train, ... X_test=X_test, ... y_test=y_test, ... ) >>> report.cache_predictions() >>> report.clear_cache() >>> report._cache {}
Gallery examples#

EstimatorReport: Get insights from any scikit-learn estimator