.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/getting_started/plot_quick_start.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_getting_started_plot_quick_start.py: .. _example_quick_start: =========== Quick start =========== .. GENERATED FROM PYTHON SOURCE LINES 10-11 From your Python code, create and load a skore :class:`~skore.Project`: .. GENERATED FROM PYTHON SOURCE LINES 13-17 .. code-block:: Python import skore my_project = skore.open("my_project", create=True) .. GENERATED FROM PYTHON SOURCE LINES 18-22 This will create a skore project directory named ``quick_start.skore`` in your current working directory. Note that `overwrite=True` will overwrite any pre-existing project with the same path (which you might not want to do that depending on your use case). .. GENERATED FROM PYTHON SOURCE LINES 24-25 Evaluate your model using skore's :class:`~skore.CrossValidationReport`: .. GENERATED FROM PYTHON SOURCE LINES 27-37 .. code-block:: Python from sklearn.datasets import make_classification from sklearn.linear_model import LogisticRegression from skore import CrossValidationReport X, y = make_classification(n_classes=2, n_samples=100_000, n_informative=4) clf = LogisticRegression() cv_report = CrossValidationReport(clf, X, y) .. rst-class:: sphx-glr-script-out .. code-block:: none Processing cross-validation ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% for LogisticRegression .. GENERATED FROM PYTHON SOURCE LINES 38-40 Display the help tree to see all the insights that are available to you (given that you are doing binary classification): .. GENERATED FROM PYTHON SOURCE LINES 42-44 .. code-block:: Python cv_report.help() .. rst-class:: sphx-glr-script-out .. code-block:: none ╭─────────────────── Tools to diagnose estimator LogisticRegression ───────────────────╮ │ report │ │ ├── .metrics │ │ │ ├── .accuracy(...) (↗︎) - Compute the accuracy score. │ │ │ ├── .brier_score(...) (↘︎) - Compute the Brier score. │ │ │ ├── .log_loss(...) (↘︎) - Compute the log loss. │ │ │ ├── .precision(...) (↗︎) - Compute the precision score. │ │ │ ├── .recall(...) (↗︎) - Compute the recall score. │ │ │ ├── .roc_auc(...) (↗︎) - Compute the ROC AUC score. │ │ │ ├── .custom_metric(...) - Compute a custom metric. │ │ │ ├── .report_metrics(...) - Report a set of metrics for our estimator. │ │ │ └── .plot │ │ │ ├── .precision_recall(...) - Plot the precision-recall curve. │ │ │ └── .roc(...) - Plot the ROC curve. │ │ ├── .cache_predictions(...) - Cache the predictions for sub-estimators │ │ │ reports. │ │ ├── .clear_cache(...) - Clear the cache. │ │ └── Attributes │ │ ├── .X │ │ ├── .y │ │ ├── .estimator_ │ │ ├── .estimator_name_ │ │ ├── .estimator_reports_ │ │ └── .n_jobs │ │ │ │ │ │ Legend: │ │ (↗︎) higher is better (↘︎) lower is better │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ .. GENERATED FROM PYTHON SOURCE LINES 45-46 Display the report metrics that was computed for you: .. GENERATED FROM PYTHON SOURCE LINES 48-51 .. code-block:: Python df_cv_report_metrics = cv_report.metrics.report_metrics() df_cv_report_metrics .. rst-class:: sphx-glr-script-out .. code-block:: none Compute metric for each split ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% .. raw:: html
Metric Precision (↗︎) Recall (↗︎) ROC AUC (↗︎) Brier score (↘︎)
Class label 0 1 0 1
LogisticRegression Split #0 0.711855 0.679716 0.652961 0.735906 0.742988 0.203268
Split #1 0.708920 0.676875 0.649560 0.733507 0.739072 0.204214
Split #2 0.716189 0.677460 0.645258 0.744502 0.733268 0.206385
Split #3 0.705876 0.675994 0.650160 0.729308 0.736770 0.205158
Split #4 0.713305 0.681327 0.654927 0.737031 0.739471 0.204202


.. GENERATED FROM PYTHON SOURCE LINES 52-53 Display the ROC curve that was generated for you: .. GENERATED FROM PYTHON SOURCE LINES 55-61 .. code-block:: Python import matplotlib.pyplot as plt roc_plot = cv_report.metrics.plot.roc() roc_plot plt.tight_layout() .. image-sg:: /auto_examples/getting_started/images/sphx_glr_plot_quick_start_001.png :alt: plot quick start :srcset: /auto_examples/getting_started/images/sphx_glr_plot_quick_start_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Computing predictions for display ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% .. GENERATED FROM PYTHON SOURCE LINES 62-63 Store the results in the skore project for safe-keeping: .. GENERATED FROM PYTHON SOURCE LINES 65-68 .. code-block:: Python my_project.put("df_cv_report_metrics", df_cv_report_metrics) my_project.put("roc_plot", roc_plot) .. GENERATED FROM PYTHON SOURCE LINES 69-72 .. admonition:: What's next? For a more in-depth guide, see our :ref:`example_skore_getting_started` page! .. GENERATED FROM PYTHON SOURCE LINES 74-79 Cleanup the project ------------------- Let's clear the skore project (to avoid any conflict with other documentation examples). .. GENERATED FROM PYTHON SOURCE LINES 81-82 .. code-block:: Python my_project.clear() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.961 seconds) .. _sphx_glr_download_auto_examples_getting_started_plot_quick_start.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_quick_start.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_quick_start.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_quick_start.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_