.. 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 82f01bdfce9cdd853c862abba834c33f lr-regularization-1.0e-07 2026-03-27T13:06:51.134009+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.682846 0.984122 0.135748 None None None None None None
1 e33eb3207cac10b32041d281ce14a94a lr-regularization-2.9e-07 2026-03-27T13:06:51.412339+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.682710 0.984122 0.133380 None None None None None None
2 b5733fdc8270138fb13e8dc9cdff36ed lr-regularization-8.6e-07 2026-03-27T13:06:51.659784+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.682313 0.984122 0.109869 None None None None None None
3 95c77b566cbccb8e314cdaf66201ca4a lr-regularization-2.5e-06 2026-03-27T13:06:51.914574+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.681153 0.984122 0.126737 None None None None None None
4 0db14e4bbe06a5987998dd1be9f17a4f lr-regularization-7.4e-06 2026-03-27T13:06:52.169691+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.677790 0.984122 0.124913 None None None None None None
5 8a7e72257c6aa07dc07956aeb741d7e5 lr-regularization-2.2e-05 2026-03-27T13:06:52.311711+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.668210 0.984122 0.065759 None None None None None None
6 d1bde468c8902a124aacb847e7c67f45 lr-regularization-6.3e-05 2026-03-27T13:06:52.454790+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.642328 0.985075 0.064632 None None None None None None
7 97790c77be5deec39d7807df747d2e3c lr-regularization-1.8e-04 2026-03-27T13:06:52.597939+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.581579 0.985392 0.066439 None None None None None None
8 0ae095221b46c4ae7887b0e14363e7db lr-regularization-5.4e-04 2026-03-27T13:06:52.743813+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.476411 0.985710 0.068008 None None None None None None
9 8d5a6b6285b6efc64461726d689c784d lr-regularization-1.6e-03 2026-03-27T13:06:52.988513+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.355309 0.987615 0.117831 None None None None None None
10 ed5beb595855d9f955d6638241cbb021 lr-regularization-4.6e-03 2026-03-27T13:06:53.244467+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.252513 0.990156 0.124471 None None None None None None
11 6730776adb2457ccfe344329f69cb8d1 lr-regularization-1.4e-02 2026-03-27T13:06:53.512177+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.178052 0.992379 0.127996 None None None None None None
12 8c263d5b5286d970bc461a2fcac97705 lr-regularization-4.0e-02 2026-03-27T13:06:53.710221+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.128754 0.995872 0.069371 None None None None None None
13 4b0033ad94e6eb31867a93e29deb8b3f lr-regularization-1.2e-01 2026-03-27T13:06:53.951030+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.098897 0.996189 0.120337 None None None None None None
14 14eed12ea458f86074c549f4049ff0dd lr-regularization-3.4e-01 2026-03-27T13:06:54.181244+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.083941 0.995872 0.107787 None None None None None None
15 7dc451f75559509dd8d0f5fd28ec44f9 lr-regularization-1.0e+00 2026-03-27T13:06:54.398317+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.080457 0.995554 0.104451 None None None None None None
16 0be0241e877f49981567f879d8c3c028 lr-regularization-2.9e+00 2026-03-27T13:06:54.659038+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.089466 0.994601 0.123010 None None None None None None
17 35086d42ac2337ab23b9516411524a21 lr-regularization-8.6e+00 2026-03-27T13:06:54.924768+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.104241 0.993649 0.134518 None None None None None None
18 34bf50b369ddb17f0a0a7c36ce1f3113 lr-regularization-2.5e+01 2026-03-27T13:06:55.201254+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.121671 0.992379 0.133600 None None None None None None
19 97e9c70dd0b66056d8023f6d15326805 lr-regularization-7.4e+01 2026-03-27T13:06:55.477897+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.142282 0.991426 0.130623 None None None None None None
20 c8d2bd255e12dd5424ce7ad8345c7780 lr-regularization-2.2e+02 2026-03-27T13:06:55.763546+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.162450 0.991426 0.144351 None None None None None None
21 68fdda1bf33f5c8e4e6b6357d78f7dfc lr-regularization-6.3e+02 2026-03-27T13:06:56.044868+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.204586 0.991108 0.139917 None None None None None None
22 e40d6892b033bcb716f57458dbceac8f lr-regularization-1.8e+03 2026-03-27T13:06:56.303821+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.291953 0.990473 0.130204 None None None None None None
23 4bf896d370cd074bcd8555b48ac49aee lr-regularization-5.4e+03 2026-03-27T13:06:56.454334+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.471382 0.989838 0.074480 None None None None None None
24 c8decbec09eac575487f87087cf96b0a lr-regularization-1.6e+04 2026-03-27T13:06:56.616195+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 0.796526 0.983169 0.085537 None None None None None None
25 3c54d53897a22b0444bdabc22dd85268 lr-regularization-4.6e+04 2026-03-27T13:06:56.781637+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 1.133167 0.984757 0.090190 None None None None None None
26 6e7d7650fcecf949dd60df4f894a8a5a lr-regularization-1.4e+05 2026-03-27T13:06:56.944262+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 1.229179 0.985551 0.087516 None None None None None None
27 1deb098c94f48756de8ea2cbad3399ce lr-regularization-4.0e+05 2026-03-27T13:06:57.107860+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 1.276041 0.985869 0.085979 None None None None None None
28 c8d89a1921e299c7d220ab23f155637b lr-regularization-1.2e+06 2026-03-27T13:06:57.271814+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 1.447319 0.975865 0.086354 None None None None None None
29 4443a11e69e532a9e24b116d6431e76f lr-regularization-3.4e+06 2026-03-27T13:06:57.432890+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 1.448698 0.976500 0.083347 None None None None None None
30 dc795b85826c054835edf0069bd6afba lr-regularization-1.0e+07 2026-03-27T13:06:57.593093+00:00 LogisticRegression binary-classification estimator a36fcd73fd752ec31662e617f0f6e127 None 1.897034 0.976183 0.083862 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, '82f01bdfce9cdd853c862abba834c33f') to (30, 'dc795b85826c054835edf0069bd6afba') 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
Brier score 0.027157 0.024990 0.025149 0.026218
Fit time (s) 0.120337 0.107787 0.104451 0.123010
Predict time (s) 0.040571 0.040740 0.043242 0.056472


.. 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 7.800 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 `_