.. 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 284093228217490968778865723131983556241 lr-regularization-1.0e-07 2026-05-27T07:59:17.122115+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.682846 0.984122 0.129016 0.087332 None None None None None
1 187124531107489554712585294680137485213 lr-regularization-2.9e-07 2026-05-27T07:59:17.578104+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.682710 0.984122 0.137199 0.077172 None None None None None
2 255572861750338550086951979958917350907 lr-regularization-8.6e-07 2026-05-27T07:59:17.998726+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.682313 0.984122 0.113589 0.064240 None None None None None
3 118137799761384911433456339563806335964 lr-regularization-2.5e-06 2026-05-27T07:59:18.397637+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.681153 0.984122 0.126430 0.073544 None None None None None
4 269873250232530704378680498425703122099 lr-regularization-7.4e-06 2026-05-27T07:59:18.774880+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.677790 0.984122 0.095717 0.057962 None None None None None
5 108456935244834542735306799514453316528 lr-regularization-2.2e-05 2026-05-27T07:59:19.125381+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.668210 0.984122 0.107499 0.065768 None None None None None
6 23516806759272617501250838066184165185 lr-regularization-6.3e-05 2026-05-27T07:59:19.490057+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.642328 0.985075 0.109727 0.073067 None None None None None
7 226416952655437036927258701929029645846 lr-regularization-1.8e-04 2026-05-27T07:59:19.883623+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.581579 0.985392 0.117158 0.073161 None None None None None
8 101205377183891174150497585505854257324 lr-regularization-5.4e-04 2026-05-27T07:59:20.280599+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.476411 0.985710 0.120897 0.074223 None None None None None
9 20756074311773863042752298315277459239 lr-regularization-1.6e-03 2026-05-27T07:59:20.687135+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.355309 0.987615 0.120795 0.062921 None None None None None
10 76103546144602923813113170563604190915 lr-regularization-4.6e-03 2026-05-27T07:59:21.060111+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.252513 0.990156 0.127296 0.077641 None None None None None
11 329856455932364756479133574012727079906 lr-regularization-1.4e-02 2026-05-27T07:59:21.474669+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.178052 0.992379 0.120312 0.073737 None None None None None
12 12790112837799415491224872989446528369 lr-regularization-4.0e-02 2026-05-27T07:59:21.874487+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.128754 0.995872 0.120977 0.066205 None None None None None
13 256457119736808341817496702573720782744 lr-regularization-1.2e-01 2026-05-27T07:59:22.280348+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.098897 0.996189 0.136284 0.074866 None None None None None
14 10600963640072191759637782152006052600 lr-regularization-3.4e-01 2026-05-27T07:59:22.691288+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.083941 0.995872 0.124531 0.069589 None None None None None
15 188512052453481463715206434928113039338 lr-regularization-1.0e+00 2026-05-27T07:59:23.097988+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.080457 0.995554 0.126883 0.071788 None None None None None
16 313280988523725479988958801166690741906 lr-regularization-2.9e+00 2026-05-27T07:59:23.483237+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.089466 0.994601 0.116288 0.071801 None None None None None
17 139797029602366530085144210029418639913 lr-regularization-8.6e+00 2026-05-27T07:59:23.871149+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.104241 0.993649 0.119199 0.070794 None None None None None
18 324806226343292816414284855810191245469 lr-regularization-2.5e+01 2026-05-27T07:59:24.257902+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.121671 0.992379 0.119365 0.071102 None None None None None
19 306456581851611774278301759695704667115 lr-regularization-7.4e+01 2026-05-27T07:59:24.646868+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.142282 0.991426 0.119881 0.070795 None None None None None
20 245146307623671139999261302766137455442 lr-regularization-2.2e+02 2026-05-27T07:59:24.917254+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.162450 0.991426 0.077111 0.042141 None None None None None
21 282027601573083288322832643196977963132 lr-regularization-6.3e+02 2026-05-27T07:59:25.159756+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.204586 0.991108 0.078119 0.041098 None None None None None
22 138037448102193612206679638083219062629 lr-regularization-1.8e+03 2026-05-27T07:59:25.400235+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.291953 0.990473 0.079603 0.042939 None None None None None
23 121677214771911742771517337895787610609 lr-regularization-5.4e+03 2026-05-27T07:59:25.652044+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.471382 0.989838 0.084534 0.043277 None None None None None
24 154457705516942024331015364969730581866 lr-regularization-1.6e+04 2026-05-27T07:59:25.920765+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 0.796526 0.983169 0.094053 0.042422 None None None None None
25 144546556981004345707470729603841290914 lr-regularization-4.6e+04 2026-05-27T07:59:26.184830+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.133167 0.984757 0.096843 0.043191 None None None None None
26 196497950024616241038880694831102142712 lr-regularization-1.4e+05 2026-05-27T07:59:26.450619+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.229179 0.985551 0.096811 0.041906 None None None None None
27 109328361929574213298851959484156363177 lr-regularization-4.0e+05 2026-05-27T07:59:26.714024+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.276041 0.985869 0.095933 0.042468 None None None None None
28 330108745408851579067801943053500206367 lr-regularization-1.2e+06 2026-05-27T07:59:26.973371+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.447319 0.975865 0.093343 0.042523 None None None None None
29 205153643696139539283671099743102182057 lr-regularization-3.4e+06 2026-05-27T07:59:27.230801+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.448698 0.976500 0.090737 0.042536 None None None None None
30 264755494987473349840243633281080082399 lr-regularization-1.0e+07 2026-05-27T07:59:27.488791+00:00 LogisticRegression binary-classification estimator 9f4622fc73c9ccd9bc3725923827edeb None 1.897034 0.976183 0.090789 0.043725 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, '284093228217490968778865723131983556241') to (30, '264755494987473349840243633281080082399') 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.136284 0.124531 0.126883 0.116288
Predict time (s) 0.041241 0.042053 0.043687 0.042517


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