-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 412-user-guide-and-api-documentation
- Loading branch information
Showing
6 changed files
with
375 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,3 +180,7 @@ doc/auto_examples/ | |
auto-save-list | ||
tramp | ||
.\#* | ||
|
||
# Sphinx documentation | ||
doc/_build/ | ||
doc/auto_examples/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "0", | ||
"metadata": {}, | ||
"source": [ | ||
"# Getting started with `skore`\n", | ||
"\n", | ||
"This guide provides a quick start to `skore`, an open-source package that aims at enable data scientist to:\n", | ||
"1. Store objects of different types from their Python code: python lists, `scikit-learn` fitted pipelines, `plotly` figures, and more.\n", | ||
"2. **Track** and **visualize** these stored objects on a user-friendly dashboard.\n", | ||
"3. Export the dashboard to a HTML file." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "1", | ||
"metadata": {}, | ||
"source": [ | ||
"## Initialize a Project and launch the UI\n", | ||
"\n", | ||
"From your shell, initialize a `skore` project, here named `project.skore`, that will be in your current working directory:\n", | ||
"```bash\n", | ||
"python -m skore create \"project.skore\"\n", | ||
"```\n", | ||
"This will create a skore project directory named `project.skore` in the current directory.\n", | ||
"\n", | ||
"From your shell (in the same directory), start the UI locally:\n", | ||
"```bash\n", | ||
"python -m skore launch \"project.skore\"\n", | ||
"```\n", | ||
"This will automatically open a browser at the UI's location.\n", | ||
"\n", | ||
"Now that the project file exists, we can load it in our notebook so that we can read from and write to it:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "2", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from skore import load\n", | ||
"\n", | ||
"project = load(\"project.skore\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "3", | ||
"metadata": {}, | ||
"source": [ | ||
"## Storing some items" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "4", | ||
"metadata": {}, | ||
"source": [ | ||
"Storing an integer:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"project.put(\"my_int\", 3)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "6", | ||
"metadata": {}, | ||
"source": [ | ||
"Here, the name of my stored item is `my_int` and the integer value is 3." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "7", | ||
"metadata": {}, | ||
"source": [ | ||
"For a `pandas` data frame:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "8", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import pandas as pd\n", | ||
"\n", | ||
"my_df = pd.DataFrame(np.random.randn(3, 3))\n", | ||
"project.put(\"my_df\", my_df)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "9", | ||
"metadata": {}, | ||
"source": [ | ||
"for a `matplotlib` figure:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "10", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\n", | ||
"\n", | ||
"x = [0, 1, 2, 3, 4, 5]\n", | ||
"fig, ax = plt.subplots(figsize=(5, 3), layout=\"constrained\")\n", | ||
"ax.plot(x)\n", | ||
"project.put(\"my_figure\", fig)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "11", | ||
"metadata": {}, | ||
"source": [ | ||
"For a `scikit-learn` fitted pipeline:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "12", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from sklearn.datasets import load_diabetes\n", | ||
"from sklearn.linear_model import Lasso\n", | ||
"from sklearn.pipeline import Pipeline\n", | ||
"from sklearn.preprocessing import StandardScaler\n", | ||
"\n", | ||
"diabetes = load_diabetes()\n", | ||
"X = diabetes.data[:150]\n", | ||
"y = diabetes.target[:150]\n", | ||
"my_pipeline = Pipeline(\n", | ||
" [(\"standard_scaler\", StandardScaler()), (\"lasso\", Lasso(alpha=2))]\n", | ||
")\n", | ||
"my_pipeline.fit(X, y)\n", | ||
"project.put(\"my_fitted_pipeline\", my_pipeline)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "13", | ||
"metadata": {}, | ||
"source": [ | ||
"## Back to the dashboard\n", | ||
"\n", | ||
"1. On the top left, create a new `View`.\n", | ||
"2. 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." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "14", | ||
"metadata": {}, | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"jupytext": { | ||
"formats": "ipynb,py:percent" | ||
}, | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"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.7" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.