|
3 | 3 | Getting started with ``skore`` |
4 | 4 | ============================== |
5 | 5 |
|
6 | | -This example builds on top of the :ref:`getting_started` guide. |
| 6 | +This example runs the `Getting started` guide. |
7 | 7 |
|
8 | 8 | ``skore`` UI |
9 | 9 | ------------ |
|
17 | 17 | Initialize a Project and launch the UI |
18 | 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
19 | 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 |
| 20 | +From your shell, initialize a skore project, here named ``my_project_gs``, that |
| 21 | +will be in your current working directory: |
| 22 | +""" |
33 | 23 |
|
34 | | - python -m skore launch "project" |
| 24 | +# %% |
| 25 | +import subprocess |
35 | 26 |
|
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()) |
37 | 29 |
|
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()) |
41 | 32 |
|
42 | 33 | # %% |
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: |
44 | 38 | # |
45 | | -# from skore import load |
| 39 | +# .. code:: console |
46 | 40 | # |
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") |
48 | 52 |
|
49 | 53 | # %% |
50 | 54 | # Storing some items |
51 | | -# ------------------ |
| 55 | +# ^^^^^^^^^^^^^^^^^^ |
52 | 56 | # |
53 | 57 | # 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 | +# %% |
59 | 63 | # Here, the name of my stored item is ``my_int`` and the integer value is 3. |
60 | 64 |
|
| 65 | +# %% |
| 66 | +my_project_gs.get("my_int") |
| 67 | + |
61 | 68 | # %% |
62 | 69 | # For a ``pandas`` data frame: |
63 | 70 |
|
|
66 | 73 | import pandas as pd |
67 | 74 |
|
68 | 75 | my_df = pd.DataFrame(np.random.randn(3, 3)) |
69 | | -my_df.head() |
| 76 | + |
| 77 | +my_project_gs.put("my_df", my_df) |
70 | 78 |
|
71 | 79 | # %% |
72 | | -# .. code-block:: python |
73 | | -# |
74 | | -# project.put("my_df", my_df) |
| 80 | +my_project_gs.get("my_df") |
75 | 81 |
|
76 | 82 | # %% |
77 | 83 | # For a ``matplotlib`` figure: |
|
83 | 89 | fig, ax = plt.subplots(figsize=(5, 3), layout="constrained") |
84 | 90 | _ = ax.plot(x) |
85 | 91 |
|
86 | | -# %% |
87 | | -# .. code-block:: python |
88 | | -# |
89 | | -# project.put("my_figure", fig) |
| 92 | +my_project_gs.put("my_figure", fig) |
90 | 93 |
|
91 | 94 | # %% |
92 | 95 | # For a ``scikit-learn`` fitted pipeline: |
|
105 | 108 | ) |
106 | 109 | my_pipeline.fit(X, y) |
107 | 110 |
|
| 111 | +my_project_gs.put("my_fitted_pipeline", my_pipeline) |
| 112 | + |
| 113 | +# %% |
| 114 | +my_project_gs.get("my_fitted_pipeline") |
| 115 | + |
108 | 116 | # %% |
109 | | -# .. code-block:: python |
110 | | -# |
111 | | -# project.put("my_fitted_pipeline", my_pipeline) |
112 | | -# |
113 | 117 | # Back to the dashboard |
114 | 118 | # ^^^^^^^^^^^^^^^^^^^^^ |
115 | 119 | # |
|
118 | 122 | # |
119 | 123 | # .. image:: https://raw.githubusercontent.com/sylvaincom/sylvaincom.github.io/master/files/probabl/skore/2024_10_14_skore_demo.gif |
120 | 124 | # :alt: Getting started with ``skore`` demo |
121 | | -# |
|
0 commit comments