From 5314915a6ce9ae7a4d6a57af2f22d31afa19e28d Mon Sep 17 00:00:00 2001 From: Sylvain Combettes <48064216+sylvaincom@users.noreply.github.com> Date: Mon, 13 Jan 2025 00:48:55 +0100 Subject: [PATCH] docs: Use logistic regression instead of SVC on the Iris dataset (#1087) Fix #1018 In quick start example, do not use SVC on the Iris dataset, but rather logistic regression --- README.md | 11 ++++++++--- examples/getting_started/plot_quick_start.py | 8 +++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 674efd131..b0b709672 100644 --- a/README.md +++ b/README.md @@ -65,12 +65,17 @@ You can find information on the latest version [here](https://anaconda.org/conda 2. Evaluate your model using `skore.CrossValidationReporter`: ```python from sklearn.datasets import load_iris - from sklearn.svm import SVC + from sklearn.pipeline import Pipeline + from sklearn.preprocessing import StandardScaler + from sklearn.linear_model import LogisticRegression X, y = load_iris(return_X_y=True) - clf = SVC(kernel="linear", C=1, random_state=0) + clf_pipeline = Pipeline([ + ('scaler', StandardScaler()), + ('clf', LogisticRegression()) + ]) - reporter = skore.CrossValidationReporter(clf, X, y, cv=5) + reporter = skore.CrossValidationReporter(clf_pipeline, X, y, cv=5) # Store the results in the project my_project.put("cv_reporter", reporter) diff --git a/examples/getting_started/plot_quick_start.py b/examples/getting_started/plot_quick_start.py index 040a738e8..fd7359d2d 100644 --- a/examples/getting_started/plot_quick_start.py +++ b/examples/getting_started/plot_quick_start.py @@ -23,12 +23,14 @@ # %% from sklearn.datasets import load_iris -from sklearn.svm import SVC +from sklearn.pipeline import Pipeline +from sklearn.preprocessing import StandardScaler +from sklearn.linear_model import LogisticRegression X, y = load_iris(return_X_y=True) -clf = SVC(kernel="linear", C=1, random_state=0) +clf_pipeline = Pipeline([("scaler", StandardScaler()), ("clf", LogisticRegression())]) -reporter = skore.CrossValidationReporter(clf, X, y, cv=5) +reporter = skore.CrossValidationReporter(clf_pipeline, X, y, cv=5) # %% # Store the results in the skore project: