.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/integrations/plot_skore_hub_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_integrations_plot_skore_hub_project.py: .. _example_skore_hub_project: ======================================= Store and retrieve reports on Skore Hub ======================================= This example shows how to use :class:`~skore.Project` in **hub** mode: store reports remotely and inspect them. A key point is that :meth:`~skore.Project.summarize` returns a :class:`~skore.Summary` object that holds the metadata and metrics of every report. In Jupyter it renders as an interactive table with different views where you can filter and pick rows to build a query string; outside of Jupyter you can work with the underlying :class:`pandas.DataFrame` via its :meth:`~skore.Summary.frame` method. Examples -------- To run this example and push in your own Skore Hub workspace and project, you can run this example with the following command: .. code-block:: bash WORKSPACE= PROJECT= python plot_skore_hub_project.py In this gallery, we are going to push the different reports into a public workspace. .. GENERATED FROM PYTHON SOURCE LINES 31-36 `skore` can communicate with Skore Hub which serves two main purposes: storing and retrieving any reports that you created and a user-friendly interface for you to explore and compare models. First, we need to login to Skore Hub such that later we can push our reports to it. .. GENERATED FROM PYTHON SOURCE LINES 37-44 .. code-block:: Python from skore import login login(mode="hub") .. rst-class:: sphx-glr-script-out .. code-block:: none ╭───────────────────────────────── Login to Skore Hub ─────────────────────────────────╮ │ │ │ Successfully logged in, using API key. │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ .. GENERATED FROM PYTHON SOURCE LINES 79-81 To illustrate the integration with Skore Hub, we use a binary classification task where the goal is to predict whether a patient has a tumor or not. .. GENERATED FROM PYTHON SOURCE LINES 82-91 .. code-block:: Python import numpy as np import skrub from sklearn.datasets import load_breast_cancer X, y = load_breast_cancer(return_X_y=True, as_frame=True) labels = np.array(["no tumor", "tumor"], dtype=object) y = labels[y] skrub.TableReport(X) .. raw:: html

Please enable javascript

The skrub table reports need javascript to display correctly. If you are displaying a report in a Jupyter notebook and you see this message, you may need to re-execute the cell or to trust the notebook (button on the top right or "File > Trust notebook").



.. GENERATED FROM PYTHON SOURCE LINES 92-100 Store reports on Skore Hub ========================== On this problem, we use a logistic regression classifier with skrub's :func:`~skrub.tabular_pipeline` to preprocess the data if needed. To send several reports to Skore Hub, we send models with different regularization parameters. .. GENERATED FROM PYTHON SOURCE LINES 101-119 .. code-block:: Python from numpy import logspace from sklearn.linear_model import LogisticRegression from skore import Project, evaluate project = Project(name=PROJECT, mode="hub", workspace=WORKSPACE) for regularization in logspace(-3, 3, 5): project.put( f"lr-regularization-{regularization:.1e}", evaluate( skrub.tabular_pipeline(LogisticRegression(C=regularization)), X, y, splitter=0.2, pos_label="tumor", ), ) .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/skore/skore/skore/venv/lib/python3.14/site-packages/skore/_plugins/hub/artifact/environment.py:48: UserWarning: Package matplotlib_skore_scraper seems to be an editable or local install (loaded from outside site-packages). It will not be recorded in the inferred requirements. for requirement in infer() Putting lr-regularization-1.0e-03 0:00:16 Consult your report at https://skore.probabl.ai/skore/example-skore-hub-project-pull-3233/estimators/38954 /home/runner/work/skore/skore/skore/venv/lib/python3.14/site-packages/skore/_plugins/hub/artifact/environment.py:48: UserWarning: Package matplotlib_skore_scraper seems to be an editable or local install (loaded from outside site-packages). It will not be recorded in the inferred requirements. for requirement in infer() Putting lr-regularization-3.2e-02 0:00:14 Consult your report at https://skore.probabl.ai/skore/example-skore-hub-project-pull-3233/estimators/38955 /home/runner/work/skore/skore/skore/venv/lib/python3.14/site-packages/skore/_plugins/hub/artifact/environment.py:48: UserWarning: Package matplotlib_skore_scraper seems to be an editable or local install (loaded from outside site-packages). It will not be recorded in the inferred requirements. for requirement in infer() Putting lr-regularization-1.0e+00 0:00:14 Consult your report at https://skore.probabl.ai/skore/example-skore-hub-project-pull-3233/estimators/38956 /home/runner/work/skore/skore/skore/venv/lib/python3.14/site-packages/skore/_plugins/hub/artifact/environment.py:48: UserWarning: Package matplotlib_skore_scraper seems to be an editable or local install (loaded from outside site-packages). It will not be recorded in the inferred requirements. for requirement in infer() Putting lr-regularization-3.2e+01 0:00:14 Consult your report at https://skore.probabl.ai/skore/example-skore-hub-project-pull-3233/estimators/38957 /home/runner/work/skore/skore/skore/venv/lib/python3.14/site-packages/skore/_plugins/hub/artifact/environment.py:48: UserWarning: Package matplotlib_skore_scraper seems to be an editable or local install (loaded from outside site-packages). It will not be recorded in the inferred requirements. for requirement in infer() Putting lr-regularization-1.0e+03 0:00:14 Consult your report at https://skore.probabl.ai/skore/example-skore-hub-project-pull-3233/estimators/38958 .. GENERATED FROM PYTHON SOURCE LINES 120-129 Retrieve report stored on Skore Hub =================================== Retrieving a report on Skore Hub is similar to retrieving a report in local mode. :meth:`~skore.Project.summarize` returns a :class:`~skore.Summary` object. In a Jupyter environment it renders as an interactive table where you can filter rows and pick reports across the different views; the selection produces a query string ready to pass to :meth:`~skore.Summary.query`. .. GENERATED FROM PYTHON SOURCE LINES 129-132 .. code-block:: Python summary = project.summarize() summary .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 133-135 To work with the underlying table (e.g. in scripts or when you prefer a :class:`pandas.DataFrame`), use the :meth:`~skore.Summary.frame` method: .. GENERATED FROM PYTHON SOURCE LINES 136-138 .. code-block:: Python summary.frame() .. raw:: html
report_id key date learner report_type dataset log_loss roc_auc fit_time predict_time
id
0 skore:report:estimator:38954 01a039bc-1d80-7299-9ba8-5ad6f8e2701d lr-regularization-1.0e-03 2026-08-25 16:24:02.264997+00:00 LogisticRegression estimator 7887e234e3f622242e475e3da0cb5837 0.406397 0.987298 0.095063 0.042820
1 skore:report:estimator:38955 01a039bc-62dc-76e9-96aa-b0998850161b lr-regularization-3.2e-02 2026-08-25 16:24:16.929400+00:00 LogisticRegression estimator 7887e234e3f622242e475e3da0cb5837 0.137499 0.995237 0.081301 0.042117
2 skore:report:estimator:38956 01a039bc-9c1d-7525-8cb7-7628ceb266c4 lr-regularization-1.0e+00 2026-08-25 16:24:31.499361+00:00 LogisticRegression estimator 7887e234e3f622242e475e3da0cb5837 0.080457 0.995554 0.081879 0.041815
3 skore:report:estimator:38957 01a039bc-d4da-73f9-ae48-e7c0b57cac51 lr-regularization-3.2e+01 2026-08-25 16:24:46.248244+00:00 LogisticRegression estimator 7887e234e3f622242e475e3da0cb5837 0.127250 0.992061 0.084524 0.042444
4 skore:report:estimator:38958 01a039bd-0f8e-71a5-a4be-e5620270cbdb lr-regularization-1.0e+03 2026-08-25 16:25:00.782039+00:00 LogisticRegression estimator 7887e234e3f622242e475e3da0cb5837 0.245632 0.990314 0.090729 0.041758


