Skip to content

Commit bba1990

Browse files
committed
Add html content from sphinx
1 parent 40d41cf commit bba1990

File tree

100 files changed

+16883
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+16883
-0
lines changed

docs/latest/.buildinfo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: 064d3c6f5318632d4336e957c486b0de
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/latest/.nojekyll

Whitespace-only changes.
Binary file not shown.
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
"""
2+
=================================
3+
1) Getting started with ``skore``
4+
=================================
5+
6+
This example runs 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 ``my_project_gs``, that
21+
will be in your current working directory:
22+
"""
23+
24+
# %%
25+
import subprocess
26+
27+
# remove the project if it already exists
28+
subprocess.run("rm -rf my_project_gs.skore".split())
29+
30+
# create the project
31+
subprocess.run("python3 -m skore create my_project_gs".split())
32+
33+
# %%
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:
38+
#
39+
# .. code:: console
40+
#
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")
52+
53+
# %%
54+
# Storing some items
55+
# ^^^^^^^^^^^^^^^^^^
56+
#
57+
# Storing an integer:
58+
59+
# %%
60+
my_project_gs.put("my_int", 3)
61+
62+
# %%
63+
# Here, the name of my stored item is ``my_int`` and the integer value is 3.
64+
65+
# %%
66+
my_project_gs.get("my_int")
67+
68+
# %%
69+
# For a ``pandas`` data frame:
70+
71+
# %%
72+
import numpy as np
73+
import pandas as pd
74+
75+
my_df = pd.DataFrame(np.random.randn(3, 3))
76+
77+
my_project_gs.put("my_df", my_df)
78+
79+
# %%
80+
my_project_gs.get("my_df")
81+
82+
# %%
83+
# For a ``matplotlib`` figure:
84+
85+
# %%
86+
import matplotlib.pyplot as plt
87+
88+
x = [0, 1, 2, 3, 4, 5]
89+
fig, ax = plt.subplots(figsize=(5, 3), layout="constrained")
90+
_ = ax.plot(x)
91+
92+
my_project_gs.put("my_figure", fig)
93+
94+
# %%
95+
# For a ``scikit-learn`` fitted pipeline:
96+
97+
# %%
98+
from sklearn.datasets import load_diabetes
99+
from sklearn.linear_model import Lasso
100+
from sklearn.pipeline import Pipeline
101+
from sklearn.preprocessing import StandardScaler
102+
103+
diabetes = load_diabetes()
104+
X = diabetes.data[:150]
105+
y = diabetes.target[:150]
106+
my_pipeline = Pipeline(
107+
[("standard_scaler", StandardScaler()), ("lasso", Lasso(alpha=2))]
108+
)
109+
my_pipeline.fit(X, y)
110+
111+
my_project_gs.put("my_fitted_pipeline", my_pipeline)
112+
113+
# %%
114+
my_project_gs.get("my_fitted_pipeline")
115+
116+
# %%
117+
# Back to the dashboard
118+
# ^^^^^^^^^^^^^^^^^^^^^
119+
#
120+
# #. On the top left, create a new ``View``.
121+
# #. 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.
122+
#
123+
# .. image:: https://raw.githubusercontent.com/sylvaincom/sylvaincom.github.io/master/files/probabl/skore/2024_10_14_skore_demo.gif
124+
# :alt: Getting started with ``skore`` demo
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"\n# 3) Using ``skore``'s cross validate\n\nThis example illustrates the use of :func:`~skore.cross_validate`.\n"
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": null,
13+
"metadata": {
14+
"collapsed": false
15+
},
16+
"outputs": [],
17+
"source": [
18+
"import subprocess\n\n# remove the project if it already exists\nsubprocess.run(\"rm -rf my_project_cv.skore\".split())\n\n# create the project\nsubprocess.run(\"python3 -m skore create my_project_cv\".split())"
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": null,
24+
"metadata": {
25+
"collapsed": false
26+
},
27+
"outputs": [],
28+
"source": [
29+
"from skore import load\n\nmy_project_gs = load(\"my_project_cv.skore\")"
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": null,
35+
"metadata": {
36+
"collapsed": false
37+
},
38+
"outputs": [],
39+
"source": [
40+
"from sklearn import datasets, linear_model\nfrom skore.cross_validate import cross_validate\n\ndiabetes = datasets.load_diabetes()\nX = diabetes.data[:150]\ny = diabetes.target[:150]\nlasso = linear_model.Lasso()\n\ncv_results = cross_validate(lasso, X, y, cv=3, project=my_project_gs)\n\nmy_project_gs.get_item(\"cross_validation\").plot"
41+
]
42+
}
43+
],
44+
"metadata": {
45+
"kernelspec": {
46+
"display_name": "Python 3",
47+
"language": "python",
48+
"name": "python3"
49+
},
50+
"language_info": {
51+
"codemirror_mode": {
52+
"name": "ipython",
53+
"version": 3
54+
},
55+
"file_extension": ".py",
56+
"mimetype": "text/x-python",
57+
"name": "python",
58+
"nbconvert_exporter": "python",
59+
"pygments_lexer": "ipython3",
60+
"version": "3.12.3"
61+
}
62+
},
63+
"nbformat": 4,
64+
"nbformat_minor": 0
65+
}

0 commit comments

Comments
 (0)