.. 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 319600054297863044292889970164137448300 lr-regularization-1.0e-07 2026-04-20T17:52:26.655009+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.682846 0.984122 0.099246 0.057546 None None None None None
1 133777232867550309543251718287987382666 lr-regularization-2.9e-07 2026-04-20T17:52:26.969326+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.682710 0.984122 0.093573 0.056238 None None None None None
2 239967432476237296588070632678057615642 lr-regularization-8.6e-07 2026-04-20T17:52:27.284817+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.682313 0.984122 0.092248 0.056558 None None None None None
3 336450492414157125226136412595429195995 lr-regularization-2.5e-06 2026-04-20T17:52:27.561180+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.681153 0.984122 0.091662 0.057417 None None None None None
4 326233199582433253816322387949474905112 lr-regularization-7.4e-06 2026-04-20T17:52:27.888749+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.677790 0.984122 0.100166 0.060627 None None None None None
5 42509192854748068163401802872263961737 lr-regularization-2.2e-05 2026-04-20T17:52:28.212103+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.668210 0.984122 0.093845 0.058580 None None None None None
6 265003138106978757403547898607147676060 lr-regularization-6.3e-05 2026-04-20T17:52:28.534110+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.642328 0.985075 0.092312 0.057040 None None None None None
7 260531295652550002599510715870368447238 lr-regularization-1.8e-04 2026-04-20T17:52:28.849819+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.581579 0.985392 0.093260 0.057658 None None None None None
8 28586379743841536348353532421836850869 lr-regularization-5.4e-04 2026-04-20T17:52:29.199737+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.476411 0.985710 0.109397 0.069763 None None None None None
9 131167287054830192511133112243932267338 lr-regularization-1.6e-03 2026-04-20T17:52:29.555287+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.355309 0.987615 0.088961 0.069654 None None None None None
10 308126891139553944768317731282096072120 lr-regularization-4.6e-03 2026-04-20T17:52:29.900827+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.252513 0.990156 0.111219 0.068957 None None None None None
11 279841620087507710598663049879387116984 lr-regularization-1.4e-02 2026-04-20T17:52:30.265086+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.178052 0.992379 0.105894 0.069630 None None None None None
12 303556171485881400658178284044789202666 lr-regularization-4.0e-02 2026-04-20T17:52:30.657004+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.128754 0.995872 0.131898 0.052352 None None None None None
13 135990661535727214012674790622028980054 lr-regularization-1.2e-01 2026-04-20T17:52:30.957141+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.098897 0.996189 0.063245 0.068229 None None None None None
14 121263790949956478747844362450892180457 lr-regularization-3.4e-01 2026-04-20T17:52:31.368102+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.083941 0.995872 0.099731 0.063710 None None None None None
15 140925836346298906342559439993018073165 lr-regularization-1.0e+00 2026-04-20T17:52:31.714664+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.080457 0.995554 0.101894 0.066344 None None None None None
16 32564207787422562201767276785550655976 lr-regularization-2.9e+00 2026-04-20T17:52:32.136321+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.089466 0.994601 0.093928 0.043496 None None None None None
17 209842753366844399909375563662864096650 lr-regularization-8.6e+00 2026-04-20T17:52:32.342166+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.104241 0.993649 0.057646 0.062464 None None None None None
18 308220362541405739951712962468733593787 lr-regularization-2.5e+01 2026-04-20T17:52:32.692314+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.121671 0.992379 0.108864 0.060596 None None None None None
19 128368093804667374367373605304158866373 lr-regularization-7.4e+01 2026-04-20T17:52:33.031396+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.142282 0.991426 0.096144 0.069804 None None None None None
20 40121472873410394581867485699536654387 lr-regularization-2.2e+02 2026-04-20T17:52:33.415477+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.162450 0.991426 0.115205 0.070214 None None None None None
21 93151925567776315627936559444622672498 lr-regularization-6.3e+02 2026-04-20T17:52:33.799109+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.204586 0.991108 0.118077 0.072886 None None None None None
22 331234454705907022678060942328598120906 lr-regularization-1.8e+03 2026-04-20T17:52:34.193172+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.284873 0.990473 0.123701 0.062961 None None None None None
23 35634477182579873469410034264653080021 lr-regularization-5.4e+03 2026-04-20T17:52:34.569009+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.471375 0.989838 0.124675 0.068780 None None None None None
24 31235435463640014562497384215926340693 lr-regularization-1.6e+04 2026-04-20T17:52:34.966175+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.545335 0.991108 0.137036 0.068199 None None None None None
25 17961718234908200650545727235354059010 lr-regularization-4.6e+04 2026-04-20T17:52:35.365284+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.934770 0.983963 0.138423 0.069656 None None None None None
26 218764210745362156583888086669867226547 lr-regularization-1.4e+05 2026-04-20T17:52:35.799254+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.246488 0.985551 0.172180 0.069340 None None None None None
27 240846162326983660378265340807226494271 lr-regularization-4.0e+05 2026-04-20T17:52:36.194319+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.336316 0.985551 0.136745 0.073131 None None None None None
28 189726406070659159571586070476222409921 lr-regularization-1.2e+06 2026-04-20T17:52:36.595981+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.670465 0.975865 0.140221 0.121888 None None None None None
29 286683080110144804324803819587089008944 lr-regularization-3.4e+06 2026-04-20T17:52:37.042814+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.605194 0.975865 0.127628 0.065117 None None None None None
30 185543021202053829588081373607202680230 lr-regularization-1.0e+07 2026-04-20T17:52:37.424612+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.875108 0.975548 0.128567 0.066552 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, '319600054297863044292889970164137448300') to (30, '185543021202053829588081373607202680230') 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'] .. 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.063245 0.099731 0.101894 0.093928
Predict time (s) 0.068895 0.067794 0.062137 0.054768


.. GENERATED FROM PYTHON SOURCE LINES 93-95 .. code-block:: Python reports.metrics.roc().plot(subplot_by=None) .. 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 12.662 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 `_