EstimatorReport.get_predictions#

EstimatorReport.get_predictions(*, data_source, response_method='predict')[source]

Get estimator’s predictions.

This method has the advantage to reload from the cache if the predictions were already computed in a previous call.

Parameters:
data_source{“test”, “train”}

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.

response_method{“predict”, “predict_proba”, “decision_function”}, default=”predict”

The response method to use to get the predictions.

Returns:
np.ndarray of shape (n_samples,) or (n_samples, n_classes)

The predictions.

Raises:
ValueError

If the data source is invalid.

Examples

>>> from sklearn.datasets import load_breast_cancer
>>> from sklearn.linear_model import LogisticRegression
>>> from skore import evaluate
>>> X, y = load_breast_cancer(return_X_y=True)
>>> classifier = LogisticRegression(max_iter=10_000)
>>> report = evaluate(classifier, X, y, splitter=0.2)
>>> predictions = report.get_predictions(data_source="test")
>>> predictions.shape
(114,)