.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/technical_details/plot_skore_local_project.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_technical_details_plot_skore_local_project.py: .. _example_skore_local_project: =================== Local skore Project =================== This example shows how to use :class:`~skore.Project` in **local** mode: store reports on your machine and inspect them. A key point is that :meth:`~skore.Project.summarize` returns a :class:`~skore.project._summary.Summary`, which is a :class:`pandas.DataFrame`. In Jupyter you get an interactive widget, but you can always inspect and filter the summary as a DataFrame if you prefer. .. GENERATED FROM PYTHON SOURCE LINES 16-22 Create a local project and store reports ========================================= We use a temporary directory as the workspace so the example is self-contained. In practice you can omit ``workspace`` to use the default (e.g. a ``skore/`` directory in your user cache). .. GENERATED FROM PYTHON SOURCE LINES 22-31 .. code-block:: Python from pathlib import Path from tempfile import TemporaryDirectory from skore import Project tmp_dir = TemporaryDirectory() tmp_path = Path(tmp_dir.name) project = Project("example-project", workspace=tmp_path) .. GENERATED FROM PYTHON SOURCE LINES 32-41 .. code-block:: Python from sklearn.datasets import load_breast_cancer from sklearn.linear_model import LogisticRegression from skore import train_test_split from skrub import tabular_pipeline X, y = load_breast_cancer(return_X_y=True, as_frame=True) split_data = train_test_split(X=X, y=y, random_state=42, as_dict=True) estimator = tabular_pipeline(LogisticRegression(max_iter=1_000)) .. rst-class:: sphx-glr-script-out .. code-block:: none ╭────────────────────── HighClassImbalanceTooFewExamplesWarning ───────────────────────╮ │ It seems that you have a classification problem with at least one class with fewer │ │ than 100 examples in the test set. In this case, using train_test_split may not be a │ │ good idea because of high variability in the scores obtained on the test set. We │ │ suggest three options to tackle this challenge: you can increase test_size, collect │ │ more data, or use skore's CrossValidationReport with the `splitter` parameter of │ │ your choice. │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────── ShuffleTrueWarning ─────────────────────────────────╮ │ We detected that the `shuffle` parameter is set to `True` either explicitly or from │ │ its default value. In case of time-ordered events (even if they are independent), │ │ this will result in inflated model performance evaluation because natural drift will │ │ not be taken into account. We recommend setting the shuffle parameter to `False` in │ │ order to ensure the evaluation process is really representative of your production │ │ release process. │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ .. GENERATED FROM PYTHON SOURCE LINES 42-54 .. code-block:: Python import numpy as np from sklearn.base import clone from skore import EstimatorReport for regularization in np.logspace(-7, 7, 31): report = EstimatorReport( clone(estimator).set_params(logisticregression__C=regularization), **split_data, pos_label=1, ) project.put(f"lr-regularization-{regularization:.1e}", report) .. GENERATED FROM PYTHON SOURCE LINES 55-61 Summarize: you get a DataFrame ============================== :meth:`~skore.Project.summarize` returns a :class:`~skore.project._summary.Summary`, which subclasses :class:`pandas.DataFrame`. In a Jupyter environment it renders an interactive parallel-coordinates widget by default. .. GENERATED FROM PYTHON SOURCE LINES 61-63 .. code-block:: Python summary = project.summarize() .. GENERATED FROM PYTHON SOURCE LINES 64-66 To see the normal DataFrame table instead of the widget (e.g. in scripts or when you prefer the table), wrap the summary in :class:`pandas.DataFrame`: .. GENERATED FROM PYTHON SOURCE LINES 66-71 .. code-block:: Python import pandas as pd pandas_summary = pd.DataFrame(summary) pandas_summary .. raw:: html
key date learner ml_task report_type dataset rmse log_loss roc_auc fit_time predict_time rmse_mean log_loss_mean roc_auc_mean fit_time_mean predict_time_mean
id
0 6f909209f4faadca1feb34f0a29faa0e lr-regularization-1.0e-07 2026-03-13T15:21:48.542797+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.662918 0.992509 0.135676 0.084495 None None None None None
1 df8ddb75382cb8354703e6e214adc7f2 lr-regularization-2.9e-07 2026-03-13T15:21:48.800596+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.662790 0.992509 0.120903 0.086923 None None None None None
2 c693f08fb8e46221f1935e3ab4ff7837 lr-regularization-8.6e-07 2026-03-13T15:21:49.067430+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.662415 0.992509 0.124108 0.078852 None None None None None
3 1a3292dde218ea941a77c3c63f8e3ee6 lr-regularization-2.5e-06 2026-03-13T15:21:49.308597+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.661320 0.992509 0.111407 0.075735 None None None None None
4 471dd26c13b6580445cb4304b5e62385 lr-regularization-7.4e-06 2026-03-13T15:21:49.534120+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.658141 0.992509 0.110634 0.082259 None None None None None
5 c253d0cdfac735df6f538ae4edeeb0b5 lr-regularization-2.2e-05 2026-03-13T15:21:49.795714+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.649068 0.992509 0.128640 0.077246 None None None None None
6 9610602f7da6c415d0da5dfd06e3f2e1 lr-regularization-6.3e-05 2026-03-13T15:21:50.051692+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.624398 0.992926 0.127553 0.082783 None None None None None
7 0e46a7f00085055f060db997858e88e1 lr-regularization-1.8e-04 2026-03-13T15:21:50.307972+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.565558 0.993550 0.122423 0.072579 None None None None None
8 6d1a7278b1eff626be523d889afd12d7 lr-regularization-5.4e-04 2026-03-13T15:21:50.549306+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.460542 0.994382 0.118071 0.078494 None None None None None
9 0095b9aa960079868a78dc66c2655d54 lr-regularization-1.6e-03 2026-03-13T15:21:50.802217+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.336408 0.996047 0.123690 0.079595 None None None None None
10 fd5341c069f01b9d3ee523b504af7290 lr-regularization-4.6e-03 2026-03-13T15:21:51.066991+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.231201 0.997087 0.135045 0.077548 None None None None None
11 8011fecb0ad7d1bcea9d351178b37b75 lr-regularization-1.4e-02 2026-03-13T15:21:51.311996+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.155570 0.998335 0.116415 0.076691 None None None None None
12 c81f00a00535acf235715b54b58b7be1 lr-regularization-4.0e-02 2026-03-13T15:21:51.540293+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.105629 0.998752 0.106149 0.060339 None None None None None
13 50631da12288b8347e8f236c4b635639 lr-regularization-1.2e-01 2026-03-13T15:21:51.733941+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.075737 0.998752 0.089826 0.072042 None None None None None
14 10391ba281dc87734d893bb132400a19 lr-regularization-3.4e-01 2026-03-13T15:21:51.979862+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.060118 0.997919 0.123162 0.076722 None None None None None
15 9b717de43db2fbf46519f4088f37e381 lr-regularization-1.0e+00 2026-03-13T15:21:52.233377+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.054072 0.997919 0.124825 0.083516 None None None None None
16 201d1ee4e0c560fced7b6efe6d6a42f1 lr-regularization-2.9e+00 2026-03-13T15:21:52.502587+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.055710 0.997711 0.133681 0.085599 None None None None None
17 99a0967fbc91e518d3bc50b825067eee lr-regularization-8.6e+00 2026-03-13T15:21:52.772154+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.062826 0.997503 0.129501 0.084457 None None None None None
18 82d941fa84e4a80af5f1ea97ea828533 lr-regularization-2.5e+01 2026-03-13T15:21:53.044850+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.080149 0.996463 0.134120 0.076407 None None None None None
19 4b113bff8eeb86450634108c82e86923 lr-regularization-7.4e+01 2026-03-13T15:21:53.306550+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.129595 0.993550 0.134446 0.083857 None None None None None
20 fa4644ddbaa6a7ccb3ba02136c878a46 lr-regularization-2.2e+02 2026-03-13T15:21:53.580516+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.245793 0.990845 0.141796 0.085992 None None None None None
21 bcfa7be592d72f2ddb2420f944fe0c87 lr-regularization-6.3e+02 2026-03-13T15:21:53.864534+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.456457 0.989180 0.143560 0.079803 None None None None None
22 271b9944a5e0e23f3a4f2ba691393dfe lr-regularization-1.8e+03 2026-03-13T15:21:54.134886+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 0.755451 0.987516 0.138970 0.078555 None None None None None
23 40cfe4dd8946e7f570969ad214ff12ae lr-regularization-5.4e+03 2026-03-13T15:21:54.408814+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 1.135445 0.987308 0.143061 0.080266 None None None None None
24 2ce9b5c045ddecb6876396fd68e28b30 lr-regularization-1.6e+04 2026-03-13T15:21:54.678350+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 1.566408 0.982834 0.138494 0.077367 None None None None None
25 be2c0450eb17b11029f08da5fca98446 lr-regularization-4.6e+04 2026-03-13T15:21:54.953161+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 1.921192 0.982418 0.136012 0.078725 None None None None None
26 ef70b7b877c09c1d71a0c8c3aad93f37 lr-regularization-1.4e+05 2026-03-13T15:21:55.215383+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 2.001411 0.982626 0.131545 0.076251 None None None None None
27 b7bfaa26f2626434f7e9c0ab2448c471 lr-regularization-4.0e+05 2026-03-13T15:21:55.474290+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 2.192980 0.981898 0.131587 0.075289 None None None None None
28 bc2c7a2d7420373507e7584ee1f1bb72 lr-regularization-1.2e+06 2026-03-13T15:21:55.728140+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 2.268483 0.973159 0.128941 0.079466 None None None None None
29 63876f62218ec630666abba0fd95b5cd lr-regularization-3.4e+06 2026-03-13T15:21:55.983800+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 2.268482 0.973367 0.126854 0.078146 None None None None None
30 aa0cffe531ef5c6d4bbfc706021f711b lr-regularization-1.0e+07 2026-03-13T15:21:56.236307+00:00 LogisticRegression binary-classification estimator 0966e6e4b6a8c8bd5b0e6bd95f36939d None 2.268482 0.973159 0.124403 0.074884 None None None None None


