diff --git a/docs/latest/.buildinfo b/docs/latest/.buildinfo new file mode 100644 index 000000000..ba4af92a8 --- /dev/null +++ b/docs/latest/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file records the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 064d3c6f5318632d4336e957c486b0de +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/latest/.nojekyll b/docs/latest/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/docs/latest/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip b/docs/latest/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip new file mode 100644 index 000000000..fbf5aa355 Binary files /dev/null and b/docs/latest/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip differ diff --git a/docs/latest/_downloads/3feb988b860c59c9cee8450bd29651e5/plot_01_getting_started.py b/docs/latest/_downloads/3feb988b860c59c9cee8450bd29651e5/plot_01_getting_started.py new file mode 100644 index 000000000..ebfb42e17 --- /dev/null +++ b/docs/latest/_downloads/3feb988b860c59c9cee8450bd29651e5/plot_01_getting_started.py @@ -0,0 +1,124 @@ +""" +================================= +1) Getting started with ``skore`` +================================= + +This example runs the :ref:`getting_started` guide. + +``skore`` UI +------------ + +This section provides a quick start to the ``skore`` UI, an open-source package that aims to enable data scientists to: + +#. Store objects of different types from their Python code: python lists, ``scikit-learn`` fitted pipelines, ``plotly`` figures, and more. +#. Track and visualize these stored objects on a user-friendly dashboard. +#. Export the dashboard to a HTML file. + +Initialize a Project and launch the UI +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +From your shell, initialize a skore project, here named ``my_project_gs``, that +will be in your current working directory: +""" + +# %% +import subprocess + +# remove the project if it already exists +subprocess.run("rm -rf my_project_gs.skore".split()) + +# create the project +subprocess.run("python3 -m skore create my_project_gs".split()) + +# %% +# This will create a ``skore`` project directory named ``my_project_gs`` in the +# current directory. +# +# From your shell (in the same directory), start the UI locally: +# +# .. code:: console +# +# python -m skore launch "my_project_gs" +# +# This will automatically open a browser at the UI's location. +# +# Now that the project file exists, we can load it in our notebook so that we can +# read from and write to it: + +# %% +from skore import load + +my_project_gs = load("my_project_gs.skore") + +# %% +# Storing some items +# ^^^^^^^^^^^^^^^^^^ +# +# Storing an integer: + +# %% +my_project_gs.put("my_int", 3) + +# %% +# Here, the name of my stored item is ``my_int`` and the integer value is 3. + +# %% +my_project_gs.get("my_int") + +# %% +# For a ``pandas`` data frame: + +# %% +import numpy as np +import pandas as pd + +my_df = pd.DataFrame(np.random.randn(3, 3)) + +my_project_gs.put("my_df", my_df) + +# %% +my_project_gs.get("my_df") + +# %% +# For a ``matplotlib`` figure: + +# %% +import matplotlib.pyplot as plt + +x = [0, 1, 2, 3, 4, 5] +fig, ax = plt.subplots(figsize=(5, 3), layout="constrained") +_ = ax.plot(x) + +my_project_gs.put("my_figure", fig) + +# %% +# For a ``scikit-learn`` fitted pipeline: + +# %% +from sklearn.datasets import load_diabetes +from sklearn.linear_model import Lasso +from sklearn.pipeline import Pipeline +from sklearn.preprocessing import StandardScaler + +diabetes = load_diabetes() +X = diabetes.data[:150] +y = diabetes.target[:150] +my_pipeline = Pipeline( + [("standard_scaler", StandardScaler()), ("lasso", Lasso(alpha=2))] +) +my_pipeline.fit(X, y) + +my_project_gs.put("my_fitted_pipeline", my_pipeline) + +# %% +my_project_gs.get("my_fitted_pipeline") + +# %% +# Back to the dashboard +# ^^^^^^^^^^^^^^^^^^^^^ +# +# #. On the top left, create a new ``View``. +# #. 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. +# +# .. image:: https://raw.githubusercontent.com/sylvaincom/sylvaincom.github.io/master/files/probabl/skore/2024_10_14_skore_demo.gif +# :alt: Getting started with ``skore`` demo diff --git a/docs/latest/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip b/docs/latest/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip new file mode 100644 index 000000000..9d3f3d16e Binary files /dev/null and b/docs/latest/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip differ diff --git a/docs/latest/_downloads/8b537b46e9e0a388f6e4838262a7f9fd/plot_02_basic_usage.zip b/docs/latest/_downloads/8b537b46e9e0a388f6e4838262a7f9fd/plot_02_basic_usage.zip new file mode 100644 index 000000000..48e4f74b1 Binary files /dev/null and b/docs/latest/_downloads/8b537b46e9e0a388f6e4838262a7f9fd/plot_02_basic_usage.zip differ diff --git a/docs/latest/_downloads/97b4b84f5410e1134b3cbe5e4682d2a1/plot_01_getting_started.zip b/docs/latest/_downloads/97b4b84f5410e1134b3cbe5e4682d2a1/plot_01_getting_started.zip new file mode 100644 index 000000000..ebafdeceb Binary files /dev/null and b/docs/latest/_downloads/97b4b84f5410e1134b3cbe5e4682d2a1/plot_01_getting_started.zip differ diff --git a/docs/latest/_downloads/9825adffd8a0e006b517b57261e52107/plot_03_cross_validate.ipynb b/docs/latest/_downloads/9825adffd8a0e006b517b57261e52107/plot_03_cross_validate.ipynb new file mode 100644 index 000000000..09b73443e --- /dev/null +++ b/docs/latest/_downloads/9825adffd8a0e006b517b57261e52107/plot_03_cross_validate.ipynb @@ -0,0 +1,65 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n# 3) Using ``skore``'s cross validate\n\nThis example illustrates the use of :func:`~skore.cross_validate`.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "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())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "from skore import load\n\nmy_project_gs = load(\"my_project_cv.skore\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "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" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.3" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file diff --git a/docs/latest/_downloads/aa82e1dec70e24e3e1f1a2f4a1a5d48b/plot_02_basic_usage.py b/docs/latest/_downloads/aa82e1dec70e24e3e1f1a2f4a1a5d48b/plot_02_basic_usage.py new file mode 100644 index 000000000..d507b1506 --- /dev/null +++ b/docs/latest/_downloads/aa82e1dec70e24e3e1f1a2f4a1a5d48b/plot_02_basic_usage.py @@ -0,0 +1,352 @@ +""" +=========================== +2) Basic usage of ``skore`` +=========================== + +This example complements the `Getting started with skore` example. +""" + +# %% +# ``skore`` UI +# ------------ + +# %% +import altair as alt +import io +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd +import plotly.express as px +import PIL + +from sklearn.datasets import load_diabetes +from sklearn.linear_model import Lasso +from sklearn.pipeline import Pipeline +from sklearn.preprocessing import StandardScaler + +from skore import load +from skore.item import MediaItem + +# %% +# Initialize a Project and launch the UI +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +# %% +import subprocess + +# remove the project if it already exists +subprocess.run("rm -rf my_project_bu.skore".split()) + +# create the project +subprocess.run("python3 -m skore create my_project_bu".split()) + + +# %% +from skore import load + +my_project_gs = load("my_project_gs.skore") + + +# %% +# Storing an integer +# ^^^^^^^^^^^^^^^^^^ +# +# Now, let us store our first object, for example an integer: + +# %% +my_project_gs.put("my_int", 3) + +# %% +# Here, the name of my object is ``my_int`` and the integer value is 3. +# +# You can read it from the project: + +# %% +my_project_gs.get("my_int") + +# %% +# Careful; like in a traditional Python dictionary, the `put` method will *overwrite* past data if you use a key which already exists! + +# %% +my_project_gs.put("my_int", 30_000) + +# %% +# Let us check the updated value: + +# %% +my_project_gs.get("my_int") + +# %% +# By using the `delete_item` method, you can also delete an object so that your `skore` UI does not become cluttered: + +# %% +my_project_gs.put("my_int_2", 10) + +# %% +my_project_gs.delete_item("my_int_2") + +# %% +# You can use `my_project_gs.list_item_keys` to display all the keys in your project: + +# %% +my_project_gs.list_item_keys() + +# %% +# ### Storing a string + +# %% +# We just stored a integer, now let us store some text using strings! + +# %% +my_project_gs.put("my_string", "Hello world!") + +# %% +my_project_gs.get("my_string") + +# %% +# ``my_project_gs.get`` infers the type of the inserted object by default. For example, strings are assumed to be in Markdown format. Hence, you can customize the display of your text: + +# %% +my_project_gs.put( + "my_string_2", + ( + """Hello world!, **bold**, *italic*, `code` + +```python +def my_func(x): + return x+2 +``` +""" + ), +) + +# %% +# Moreover, you can also explicitly tell `skore` the media type of an object, for example in HTML: + +# %% +# Note: we use ``put_item`` instead of ``put``: +my_project_gs.put_item( + "my_string_3", + MediaItem.factory( + "
skore
allows data scientists to create tracking and visualizations from their Python code. This HTML document is actually a skore report generated using the 01_basic_usage.ipynb
example notebook then exported (into HTML)!
", +) + +# %% +my_project_gs.put( + "my_comment_2", + "
skore
allows data scientists to create tracking and visualizations from their Python code. This HTML document is actually a skore report generated using the 01_basic_usage.ipynb
example notebook then exported (into HTML)!
\",\n)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "my_project_gs.put(\n \"my_comment_2\",\n \"
skore
allows data scientists to create tracking and visualizations from their Python code. This HTML document is actually a skore report generated using the 01_basic_usage.ipynb
example notebook then exported (into HTML)!
", + ) + + + + + + + + +.. GENERATED FROM PYTHON SOURCE LINES 331-336 + +.. code-block:: Python + + my_project_gs.put( + "my_comment_2", + "