EstimatorReport.metrics.timings#

EstimatorReport.metrics.timings()[source]#

Get all measured processing times related to the estimator.

When an estimator is fitted inside the EstimatorReport, the time to fit is recorded. Similarly, when predictions are computed on some data, the time to predict is recorded. This function returns all the recorded times.

Returns:
timingsdict

The recorded times, in seconds, in the form of a dict with some or all of the following keys:

  • “fit_time”, for the time to fit the estimator in the train set.

  • “predict_time_{data_source}”, where data_source is “train”, “test” or “X_y_{data_source_hash}”, for the time to compute the predictions on the given data source.

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()
>>> from skore import EstimatorReport
>>> report = EstimatorReport(
...     estimator,
...     X_train=X_train,
...     y_train=y_train,
...     X_test=X_test,
...     y_test=y_test,
... )
>>> report.metrics.timings()
{'fit_time': ...}
>>> report.cache_predictions(response_methods=["predict"])
>>> report.metrics.timings()
{'fit_time': ..., 'predict_time_test': ...}