.. GENERATED FROM PYTHON SOURCE LINES 72-74 Basically, our summary contains metadata related to various information that we need to quickly help filtering the reports. .. GENERATED FROM PYTHON SOURCE LINES 74-76 .. code-block:: Python summary.info() .. rst-class:: sphx-glr-script-out .. code-block:: none MultiIndex: 31 entries, (0, '6f909209f4faadca1feb34f0a29faa0e') to (30, 'aa0cffe531ef5c6d4bbfc706021f711b') Data columns (total 16 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 key 31 non-null object 1 date 31 non-null object 2 learner 31 non-null category 3 ml_task 31 non-null object 4 report_type 31 non-null object 5 dataset 31 non-null object 6 rmse 0 non-null object 7 log_loss 31 non-null float64 8 roc_auc 31 non-null float64 9 fit_time 31 non-null float64 10 predict_time 31 non-null float64 11 rmse_mean 0 non-null object 12 log_loss_mean 0 non-null object 13 roc_auc_mean 0 non-null object 14 fit_time_mean 0 non-null object 15 predict_time_mean 0 non-null object dtypes: category(1), float64(4), object(11) memory usage: 5.3+ KB .. GENERATED FROM PYTHON SOURCE LINES 77-79 Filter reports by metric (e.g. keep only those above a given accuracy) and work with the result as a table. .. GENERATED FROM PYTHON SOURCE LINES 79-81 .. code-block:: Python summary.query("log_loss < 0.1")["key"].tolist() .. rst-class:: sphx-glr-script-out .. code-block:: none ['lr-regularization-1.2e-01', 'lr-regularization-3.4e-01', 'lr-regularization-1.0e+00', 'lr-regularization-2.9e+00', 'lr-regularization-8.6e+00', 'lr-regularization-2.5e+01'] .. GENERATED FROM PYTHON SOURCE LINES 82-84 Use :meth:`~skore.project._summary.Summary.reports` to load the corresponding reports from the project (optionally after filtering the summary). .. GENERATED FROM PYTHON SOURCE LINES 84-87 .. code-block:: Python reports = summary.query("log_loss < 0.1").reports(return_as="comparison") len(reports.reports_) .. rst-class:: sphx-glr-script-out .. code-block:: none 6 .. GENERATED FROM PYTHON SOURCE LINES 88-90 Since we got a :class:`~skore.ComparisonReport`, we can use the metrics accessor to summarize the metrics across the reports. .. GENERATED FROM PYTHON SOURCE LINES 90-92 .. code-block:: Python reports.metrics.summarize().frame() .. raw:: html
Estimator LogisticRegression_1 LogisticRegression_2 LogisticRegression_3 LogisticRegression_4 LogisticRegression_5 LogisticRegression_6
Metric
Accuracy 0.993007 0.993007 0.993007 0.979021 0.972028 0.979021
Precision 0.988889 0.988889 0.988889 0.988636 0.988506 0.988636
Recall 1.000000 1.000000 1.000000 0.977528 0.966292 0.977528
ROC AUC 0.998752 0.997919 0.997919 0.997711 0.997503 0.996463
Brier score 0.016769 0.014335 0.013810 0.015269 0.017996 0.022781
Fit time (s) 0.089826 0.123162 0.124825 0.133681 0.129501 0.134120
Predict time (s) 0.077258 0.077425 0.081635 0.081724 0.080702 0.075156


.. GENERATED FROM PYTHON SOURCE LINES 93-95 .. code-block:: Python reports.metrics.roc().plot(subplot_by=None) .. image-sg:: /auto_examples/technical_details/images/sphx_glr_plot_skore_local_project_001.png :alt: ROC Curve Positive label: 1 Data source: Test set :srcset: /auto_examples/technical_details/images/sphx_glr_plot_skore_local_project_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 96-98 .. code-block:: Python project.delete("example-project", workspace=tmp_path) tmp_dir.cleanup() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 10.137 seconds) .. _sphx_glr_download_auto_examples_technical_details_plot_skore_local_project.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_skore_local_project.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_skore_local_project.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_skore_local_project.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_