.. 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 313732898560805859928722544442124414154 lr-regularization-1.0e-07 2026-05-28T16:16:20.009889+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.682846 0.984122 0.108293 0.061876 None None None None None
1 319708312413119946939181119559865541416 lr-regularization-2.9e-07 2026-05-28T16:16:20.405147+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.682710 0.984122 0.093412 0.061999 None None None None None
2 127717063723287815399151605243545129468 lr-regularization-8.6e-07 2026-05-28T16:16:20.805834+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.682313 0.984122 0.099213 0.056119 None None None None None
3 223230287871378133934674701927433565491 lr-regularization-2.5e-06 2026-05-28T16:16:21.169675+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.681153 0.984122 0.092752 0.055237 None None None None None
4 14507951682390207113689379955260547499 lr-regularization-7.4e-06 2026-05-28T16:16:21.528443+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.677790 0.984122 0.084517 0.052158 None None None None None
5 300226254496485739586635923734371192674 lr-regularization-2.2e-05 2026-05-28T16:16:21.868098+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.668210 0.984122 0.084354 0.054411 None None None None None
6 177234224797364889299293539092679330105 lr-regularization-6.3e-05 2026-05-28T16:16:22.226993+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.642328 0.985075 0.090340 0.059115 None None None None None
7 67113183829976952181237015422302251597 lr-regularization-1.8e-04 2026-05-28T16:16:22.633087+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.581579 0.985392 0.101549 0.060517 None None None None None
8 219084124692606651420792931230965370619 lr-regularization-5.4e-04 2026-05-28T16:16:23.034466+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.476411 0.985710 0.101388 0.049223 None None None None None
9 67024902395835752917354603527124030461 lr-regularization-1.6e-03 2026-05-28T16:16:23.389526+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.355309 0.987615 0.081715 0.062378 None None None None None
10 20752087879896747978688749632412702547 lr-regularization-4.6e-03 2026-05-28T16:16:23.772851+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.252513 0.990156 0.107469 0.063545 None None None None None
11 14082501435874176114521512264340192398 lr-regularization-1.4e-02 2026-05-28T16:16:24.188989+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.178052 0.992379 0.102678 0.066004 None None None None None
12 141777081551180798461520805566704181350 lr-regularization-4.0e-02 2026-05-28T16:16:24.619023+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.128754 0.995872 0.112194 0.062332 None None None None None
13 54341517086876419648069300538352128450 lr-regularization-1.2e-01 2026-05-28T16:16:25.037410+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.098897 0.996189 0.110457 0.063259 None None None None None
14 224615846622658151498223983822987702862 lr-regularization-3.4e-01 2026-05-28T16:16:25.461543+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.083941 0.995872 0.104806 0.061729 None None None None None
15 152777121554859763738718529567249460444 lr-regularization-1.0e+00 2026-05-28T16:16:25.876931+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.080457 0.995554 0.107326 0.061778 None None None None None
16 107918063699044483721899120989866953001 lr-regularization-2.9e+00 2026-05-28T16:16:26.282436+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.089466 0.994601 0.107343 0.060852 None None None None None
17 39131909699945038850504752640150876932 lr-regularization-8.6e+00 2026-05-28T16:16:26.676369+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.104241 0.993649 0.097997 0.055797 None None None None None
18 235992571473643156109774361781410930764 lr-regularization-2.5e+01 2026-05-28T16:16:27.080408+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.121671 0.992379 0.109852 0.060203 None None None None None
19 145999848168980483191942623100998716999 lr-regularization-7.4e+01 2026-05-28T16:16:27.507324+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.142282 0.991426 0.105467 0.059415 None None None None None
20 210292647011529085782953848173331697946 lr-regularization-2.2e+02 2026-05-28T16:16:27.916287+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.162450 0.991426 0.110705 0.062459 None None None None None
21 241629102986980650640149058905305007542 lr-regularization-6.3e+02 2026-05-28T16:16:28.349872+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.204586 0.991108 0.117996 0.063509 None None None None None
22 298090923220712231661049497626346014907 lr-regularization-1.8e+03 2026-05-28T16:16:28.784167+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.291953 0.990473 0.123633 0.057950 None None None None None
23 294540002578425443189166775191868121412 lr-regularization-5.4e+03 2026-05-28T16:16:29.174410+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.471382 0.989838 0.095239 0.050757 None None None None None
24 194325738171446401574895152690470746001 lr-regularization-1.6e+04 2026-05-28T16:16:29.540095+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.796526 0.983169 0.106520 0.052886 None None None None None
25 288478942548281597877302950445912153631 lr-regularization-4.6e+04 2026-05-28T16:16:29.923090+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.133167 0.984757 0.112277 0.051120 None None None None None
26 304414933258766212318383365119810995285 lr-regularization-1.4e+05 2026-05-28T16:16:30.298989+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.229179 0.985551 0.113987 0.051754 None None None None None
27 333649163601906408947538943839928278621 lr-regularization-4.0e+05 2026-05-28T16:16:30.669417+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.276041 0.985869 0.109718 0.051825 None None None None None
28 321218574946143088662893273481516368100 lr-regularization-1.2e+06 2026-05-28T16:16:31.046404+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.447319 0.975865 0.109800 0.053340 None None None None None
29 71112058722600159588795706715095923095 lr-regularization-3.4e+06 2026-05-28T16:16:31.421597+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.448698 0.976500 0.110655 0.052064 None None None None None
30 61791457605704724819839680335272503200 lr-regularization-1.0e+07 2026-05-28T16:16:31.790039+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.897034 0.976183 0.104509 0.048507 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, '313732898560805859928722544442124414154') to (30, '61791457605704724819839680335272503200') 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
Score 0.947368 0.964912 0.964912 0.964912
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.110457 0.104806 0.107326 0.107343
Predict time (s) 0.057329 0.062241 0.060560 0.060325


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