Getting started#
+We recommend first having a look at this example that serves as an overall and gentle +introduction to skore.
+diff --git a/.github/actions/sphinx/build/action.yml b/.github/actions/sphinx/build/action.yml index 74af5c68c..ee5d9ff05 100644 --- a/.github/actions/sphinx/build/action.yml +++ b/.github/actions/sphinx/build/action.yml @@ -1,4 +1,11 @@ name: Build sphinx documentation + +inputs: + SPHINX_VERSION: + required: true + SPHINX_RELEASE: + required: true + runs: using: composite steps: @@ -9,4 +16,7 @@ runs: python -m pip install '.[sphinx]' - working-directory: sphinx shell: bash - run: make html + run: > + SPHINX_VERSION=${{ inputs.SPHINX_VERSION }} + SPHINX_RELEASE=${{ inputs.SPHINX_RELEASE }} + make html diff --git a/.github/actions/sphinx/deploy/action.yml b/.github/actions/sphinx/deploy/action.yml index ecb5b8c37..e6118ee0f 100644 --- a/.github/actions/sphinx/deploy/action.yml +++ b/.github/actions/sphinx/deploy/action.yml @@ -1,19 +1,38 @@ name: Deploy sphinx documentation -permissions: - contents: write + +inputs: + CONFIGURATION: + required: true + ACTION: + required: false + default: sync + type: choice + options: + - copy + - sync + PROVIDER: + required: false + default: scaleway + BUCKET: + required: false + default: prod-probabl-skore + SOURCE: + required: true + DESTINATION: + required: true + runs: using: composite steps: - shell: bash run: | - rm -rf docs/latest - mv sphinx/build/html docs/latest + sudo apt-get update + sudo apt-get install -y rclone + - shell: bash + run: echo "${{ inputs.CONFIGURATION }}" > rclone.configuration - shell: bash run: | - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - git config commit.cleanup 'verbatim' - - git add docs/latest - git commit -m $'docs: Build documentation triggered by ${{ github.sha }}\n\n\nskip-checks:true' - git push + rclone --config rclone.configuration \ + ${{ inputs.ACTION }} \ + ${{ inputs.SOURCE }} \ + ${{ inputs.PROVIDER }}:${{ inputs.BUCKET }}/${{ inputs.DESTINATION }} diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index b602fc874..73b1a5e2f 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -1,5 +1,51 @@ name: Sphinx + +# **How it works** +# ================ +# +# After each __commit__ on the `main` branch, the documentation is built and deployed on the `S3:dev/` directory. +# After each __release__, the documentation is built and deployed to the `S3:version/` directory, the version being +# a subpart of the tag `MAJOR.MINOR.BUGFIX`: `MAJOR.MINOR`. +# +# For instance, with the following timeline: +# +# dev/ dev/ dev/ dev/ dev/ +# 0.1/ 0.2/ +# main -- x -- x -- x -- x -- x -- > +# | | +# tag 0.1 0.2 +# +# The S3 bucket looks like: +# . +# ├── 0.1/ +# ├── 0.2/ +# ├── dev/ +# ├── index.html +# └── versions.json +# +# **Q&A** +# ======= +# +# ### `dev/`, why? +# It contains the most up-to-date documentation, i.e. the documentation of code that is not released but committed on the main branch. +# +# ### Version the documentation on `MAJOR.MINOR, why not on `MAJOR`? +# Currently, we add new features at a minor level. This way, we can separate documentation between two features. +# +# ### Only on release (not on release-candidate), why? +# The release-candidates are documented in the `dev/` directory. We don't want to create noise with explicit directory for such tags. +# +# ### How to change an old version of the documentation? +# You can create tags wherever you want, i.e. on separate branches. +# For example, you can create a branch from an old tag (`0.1.5`), modify the documentation and create a new tag (`0.1.6`). +# The corresponding documentation will be automatically updated (`0.1`). +# +# **Side-notes** +# ============== +# +# Only the 10 latest versions are listed in sphinx version-switcher to avoid overloading, but the bucket remains unchanged. + on: pull_request: paths: @@ -17,22 +63,131 @@ on: - 'examples/**' - 'sphinx/**' - 'skore/**' + release: + types: [released] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - sphinx: + sphinx-version: runs-on: ubuntu-latest + outputs: + SPHINX_VERSION: ${{ steps.sphinx-version.outputs.SPHINX_VERSION }} + SPHINX_RELEASE: ${{ steps.sphinx-version.outputs.SPHINX_RELEASE }} + steps: + - shell: bash + id: sphinx-version + run: | + set -u + + if [[ "${GITHUB_EVENT_NAME}" != "release" ]]; then + echo "SPHINX_VERSION=dev" >> "${GITHUB_OUTPUT}" + echo "SPHINX_RELEASE=0.0.0+dev" >> "${GITHUB_OUTPUT}" + exit 0 + fi + + set -e + + if [[ "${GITHUB_REF_NAME}" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)?$ ]]; then + echo "SPHINX_VERSION=${BASH_REMATCH[1]}.${BASH_REMATCH[2]}" >> "${GITHUB_OUTPUT}" + echo "SPHINX_RELEASE=${GITHUB_REF_NAME}" >> "${GITHUB_OUTPUT}" + fi + + sphinx-build: + runs-on: ubuntu-latest + needs: sphinx-version steps: - uses: actions/checkout@v4 - with: - ssh-key: ${{ secrets.DEPLOY_KEY }} - uses: actions/setup-python@v5 with: python-version: '3.12' cache: 'pip' - uses: ./.github/actions/sphinx/build - - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - uses: ./.github/actions/sphinx/deploy + with: + SPHINX_VERSION: ${{ needs.sphinx-version.outputs.SPHINX_VERSION }} + SPHINX_RELEASE: ${{ needs.sphinx-version.outputs.SPHINX_RELEASE }} + - uses: actions/upload-artifact@v4 + with: + name: sphinx-html-artifact + path: sphinx/build/html/ + + sphinx-deploy-html: + runs-on: ubuntu-latest + if: ${{ (github.event_name == 'release') || (github.event_name == 'push' && github.ref == 'refs/heads/main') }} + needs: [sphinx-version, sphinx-build] + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: sphinx-html-artifact + path: html/ + - uses: ./.github/actions/sphinx/deploy + with: + CONFIGURATION: ${{ secrets.RCLONE_CONFIG_DOCS }} + SOURCE: html/ + DESTINATION: ${{ needs.sphinx-version.outputs.SPHINX_VERSION }}/ + + sphinx-deploy-root-files: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'release' }} + needs: [sphinx-version, sphinx-build, sphinx-deploy-html] + steps: + - uses: actions/checkout@v4 + - shell: python + run: | + import os + import requests + import operator + import json + + url = "https://skore.probabl.ai" + current = os.environ["CURRENT"] + + response = requests.get(f"{url}/versions.json") + response.raise_for_status() + + history = set(map(operator.itemgetter("version"), response.json())) - {"dev"} | {current} + history = sorted(history, key=lambda x: float(x), reverse=True)[:10] + + new = [ + { + "name": version, + "version": version, + "url": f"{url}/{version}/", + "preferred": i == 1, + } + for i, version in enumerate(["dev"] + history) + ] + + os.mkdir("artifacts") + + with open("artifacts/versions.json", "w", encoding="utf-8") as file: + json.dump(new, file, ensure_ascii=False, indent=4) + + with open("artifacts/index.html", "w", encoding="utf-8") as file: + file.write( + f""" +
+ + + """ + ) + env: + CURRENT: ${{ needs.sphinx-version.outputs.SPHINX_VERSION }} + - uses: ./.github/actions/sphinx/deploy + with: + CONFIGURATION: ${{ secrets.RCLONE_CONFIG_DOCS }} + ACTION: copy + SOURCE: artifacts/ + DESTINATION: + + sphinx-clean: + runs-on: ubuntu-latest + if: always() + needs: [sphinx-version, sphinx-build, sphinx-deploy-html, sphinx-deploy-root-files] + steps: + - uses: geekyeggo/delete-artifact@v5 + with: + name: sphinx-html-artifact diff --git a/docs/latest/_downloads/14e353ee268e214967a45032a868744b/plot_05_train_test_split.py b/docs/latest/_downloads/024736589b9c3fa37859d9272c9a8cdb/plot_02_train_test_split.py similarity index 100% rename from docs/latest/_downloads/14e353ee268e214967a45032a868744b/plot_05_train_test_split.py rename to docs/latest/_downloads/024736589b9c3fa37859d9272c9a8cdb/plot_02_train_test_split.py diff --git a/docs/latest/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip b/docs/latest/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip index e3930a598..6ce9108cc 100644 Binary files a/docs/latest/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip and b/docs/latest/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip differ diff --git a/docs/latest/_downloads/9825adffd8a0e006b517b57261e52107/plot_03_cross_validate.ipynb b/docs/latest/_downloads/09272384888d8342b36e27849f5a423b/plot_01_cross_validate.ipynb similarity index 100% rename from docs/latest/_downloads/9825adffd8a0e006b517b57261e52107/plot_03_cross_validate.ipynb rename to docs/latest/_downloads/09272384888d8342b36e27849f5a423b/plot_01_cross_validate.ipynb diff --git a/docs/latest/_downloads/b53d88bff5e11c5ed50d2a0f66cc5fb1/plot_03_cross_validate.py b/docs/latest/_downloads/4959241c3e7438e965030c696b8fe135/plot_01_cross_validate.py similarity index 100% rename from docs/latest/_downloads/b53d88bff5e11c5ed50d2a0f66cc5fb1/plot_03_cross_validate.py rename to docs/latest/_downloads/4959241c3e7438e965030c696b8fe135/plot_01_cross_validate.py diff --git a/docs/latest/_downloads/e97c5b0c37bdd66afd2a201f006613dd/plot_01_getting_started.ipynb b/docs/latest/_downloads/4b40eda73b3a29a34f59bbd8834fb5d8/plot_01_getting_started.ipynb similarity index 100% rename from docs/latest/_downloads/e97c5b0c37bdd66afd2a201f006613dd/plot_01_getting_started.ipynb rename to docs/latest/_downloads/4b40eda73b3a29a34f59bbd8834fb5d8/plot_01_getting_started.ipynb diff --git a/docs/latest/_downloads/ce85e1a88bd0b4fce657c932abde8d0d/plot_04_tracking_items.py b/docs/latest/_downloads/64023e9042dd6e8c819e3672ab30e7b3/plot_02_tracking_items.py similarity index 100% rename from docs/latest/_downloads/ce85e1a88bd0b4fce657c932abde8d0d/plot_04_tracking_items.py rename to docs/latest/_downloads/64023e9042dd6e8c819e3672ab30e7b3/plot_02_tracking_items.py diff --git a/docs/latest/_downloads/dafe7022153ade7f6466ced5b7bc6a6d/plot_03_cross_validate.zip b/docs/latest/_downloads/66d65b1172294c11e4127bb963835935/plot_01_cross_validate.zip similarity index 98% rename from docs/latest/_downloads/dafe7022153ade7f6466ced5b7bc6a6d/plot_03_cross_validate.zip rename to docs/latest/_downloads/66d65b1172294c11e4127bb963835935/plot_01_cross_validate.zip index 076ed4f8b..b0f3a02f2 100644 Binary files a/docs/latest/_downloads/dafe7022153ade7f6466ced5b7bc6a6d/plot_03_cross_validate.zip and b/docs/latest/_downloads/66d65b1172294c11e4127bb963835935/plot_01_cross_validate.zip differ diff --git a/docs/latest/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip b/docs/latest/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip index fa82a8141..82bf5c30a 100644 Binary files a/docs/latest/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip and b/docs/latest/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip differ diff --git a/docs/latest/_downloads/4b860fd94d1a8cca99a690486b997717/plot_05_train_test_split.ipynb b/docs/latest/_downloads/71bbf371dfb7015d24d94c208c08288b/plot_02_train_test_split.ipynb similarity index 100% rename from docs/latest/_downloads/4b860fd94d1a8cca99a690486b997717/plot_05_train_test_split.ipynb rename to docs/latest/_downloads/71bbf371dfb7015d24d94c208c08288b/plot_02_train_test_split.ipynb diff --git a/docs/latest/_downloads/3feb988b860c59c9cee8450bd29651e5/plot_01_getting_started.py b/docs/latest/_downloads/892f5cbeed7112a7009bfb2f5f6870e0/plot_01_getting_started.py similarity index 100% rename from docs/latest/_downloads/3feb988b860c59c9cee8450bd29651e5/plot_01_getting_started.py rename to docs/latest/_downloads/892f5cbeed7112a7009bfb2f5f6870e0/plot_01_getting_started.py diff --git a/docs/latest/_downloads/26cde164bdb63562f0a03fb130aaa53a/plot_02_overview_skore_project.zip b/docs/latest/_downloads/9730fbfa0227d4cbaee43dd3146ea016/plot_01_overview_skore_project.zip similarity index 98% rename from docs/latest/_downloads/26cde164bdb63562f0a03fb130aaa53a/plot_02_overview_skore_project.zip rename to docs/latest/_downloads/9730fbfa0227d4cbaee43dd3146ea016/plot_01_overview_skore_project.zip index 9cd28a6e5..e68ea1ff1 100644 Binary files a/docs/latest/_downloads/26cde164bdb63562f0a03fb130aaa53a/plot_02_overview_skore_project.zip and b/docs/latest/_downloads/9730fbfa0227d4cbaee43dd3146ea016/plot_01_overview_skore_project.zip differ diff --git a/docs/latest/_downloads/cdd7bc0df44925960cbfd8a4588515de/plot_05_train_test_split.zip b/docs/latest/_downloads/9ecad9d310c18cfcb34e6f41dc43832c/plot_02_train_test_split.zip similarity index 98% rename from docs/latest/_downloads/cdd7bc0df44925960cbfd8a4588515de/plot_05_train_test_split.zip rename to docs/latest/_downloads/9ecad9d310c18cfcb34e6f41dc43832c/plot_02_train_test_split.zip index 85846ff48..e254dd982 100644 Binary files a/docs/latest/_downloads/cdd7bc0df44925960cbfd8a4588515de/plot_05_train_test_split.zip and b/docs/latest/_downloads/9ecad9d310c18cfcb34e6f41dc43832c/plot_02_train_test_split.zip differ diff --git a/docs/latest/_downloads/b10f2525b5ecaf48aa269d4d66baefe0/plot_04_tracking_items.zip b/docs/latest/_downloads/a3a1956f20f72c86db7fe85f16458c1e/plot_02_tracking_items.zip similarity index 98% rename from docs/latest/_downloads/b10f2525b5ecaf48aa269d4d66baefe0/plot_04_tracking_items.zip rename to docs/latest/_downloads/a3a1956f20f72c86db7fe85f16458c1e/plot_02_tracking_items.zip index d715facd4..6e27b5a04 100644 Binary files a/docs/latest/_downloads/b10f2525b5ecaf48aa269d4d66baefe0/plot_04_tracking_items.zip and b/docs/latest/_downloads/a3a1956f20f72c86db7fe85f16458c1e/plot_02_tracking_items.zip differ diff --git a/docs/latest/_downloads/9b9c37c8a93d46bbd84e5f80dd1da442/plot_04_tracking_items.ipynb b/docs/latest/_downloads/a64f279aa9bc0515948c84c4a66b9486/plot_02_tracking_items.ipynb similarity index 100% rename from docs/latest/_downloads/9b9c37c8a93d46bbd84e5f80dd1da442/plot_04_tracking_items.ipynb rename to docs/latest/_downloads/a64f279aa9bc0515948c84c4a66b9486/plot_02_tracking_items.ipynb diff --git a/docs/latest/_downloads/c9799dfd1f6d1cf8a38654d09e5dad81/plot_02_overview_skore_project.py b/docs/latest/_downloads/a71f57e7bbc20e0ad1c7726f424ae7af/plot_01_overview_skore_project.py similarity index 100% rename from docs/latest/_downloads/c9799dfd1f6d1cf8a38654d09e5dad81/plot_02_overview_skore_project.py rename to docs/latest/_downloads/a71f57e7bbc20e0ad1c7726f424ae7af/plot_01_overview_skore_project.py diff --git a/docs/latest/_downloads/1fdf6cf5ecdefe8452c51e11c699128e/plot_02_overview_skore_project.ipynb b/docs/latest/_downloads/e1435ff93991741da29c534b3219bd7d/plot_01_overview_skore_project.ipynb similarity index 100% rename from docs/latest/_downloads/1fdf6cf5ecdefe8452c51e11c699128e/plot_02_overview_skore_project.ipynb rename to docs/latest/_downloads/e1435ff93991741da29c534b3219bd7d/plot_01_overview_skore_project.ipynb diff --git a/docs/latest/_downloads/97b4b84f5410e1134b3cbe5e4682d2a1/plot_01_getting_started.zip b/docs/latest/_downloads/eade513547915d5577faa974f7c36c1d/plot_01_getting_started.zip similarity index 98% rename from docs/latest/_downloads/97b4b84f5410e1134b3cbe5e4682d2a1/plot_01_getting_started.zip rename to docs/latest/_downloads/eade513547915d5577faa974f7c36c1d/plot_01_getting_started.zip index b6e1e022b..67f51dfae 100644 Binary files a/docs/latest/_downloads/97b4b84f5410e1134b3cbe5e4682d2a1/plot_01_getting_started.zip and b/docs/latest/_downloads/eade513547915d5577faa974f7c36c1d/plot_01_getting_started.zip differ diff --git a/docs/latest/_images/sphx_glr_plot_03_cross_validate_thumb.png b/docs/latest/_images/sphx_glr_plot_01_cross_validate_thumb.png similarity index 100% rename from docs/latest/_images/sphx_glr_plot_03_cross_validate_thumb.png rename to docs/latest/_images/sphx_glr_plot_01_cross_validate_thumb.png diff --git a/docs/latest/_images/sphx_glr_plot_01_getting_started_001.png b/docs/latest/_images/sphx_glr_plot_01_getting_started_001.png index a9fdf9744..95dc18a52 100644 Binary files a/docs/latest/_images/sphx_glr_plot_01_getting_started_001.png and b/docs/latest/_images/sphx_glr_plot_01_getting_started_001.png differ diff --git a/docs/latest/_images/sphx_glr_plot_02_overview_skore_project_001.png b/docs/latest/_images/sphx_glr_plot_01_overview_skore_project_001.png similarity index 99% rename from docs/latest/_images/sphx_glr_plot_02_overview_skore_project_001.png rename to docs/latest/_images/sphx_glr_plot_01_overview_skore_project_001.png index d53c802cc..dd7ded18f 100644 Binary files a/docs/latest/_images/sphx_glr_plot_02_overview_skore_project_001.png and b/docs/latest/_images/sphx_glr_plot_01_overview_skore_project_001.png differ diff --git a/docs/latest/_images/sphx_glr_plot_02_overview_skore_project_thumb.png b/docs/latest/_images/sphx_glr_plot_01_overview_skore_project_thumb.png similarity index 100% rename from docs/latest/_images/sphx_glr_plot_02_overview_skore_project_thumb.png rename to docs/latest/_images/sphx_glr_plot_01_overview_skore_project_thumb.png diff --git a/docs/latest/_images/sphx_glr_plot_04_tracking_items_thumb.png b/docs/latest/_images/sphx_glr_plot_02_tracking_items_thumb.png similarity index 100% rename from docs/latest/_images/sphx_glr_plot_04_tracking_items_thumb.png rename to docs/latest/_images/sphx_glr_plot_02_tracking_items_thumb.png diff --git a/docs/latest/_images/sphx_glr_plot_05_train_test_split_thumb.png b/docs/latest/_images/sphx_glr_plot_02_train_test_split_thumb.png similarity index 100% rename from docs/latest/_images/sphx_glr_plot_05_train_test_split_thumb.png rename to docs/latest/_images/sphx_glr_plot_02_train_test_split_thumb.png diff --git a/docs/latest/_sources/auto_examples/00_getting_started/index.rst.txt b/docs/latest/_sources/auto_examples/00_getting_started/index.rst.txt new file mode 100644 index 000000000..6cc17a494 --- /dev/null +++ b/docs/latest/_sources/auto_examples/00_getting_started/index.rst.txt @@ -0,0 +1,47 @@ + + +.. _sphx_glr_auto_examples_00_getting_started: + +Getting started +--------------- + +We recommend first having a look at this example that serves as an overall and gentle +introduction to skore. + + + +.. raw:: html + +column_0 | column_1 | column_2 | column_3 | column_4 |
---|---|---|---|---|
f64 | f64 | f64 | f64 | f64 |
0.828242 | 1.210976 | -1.651619 | -1.566458 | 1.141409 |
-1.257238 | -0.243915 | -1.164194 | -0.177233 | -0.944327 |
1.691511 | 0.65013 | -1.261572 | 0.493694 | -0.229308 |
0.512165 | -0.010404 | 0.185386 | 0.131988 | 1.89348 |
-0.928704 | -0.365251 | -0.512659 | -1.964944 | 0.827703 |
column_0 | column_1 | column_2 | column_3 | column_4 |
---|---|---|---|---|
f64 | f64 | f64 | f64 | f64 |
-2.016784 | -1.57834 | 0.486351 | -0.046798 | -0.196609 |
0.749376 | -0.055253 | 0.508111 | 1.474227 | -0.162663 |
0.352716 | -0.431617 | 0.08672 | 0.749166 | -0.229909 |
1.351604 | 1.239878 | 0.558278 | 0.617867 | 0.436303 |
2.137133 | 0.039924 | 0.165832 | 0.409878 | 1.445417 |
This getting started guide illustrates how to use skore and why:
Track and visualize your ML/DS results using skore’s Project
and UI.
Track and visualize your ML/DS results using skore’s Project
and UI.
Machine learning diagnostics: get assistance when developing your ML/DS projects.
Scikit-learn compatible skore.cross_validate()
and
-skore.train_test_split()
provide insights and checks on cross-validation
+
Scikit-learn compatible skore.cross_validate()
and
+skore.train_test_split()
provide insights and checks on cross-validation
and train-test-split.
A key feature of skore is its Project
that allows to store
+
A key feature of skore is its Project
that allows to store
items of many types then visualize them in a dashboard called the skore UI.
import skore
-my_project = skore.create("my_project", working_dir=temp_dir_path)
+my_project = skore.create("my_project", working_dir=temp_dir_path)
[11/29/24 16:48:41] <Logger skore.project.project (INFO)> Project create.py:148
+[12/02/24 07:55:31] <Logger skore.project.project (INFO)> Project create.py:148
file
'/tmp/sk
ore_exam
- ple_lfp6
- 7wcv/my_
+ ple_7jdu
+ 46nf/my_
project.
skore'
was
@@ -514,7 +526,7 @@ Creating and loading a skore project, and launching the skore UIimport skore
-my_project = skore.create("my_project")
+my_project = skore.create("my_project")
@@ -524,8 +536,8 @@ Creating and loading a skore project, and launching the skore UIput()
) some useful items in it.
-my_project.put("my_int", 3)
+directory) to add (put()
) some useful items in it.
+my_project.put("my_int", 3)
@@ -1059,21 +1071,21 @@ Skore project and storage: example of hyperparameter sweepplt.show()
-
+
Finally, we store some relevant information to our skore project, so that we
can visualize them later in the skore UI for example:
-my_project.put("my_gs_cv", gs_cv)
-my_project.put("my_df", df)
-my_project.put("my_fig", fig)
+my_project.put("my_gs_cv", gs_cv)
+my_project.put("my_df", df)
+my_project.put("my_fig", fig)
See also
For more information about the functionalities and the different types
-of items that we can store in a skore Project
,
-see Overview of the skore project.
+of items that we can store in a skore Project
,
+see Overview of the skore project.
@@ -1100,7 +1112,7 @@ Tracking the history of items
See also
For more information about the tracking of items using their history,
-see Tracking items using their history.
+see Tracking items using their history.
@@ -1111,42 +1123,42 @@ Machine learning diagnostics: enhancing scikit-learn functions
Cross-validation with skore#
In order to assist its users when programming, skore has implemented a
-skore.cross_validate()
function that wraps scikit-learn’s
+skore.cross_validate()
function that wraps scikit-learn’s
sklearn.model_selection.cross_validate()
.
On the same previous data and a Ridge regressor (with default alpha
value),
let us launch skore’s cross-validation, which will automatically add
-(put()
)
+(put()
)
a cross_validation
item with a plotly chart in our project.
-from skore import cross_validate
+from skore import cross_validate
-cv_results = cross_validate(Ridge(), X, y, cv=5, project=my_project)
+cv_results = cross_validate(Ridge(), X, y, cv=5, project=my_project)
-fig_plotly = my_project.get_item("cross_validation").plot
+fig_plotly = my_project.get_item("cross_validation").plot
fig_plotly
Hence, we can observe some key metrics and get insights on our cross-validation.
See also
-For more information about the motivation and usage of skore.cross_validate()
,
-see Enhancing cross-validation.
+For more information about the motivation and usage of skore.cross_validate()
,
+see Enhancing cross-validation.
Train-test split with skore#
-Skore has implemented a skore.train_test_split()
function that wraps
+
Skore has implemented a skore.train_test_split()
function that wraps
scikit-learn’s sklearn.model_selection.train_test_split()
.
For example, it can raise warnings when there is class imbalance in the data to
provide methodological advice:
X = np.arange(400).reshape((200, 2))
y = [0] * 150 + [1] * 50
-X_train, X_test, y_train, y_test = skore.train_test_split(
+X_train, X_test, y_train, y_test = skore.train_test_split(
X=X, y=y, test_size=0.2, random_state=0
)
@@ -1167,7 +1179,7 @@ Train-test split with skore
See also
For more information about the motivation and usage of
-skore.train_test_split()
, see Enhancing train-test split.
+skore.train_test_split()
, see Enhancing train-test split.
Stay tuned for some new features!
@@ -1179,16 +1191,16 @@ Cleanup the projecttemp_dir.cleanup()
-Total running time of the script: (0 minutes 5.282 seconds)
-
-[11/29/24 16:48:46] <Logger skore.project.project (INFO)> Project create.py:148
+[12/02/24 07:55:36] <Logger skore.project.project (INFO)> Project create.py:148
file
'/tmp/sk
ore_exam
- ple_xudu
- 7p_p/my_
+ ple_g4dh
+ y3_2/my_
project.
skore'
was
@@ -496,14 +508,14 @@ Creating and loading the skore project
Storing integers#
-Now, let us store our first object using put()
, for example an
+
Now, let us store our first object using put()
, for example an
integer:
-my_project.put("my_int", 3)
+my_project.put("my_int", 3)
Here, the name of the object is my_int
and the integer value is 3.
-We can read it from the project by using get()
:
-my_project.get("my_int")
+We can read it from the project by using get()
:
+my_project.get("my_int")
3
@@ -511,11 +523,11 @@ Storing integersput method will overwrite
past data if we use a key that already exists!
-my_project.put("my_int", 30_000)
+my_project.put("my_int", 30_000)
We can check the updated value:
-my_project.get("my_int")
+my_project.get("my_int")
30000
@@ -525,18 +537,18 @@ Storing integersSee also
Skore does not exactly overwrite, but stores the history of items.
For more information about the tracking of items using their history,
-see Tracking items using their history.
+see Tracking items using their history.
-By using the delete_item()
method, we can also delete an object
+
By using the delete_item()
method, we can also delete an object
so that our skore UI does not become cluttered:
-my_project.put("my_int_2", 10)
+my_project.put("my_int_2", 10)
-my_project.delete_item("my_int_2")
+my_project.delete_item("my_int_2")
We can display all the keys in our project:
-my_project.list_item_keys()
+
['my_int']
@@ -546,19 +558,19 @@ Storing integers
Storing strings and texts#
We just stored a integer, now let us store some text using strings!
-my_project.put("my_string", "Hello world!")
+my_project.put("my_string", "Hello world!")
-my_project.get("my_string")
+my_project.get("my_string")
'Hello world!'
-get()
infers the type of the inserted object by default. For
+
get()
infers the type of the inserted object by default. For
example, strings are assumed to be in Markdown format. Hence, we can customize the
display of our text:
-my_project.put(
+my_project.put(
"my_string_2",
(
"""Hello world!, **bold**, *italic*, `code`
@@ -576,7 +588,7 @@ Storing strings and textsfrom skore.item import MediaItem
-my_project.put_item(
+my_project.put_item(
"my_string_3",
MediaItem.factory(
"<p><h1>Title</h1> <b>bold</b>, <i>italic</i>, etc.</p>", media_type="text/html"
@@ -586,10 +598,10 @@ Storing strings and texts
Note
-We used put_item()
instead of put()
.
+We used put_item()
instead of put()
.
Note that the media type is only used for the UI, and not in this notebook at hand:
-my_project.get("my_string_3")
+my_project.get("my_string_3")
b'<p><h1>Title</h1> <b>bold</b>, <i>italic</i>, etc.</p>'
@@ -598,7 +610,7 @@ Storing strings and textsx = 2
y = [1, 2, 3, 4]
-my_project.put("my_string_4", f"The value of `x` is {x} and the value of `y` is {y}.")
+my_project.put("my_string_4", f"The value of `x` is {x} and the value of `y` is {y}.")
@@ -606,7 +618,7 @@ Storing strings and texts#
Python list:
my_list = [1, 2, 3, 4]
-my_project.put("my_list", my_list)
+my_project.put("my_list", my_list)
my_list
@@ -618,7 +630,7 @@ Storing many kinds of data"company": "probabl",
"year": 2023,
}
-my_project.put("my_dict", my_dict)
+my_project.put("my_dict", my_dict)
my_dict
@@ -629,20 +641,20 @@ Storing many kinds of dataimport numpy as np
my_arr = np.random.randn(3, 3)
-my_project.put("my_arr", my_arr)
+my_project.put("my_arr", my_arr)
my_arr
-array([[ 0.99281681, 0.44219449, 0.65533057],
- [-0.24864296, 1.10948341, -2.10146096],
- [ 0.44376087, -1.53459009, 0.38465483]])
+array([[ 1.8312195 , -0.35893268, 0.94549297],
+ [ 1.27768204, 0.62375238, 1.34861347],
+ [-1.01895005, 0.46187983, -0.99992579]])
Pandas data frame:
import pandas as pd
my_df_pandas = pd.DataFrame(np.random.randn(10, 5))
-my_project.put("my_df_pandas", my_df_pandas)
+my_project.put("my_df_pandas", my_df_pandas)
my_df_pandas.head()
@@ -675,43 +687,43 @@ Storing many kinds of dataimport polars as pl
my_df_polars = pl.DataFrame(np.random.randn(10, 5))
-my_project.put("my_df_polars", my_df_polars)
+my_project.put("my_df_polars", my_df_polars)
my_df_polars.head()
@@ -734,7 +746,7 @@ Storing many kinds of datacolumn_0 column_1 column_2 column_3 column_4 f64 f64 f64 f64 f64 0.828242 1.210976 -1.651619 -1.566458 1.141409 -1.257238 -0.243915 -1.164194 -0.177233 -0.944327 1.691511 0.65013 -1.261572 0.493694 -0.229308 0.512165 -0.010404 0.185386 0.131988 1.89348 -0.928704 -0.365251 -0.512659 -1.964944 0.827703
+shape: (5, 5)
column_0 column_1 column_2 column_3 column_4 f64 f64 f64 f64 f64 -2.016784 -1.57834 0.486351 -0.046798 -0.196609 0.749376 -0.055253 0.508111 1.474227 -0.162663 0.352716 -0.431617 0.08672 0.749166 -0.229909 1.351604 1.239878 0.558278 0.617867 0.436303 2.137133 0.039924 0.165832 0.409878 1.445417
@@ -757,10 +769,10 @@ Storing data visualizationsax.legend()
plt.show()
-my_project.put("my_figure", fig)
+my_project.put("my_figure", fig)
-
+
Altair chart:
@@ -781,7 +793,7 @@ Storing data visualizations.properties(title="My title")
)
-my_project.put("my_altair_chart", my_altair_chart)
+my_project.put("my_altair_chart", my_altair_chart)
@@ -802,14 +814,14 @@ Storing data visualizationsdf, x=df.sepal_length, y=df.sepal_width, color=df.species, size=df.petal_length
)
-my_project.put("my_plotly_fig", fig)
+my_project.put("my_plotly_fig", fig)
fig
Animated Plotly figure:
@@ -829,17 +841,17 @@ Storing data visualizationsrange_y=[25, 90],
)
-my_project.put("my_anim_plotly_fig", my_anim_plotly_fig)
+my_project.put("my_anim_plotly_fig", my_anim_plotly_fig)
my_anim_plotly_fig
@@ -852,7 +864,7 @@ Storing data visualizationswith io.BytesIO() as output:
my_pil_image.save(output, format="png")
-my_project.put("my_pil_image", my_pil_image)
+my_project.put("my_pil_image", my_pil_image)
@@ -864,7 +876,7 @@ Storing scikit-learn models and pipelinesfrom sklearn.linear_model import Lasso
my_model = Lasso(alpha=2)
-my_project.put("my_model", my_model)
+my_project.put("my_model", my_model)
my_model
@@ -1283,7 +1295,7 @@ Storing scikit-learn models and pipelinesmy_pipeline = Pipeline(
[("standard_scaler", StandardScaler()), ("lasso", Lasso(alpha=2))]
)
-my_project.put("my_pipeline", my_pipeline)
+my_project.put("my_pipeline", my_pipeline)
my_pipeline
@@ -1705,7 +1717,7 @@ Storing scikit-learn models and pipelinesy = diabetes.target[:150]
my_pipeline.fit(X, y)
-my_project.put("my_fitted_pipeline", my_pipeline)
+my_project.put("my_fitted_pipeline", my_pipeline)
my_pipeline
@@ -2125,16 +2137,16 @@ Cleanup the projecttemp_dir.cleanup()
-Total running time of the script: (0 minutes 0.813 seconds)
-