.. 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-39 .. code-block:: Python from sklearn.datasets import load_breast_cancer from sklearn.linear_model import LogisticRegression from skrub import tabular_pipeline X, y = load_breast_cancer(return_X_y=True, as_frame=True) estimator = tabular_pipeline(LogisticRegression(max_iter=1_000)) .. GENERATED FROM PYTHON SOURCE LINES 40-54 .. code-block:: Python import numpy as np from sklearn.base import clone from skore import evaluate for regularization in np.logspace(-7, 7, 31): report = evaluate( clone(estimator).set_params(logisticregression__C=regularization), X, y, splitter=0.2, 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 cce3ae2e27e68a514cac89b53cde05b4 lr-regularization-1.0e-07 2026-04-02T09:45:08.711362+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.682846 0.984122 0.116555 None None None None None None
1 8c86ee4ef8ff78a5ca37b10cb262058f lr-regularization-2.9e-07 2026-04-02T09:45:08.938459+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.682710 0.984122 0.109650 None None None None None None
2 65613126249b44b8175d8ae325bd65e1 lr-regularization-8.6e-07 2026-04-02T09:45:09.149259+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.682313 0.984122 0.098044 None None None None None None
3 2ddb65892fe191190cdc90328e315aa6 lr-regularization-2.5e-06 2026-04-02T09:45:09.297476+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.681153 0.984122 0.079087 None None None None None None
4 ad19396cf8328436c243fb2a67218c51 lr-regularization-7.4e-06 2026-04-02T09:45:09.426943+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.677790 0.984122 0.060447 None None None None None None
5 1d2b0654d2a90ccf76ea1028f0e74873 lr-regularization-2.2e-05 2026-04-02T09:45:09.555109+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.668210 0.984122 0.060979 None None None None None None
6 e8dd75340ac6aeb8eb14c77fab2643fa lr-regularization-6.3e-05 2026-04-02T09:45:09.680315+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.642328 0.985075 0.058468 None None None None None None
7 17eb85b7e258d235663c295104e1d666 lr-regularization-1.8e-04 2026-04-02T09:45:09.841745+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.581579 0.985392 0.087663 None None None None None None
8 859e3d1c0c3dfbff4bffa061950e8ba4 lr-regularization-5.4e-04 2026-04-02T09:45:09.968284+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.476411 0.985710 0.058607 None None None None None None
9 da896014956de20c0390456429a31043 lr-regularization-1.6e-03 2026-04-02T09:45:10.094302+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.355309 0.987615 0.059772 None None None None None None
10 b39f3fe57cfb68eead3a8324b63a6603 lr-regularization-4.6e-03 2026-04-02T09:45:10.220633+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.252513 0.990156 0.058976 None None None None None None
11 28b9ed500dc596ee52d60be59727d91c lr-regularization-1.4e-02 2026-04-02T09:45:10.347112+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.178052 0.992379 0.058664 None None None None None None
12 5e6e445b2dc06d315aa34ea7f134df02 lr-regularization-4.0e-02 2026-04-02T09:45:10.488758+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.128754 0.995872 0.073961 None None None None None None
13 0a7f6d731bff33ec7f9afe73952c3385 lr-regularization-1.2e-01 2026-04-02T09:45:10.614921+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.098897 0.996189 0.060026 None None None None None None
14 6d0d2e106414a5d4f3e2e0fa67c0375c lr-regularization-3.4e-01 2026-04-02T09:45:10.756787+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.083941 0.995872 0.061970 None None None None None None
15 4691e621be223bfa183d0cc6354b7330 lr-regularization-1.0e+00 2026-04-02T09:45:10.968552+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.080457 0.995554 0.112566 None None None None None None
16 3aa766701a6290d7b9024eccca2ad751 lr-regularization-2.9e+00 2026-04-02T09:45:11.103412+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.089466 0.994601 0.058800 None None None None None None
17 7a6061054b4f7e2d88ecd45b1b5f5f7a lr-regularization-8.6e+00 2026-04-02T09:45:11.242869+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.104241 0.993649 0.061946 None None None None None None
18 dc7c4fea5042890f3212c1421c6b92a2 lr-regularization-2.5e+01 2026-04-02T09:45:11.474981+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.121671 0.992379 0.113050 None None None None None None
19 d5014c9b5099ad62dee8175eb645fcda lr-regularization-7.4e+01 2026-04-02T09:45:11.694812+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.142282 0.991426 0.113761 None None None None None None
20 c316ff197d97c41f7d5097c97fc7d661 lr-regularization-2.2e+02 2026-04-02T09:45:11.938019+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.162450 0.991426 0.121294 None None None None None None
21 de7dcf8e1e2dd20c1160b29c14770220 lr-regularization-6.3e+02 2026-04-02T09:45:12.182035+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.204586 0.991108 0.122729 None None None None None None
22 ff0ff147c5f4840caf38a98784180128 lr-regularization-1.8e+03 2026-04-02T09:45:12.420282+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.284873 0.990473 0.117328 None None None None None None
23 c5758aba3db34c94d6718d3fd016572c lr-regularization-5.4e+03 2026-04-02T09:45:12.566418+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.471375 0.989838 0.065183 None None None None None None
24 62cc5e2027cd5a454265097732cc4580 lr-regularization-1.6e+04 2026-04-02T09:45:12.705363+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.545335 0.991108 0.072387 None None None None None None
25 74a1970587c236336167541bf05110b8 lr-regularization-4.6e+04 2026-04-02T09:45:12.845980+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.934770 0.983963 0.074678 None None None None None None
26 b86a94323efcaa0ce3d87ab21b2814d3 lr-regularization-1.4e+05 2026-04-02T09:45:12.988707+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 1.246488 0.985551 0.076210 None None None None None None
27 2c46f17e7ef508634d408676e0d1c929 lr-regularization-4.0e+05 2026-04-02T09:45:13.132949+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 1.336316 0.985551 0.076458 None None None None None None
28 cc70e300d3b7a9562cb38c061b0f89a3 lr-regularization-1.2e+06 2026-04-02T09:45:13.271350+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 1.670465 0.975865 0.072319 None None None None None None
29 38c0fb37e971a9c852ec4015dad1dbff lr-regularization-3.4e+06 2026-04-02T09:45:13.412681+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 1.605194 0.975865 0.074787 None None None None None None
30 7310fec94e5fc975ab3b0c8f473b79df lr-regularization-1.0e+07 2026-04-02T09:45:13.551545+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 1.875108 0.975548 0.072363 None 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, 'cce3ae2e27e68a514cac89b53cde05b4') to (30, '7310fec94e5fc975ab3b0c8f473b79df') 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 0 non-null object 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(3), object(12) 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'] .. 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 4 .. 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
Metric
Accuracy 0.947368 0.964912 0.964912 0.964912
Precision 0.942029 0.970149 0.970149 0.970149
Recall 0.970149 0.970149 0.970149 0.970149
ROC AUC 0.996189 0.995872 0.995554 0.994601
Log loss 0.098897 0.083941 0.080457 0.089466
Brier score 0.027157 0.024990 0.025149 0.026218
Fit time (s) 0.060026 0.061970 0.112566 0.058800
Predict time (s) 0.035935 0.034916 0.062869 0.035129


.. 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 .. rst-class:: sphx-glr-script-out .. code-block:: none
.. 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 5.912 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 `_