.. GENERATED FROM PYTHON SOURCE LINES 139-141 Basically, our summary contains metadata related to various information that we need to quickly help filtering the reports. .. GENERATED FROM PYTHON SOURCE LINES 142-144 .. code-block:: Python summary.frame().info() .. rst-class:: sphx-glr-script-out .. code-block:: none MultiIndex: 5 entries, (0, 'skore:report:estimator:38954') to (4, 'skore:report:estimator:38958') Data columns (total 10 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 report_id 5 non-null object 1 key 5 non-null string 2 date 5 non-null datetime64[ns, UTC] 3 learner 5 non-null category 4 report_type 5 non-null string 5 dataset 5 non-null string 6 log_loss 5 non-null float64 7 roc_auc 5 non-null float64 8 fit_time 5 non-null float64 9 predict_time 5 non-null float64 dtypes: category(1), datetime64[ns, UTC](1), float64(4), object(1), string(3) memory usage: 894.0+ bytes .. GENERATED FROM PYTHON SOURCE LINES 145-147 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 148-150 .. code-block:: Python summary.query("log_loss < 0.2").frame()["key"].tolist() .. rst-class:: sphx-glr-script-out .. code-block:: none ['lr-regularization-3.2e-02', 'lr-regularization-1.0e+00', 'lr-regularization-3.2e+01'] .. GENERATED FROM PYTHON SOURCE LINES 151-154 Use :meth:`~skore.Summary.compare` to load the corresponding reports from the project (optionally after filtering the summary). Passing ``return_as="report"`` returns a :class:`~skore.ComparisonReport` built from those reports. .. GENERATED FROM PYTHON SOURCE LINES 155-158 .. code-block:: Python reports = summary.query("log_loss < 0.2").compare(return_as="report") len(reports.reports_) .. rst-class:: sphx-glr-script-out .. code-block:: none 3 .. GENERATED FROM PYTHON SOURCE LINES 159-161 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 162-164 .. code-block:: Python reports.metrics.summarize().frame() .. raw:: html
estimator LogisticRegression_1 LogisticRegression_2 LogisticRegression_3
metric
accuracy 0.956140 0.964912 0.947368
precision 0.930556 0.970149 0.955224
recall 1.000000 0.970149 0.955224
roc_auc 0.995237 0.995554 0.992061
log_loss 0.137499 0.080457 0.127250
brier_score 0.035253 0.025149 0.029948
fit_time 0.081301 0.081879 0.084524
predict_time 0.041698 0.041700 0.042028


.. GENERATED FROM PYTHON SOURCE LINES 165-167 .. code-block:: Python _ = reports.metrics.roc().plot(subplot_by=None) .. image-sg:: /auto_examples/integrations/images/sphx_glr_plot_skore_hub_project_001.png :alt: ROC Curve Positive label: tumor Data source: Test set :srcset: /auto_examples/integrations/images/sphx_glr_plot_skore_hub_project_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 168-173 Conclusion ========== Skore Hub provides a user-friendly interface for you to explore and compare models. You can easily store reports created using Skore. .. rst-class:: sphx-glr-timing **Total running time of the script:** (1 minutes 26.866 seconds) .. _sphx_glr_download_auto_examples_integrations_plot_skore_hub_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_hub_project.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_skore_hub_project.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_skore_hub_project.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_