Skip to content

Commit dc1220e

Browse files
committed
update
1 parent 175e959 commit dc1220e

File tree

8 files changed

+217
-56
lines changed

8 files changed

+217
-56
lines changed

doc/api.rst

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ API
33

44
.. currentmodule:: skore
55

6-
*The API is currently work in progress and will be released soon, thank you for
7-
your patience!*
8-
96
This page lists all the public functions and classes of the ``skore``
107
package.
118

12-
The User Interface
13-
------------------
149

15-
These classes are meant for ``skore``'s UI.
10+
The ``skore`` UI
11+
----------------
12+
13+
These classes are meant for ``skore``'s user interface.
1614

1715
.. autosummary::
1816
:toctree: generated/
@@ -21,12 +19,21 @@ These classes are meant for ``skore``'s UI.
2119

2220
Project
2321

24-
``scikit-learn`` enhancement
25-
----------------------------
22+
.. autosummary::
23+
:toctree: generated/
24+
:template: function.rst
25+
:nosignatures:
2626

27-
These classes enhance ``scikit-learn``'s ones.
27+
load
28+
29+
The ``skore`` machine learning programming assistant
30+
----------------------------------------------------
31+
32+
These functions and classes enhance ``scikit-learn``'s ones.
2833

2934
.. autosummary::
3035
:toctree: generated/
31-
:template: class.rst
36+
:template: function.rst
3237
:nosignatures:
38+
39+
cross_validate
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
:mod:`skore`.cross_validate
2+
========================================
3+
4+
.. currentmodule:: skore
5+
6+
.. autofunction:: cross_validate
7+
8+
.. raw:: html
9+
10+
<div class="clearer"></div>

doc/generated/skore.load.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
:mod:`skore`.load
2+
==============================
3+
4+
.. currentmodule:: skore
5+
6+
.. autofunction:: load
7+
8+
.. raw:: html
9+
10+
<div class="clearer"></div>

doc/sg_execution_times.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Computation times
88
=================
9-
**00:00.769** total execution time for 2 files **from all galleries**:
9+
**00:02.306** total execution time for 2 files **from all galleries**:
1010

1111
.. container::
1212

@@ -32,9 +32,9 @@ Computation times
3232
* - Example
3333
- Time
3434
- Mem (MB)
35-
* - :ref:`sphx_glr_auto_examples_plot_02_basic_usage.py` (``../examples/plot_02_basic_usage.py``)
36-
- 00:00.632
37-
- 0.0
3835
* - :ref:`sphx_glr_auto_examples_plot_01_getting_started.py` (``../examples/plot_01_getting_started.py``)
39-
- 00:00.136
36+
- 00:02.306
37+
- 0.0
38+
* - :ref:`sphx_glr_auto_examples_plot_02_basic_usage.py` (``../examples/plot_02_basic_usage.py``)
39+
- 00:00.000
4040
- 0.0

doc/user_guide.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ User guide
77

88
*The User Guide is currently work in progress and will be released soon, thank
99
you for your patience!*
10+
11+
For now, please look into the ``Getting Started`` and ``Examples`` tab.

