Skip to content

Commit 899dc7f

Browse files
committed
Update plot_1_getting_started.py
1 parent 15f05c5 commit 899dc7f

File tree

1 file changed

+82
-19
lines changed

1 file changed

+82
-19
lines changed

examples/plot_1_getting_started.py

Lines changed: 82 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Getting started with ``skore``
44
==============================
55
6-
*This example is work in progress!*
6+
This example builds on top of the :ref:`getting_started` guide.
77
88
This guide provides a quick start to ``skore``, an open-source package that aims to enable data scientists to:
99
@@ -36,22 +36,85 @@
3636
Now that the project file exists, we can load it in our notebook so that we can
3737
read from and write to it:
3838
39-
.. code-block:: python
40-
41-
from skore import load
42-
43-
project = load("project.skore")
44-
45-
Storing some items
46-
------------------
47-
48-
This will automatically open a browser at the UI's location:
49-
50-
**CONTINUE WORKING HERE**
51-
52-
#. On the top left, create a new ``View``.
53-
#. From the ``Elements`` section on the bottom left, you can add stored items to this view, either by double-cliking on them or by doing drag-and-drop.
54-
55-
.. image:: https://raw.githubusercontent.com/sylvaincom/sylvaincom.github.io/master/files/probabl/skore/2024_10_14_skore_demo.gif
56-
:alt: Getting started with ``skore`` demo
5739
"""
40+
41+
# %%
42+
# .. code-block:: python
43+
#
44+
# from skore import load
45+
#
46+
# project = load("project.skore")
47+
48+
# %%
49+
# Storing some items
50+
# ------------------
51+
#
52+
# Storing an integer:
53+
#
54+
# .. code-block:: python
55+
#
56+
# project.put("my_int", 3)
57+
#
58+
# Here, the name of my stored item is ``my_int`` and the integer value is 3.
59+
60+
# %%
61+
# For a ``pandas`` data frame:
62+
63+
# %%
64+
import numpy as np
65+
import pandas as pd
66+
67+
my_df = pd.DataFrame(np.random.randn(3, 3))
68+
my_df.head()
69+
70+
# %%
71+
# .. code-block:: python
72+
#
73+
# project.put("my_df", my_df)
74+
75+
# %%
76+
# For a ``matplotlib`` figure:
77+
78+
# %%
79+
import matplotlib.pyplot as plt
80+
81+
x = [0, 1, 2, 3, 4, 5]
82+
fig, ax = plt.subplots(figsize=(5, 3), layout="constrained")
83+
_ = ax.plot(x)
84+
85+
# %%
86+
# .. code-block:: python
87+
#
88+
# project.put("my_figure", fig)
89+
90+
# %%
91+
# For a ``scikit-learn`` fitted pipeline:
92+
93+
# %%
94+
from sklearn.datasets import load_diabetes
95+
from sklearn.linear_model import Lasso
96+
from sklearn.pipeline import Pipeline
97+
from sklearn.preprocessing import StandardScaler
98+
99+
diabetes = load_diabetes()
100+
X = diabetes.data[:150]
101+
y = diabetes.target[:150]
102+
my_pipeline = Pipeline(
103+
[("standard_scaler", StandardScaler()), ("lasso", Lasso(alpha=2))]
104+
)
105+
my_pipeline.fit(X, y)
106+
107+
# %%
108+
# .. code-block:: python
109+
#
110+
# project.put("my_fitted_pipeline", my_pipeline)
111+
#
112+
# Back to the dashboard
113+
# ---------------------
114+
#
115+
# #. On the top left, create a new ``View``.
116+
# #. From the ``Elements`` section on the bottom left, you can add stored items to this view, either by double-cliking on them or by doing drag-and-drop.
117+
#
118+
# .. image:: https://raw.githubusercontent.com/sylvaincom/sylvaincom.github.io/master/files/probabl/skore/2024_10_14_skore_demo.gif
119+
# :alt: Getting started with ``skore`` demo
120+
#

0 commit comments

Comments
 (0)