doc/user_guide/getting_started.rst

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
.. _getting_started:
2+
3+
Getting started with ``skore``
4+
==============================
5+
6+
This example builds on top of the :ref:`getting_started` guide.
7+
8+
``skore`` UI
9+
------------
10+
11+
This section provides a quick start to the ``skore`` UI, an open-source package that aims to enable data scientists to:
12+
13+
#. Store objects of different types from their Python code: python lists, ``scikit-learn`` fitted pipelines, ``plotly`` figures, and more.
14+
#. Track and visualize these stored objects on a user-friendly dashboard.
15+
#. Export the dashboard to a HTML file.
16+
17+
Initialize a Project and launch the UI
18+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19+
20+
From your shell, initialize a skore project, here named ``project``, that will be
21+
in your current working directory:
22+
23+
.. code:: console
24+
25+
python -m skore create "project"
26+
27+
This will create a ``skore`` project directory named ``project`` in the current
28+
directory.
29+
30+
From your shell (in the same directory), start the UI locally:
31+
32+
.. code:: console
33+
34+
python -m skore launch "project"
35+
36+
This will automatically open a browser at the UI's location.
37+
38+
Now that the project file exists, we can load it in our notebook so that we can
39+
read from and write to it:
40+
41+
.. code-block:: python
42+
43+
from skore import load
44+
45+
project = load("project.skore")
46+
47+
Storing some items
48+
------------------
49+
50+
Storing an integer:
51+
52+
.. code-block:: python
53+
54+
project.put("my_int", 3)
55+
56+
Here, the name of my stored item is ``my_int`` and the integer value is 3.
57+
58+
For a ``pandas`` data frame:
59+
60+
.. code-block:: python
61+
62+
import numpy as np
63+
import pandas as pd
64+
65+
my_df = pd.DataFrame(np.random.randn(3, 3))
66+
67+
project.put("my_df", my_df)
68+
69+
70+
For a ``matplotlib`` figure:
71+
72+
.. code-block:: python
73+
74+
import matplotlib.pyplot as plt
75+
76+
x = [0, 1, 2, 3, 4, 5]
77+
fig, ax = plt.subplots(figsize=(5, 3), layout="constrained")
78+
_ = ax.plot(x)
79+
80+
project.put("my_figure", fig)
81+
82+
For a ``scikit-learn`` fitted pipeline:
83+
84+
.. code-block:: python
85+
86+
from sklearn.datasets import load_diabetes
87+
from sklearn.linear_model import Lasso
88+
from sklearn.pipeline import Pipeline
89+
from sklearn.preprocessing import StandardScaler
90+
91+
diabetes = load_diabetes()
92+
X = diabetes.data[:150]
93+
y = diabetes.target[:150]
94+
my_pipeline = Pipeline(
95+
[("standard_scaler", StandardScaler()), ("lasso", Lasso(alpha=2))]
96+
)
97+
my_pipeline.fit(X, y)
98+
99+
project.put("my_fitted_pipeline", my_pipeline)
100+
101+
Back to the dashboard
102+
^^^^^^^^^^^^^^^^^^^^^
103+
#. On the top left, create a new ``View``.
104+
#. 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.
105+
106+
.. image:: https://raw.githubusercontent.com/sylvaincom/sylvaincom.github.io/master/files/probabl/skore/2024_10_14_skore_demo.gif
107+
:alt: Getting started with ``skore`` demo

examples/plot_01_getting_started.py

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Getting started with ``skore``
44
==============================
55
6-
This example builds on top of the :ref:`getting_started` guide.
6+
This example runs the `Getting started` guide.
77
88
``skore`` UI
99
------------
@@ -17,47 +17,54 @@
1717
Initialize a Project and launch the UI
1818
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1919
20-
From your shell, initialize a skore project, here named ``project``, that will be
21-
in your current working directory:
22-
23-
.. code:: console
24-
25-
python -m skore create "project"
26-
27-
This will create a ``skore`` project directory named ``project`` in the current
28-
directory.
29-
30-
From your shell (in the same directory), start the UI locally:
31-
32-
.. code:: console
20+
From your shell, initialize a skore project, here named ``my_project_gs``, that
21+
will be in your current working directory:
22+
"""
3323

34-
python -m skore launch "project"
24+
# %%
25+
import subprocess
3526

36-
This will automatically open a browser at the UI's location.
27+
# remove the project if it already exists
28+
subprocess.run("rm -rf my_project_gs.skore".split())
3729

38-
Now that the project file exists, we can load it in our notebook so that we can
39-
read from and write to it:
40-
"""
30+
# create the project
31+
subprocess.run("python3 -m skore create my_project_gs".split())
4132

4233
# %%
43-
# .. code-block:: python
34+
# This will create a ``skore`` project directory named ``my_project_gs`` in the
35+
# current directory.
36+
#
37+
# From your shell (in the same directory), start the UI locally:
4438
#
45-
# from skore import load
39+
# .. code:: console
4640
#
47-
# project = load("project.skore")
41+
# python -m skore launch "my_project_gs"
42+
#
43+
# This will automatically open a browser at the UI's location.
44+
#
45+
# Now that the project file exists, we can load it in our notebook so that we can
46+
# read from and write to it:
47+
48+
# %%
49+
from skore import load
50+
51+
my_project_gs = load("my_project_gs.skore")
4852

4953
# %%
5054
# Storing some items
51-
# ------------------
55+
# ^^^^^^^^^^^^^^^^^^
5256
#
5357
# Storing an integer:
54-
#
55-
# .. code-block:: python
56-
#
57-
# project.put("my_int", 3)
58-
#
58+
59+
# %%
60+
my_project_gs.put("my_int", 3)
61+
62+
# %%
5963
# Here, the name of my stored item is ``my_int`` and the integer value is 3.
6064

65+
# %%
66+
my_project_gs.get("my_int")
67+
6168
# %%
6269
# For a ``pandas`` data frame:
6370

@@ -66,12 +73,11 @@
6673
import pandas as pd
6774

6875
my_df = pd.DataFrame(np.random.randn(3, 3))
69-
my_df.head()
76+
77+
my_project_gs.put("my_df", my_df)
7078

7179
# %%
72-
# .. code-block:: python
73-
#
74-
# project.put("my_df", my_df)
80+
my_project_gs.get("my_df")
7581

7682
# %%
7783
# For a ``matplotlib`` figure:
@@ -83,10 +89,7 @@
8389
fig, ax = plt.subplots(figsize=(5, 3), layout="constrained")
8490
_ = ax.plot(x)
8591

86-
# %%
87-
# .. code-block:: python
88-
#
89-
# project.put("my_figure", fig)
92+
my_project_gs.put("my_figure", fig)
9093

9194
# %%
9295
# For a ``scikit-learn`` fitted pipeline:
@@ -105,11 +108,12 @@
105108
)
106109
my_pipeline.fit(X, y)
107110

111+
my_project_gs.put("my_fitted_pipeline", my_pipeline)
112+
113+
# %%
114+
my_project_gs.get("my_fitted_pipeline")
115+
108116
# %%
109-
# .. code-block:: python
110-
#
111-
# project.put("my_fitted_pipeline", my_pipeline)
112-
#
113117
# Back to the dashboard
114118
# ^^^^^^^^^^^^^^^^^^^^^
115119
#
@@ -118,4 +122,3 @@
118122
#
119123
# .. image:: https://raw.githubusercontent.com/sylvaincom/sylvaincom.github.io/master/files/probabl/skore/2024_10_14_skore_demo.gif
120124
# :alt: Getting started with ``skore`` demo
121-
#

examples/plot_02_basic_usage.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,25 @@
3131
sklearn.__version__
3232
plt.plot([0, 1, 2, 3], [0, 1, 2, 3])
3333
plt.show()
34+
35+
# %%
36+
import subprocess
37+
38+
subprocess.run("rm -rf my_project_doc.skore".split())
39+
subprocess.run("python3 -m skore create my_project_doc".split())
40+
41+
# %%
42+
from skore import load
43+
from sklearn import datasets, linear_model
44+
from skore.cross_validate import cross_validate
45+
46+
my_project_doc = load("my_project_doc")
47+
48+
diabetes = datasets.load_diabetes()
49+
X = diabetes.data[:150]
50+
y = diabetes.target[:150]
51+
lasso = linear_model.Lasso()
52+
53+
cv_results = cross_validate(lasso, X, y, cv=3, project=my_project_doc)
54+
55+
my_project_doc.get_item("cross_validation").plot

0 commit comments

Comments
 (0)