From 01f39446220ef0c562dafccea631ab905962ff03 Mon Sep 17 00:00:00 2001 From: Luccas Quadros Date: Sat, 26 Jun 2021 15:00:50 -0300 Subject: [PATCH 1/3] Adresses #20308 LogisticRegressionCV --- maint_tools/test_docstrings.py | 1 - sklearn/linear_model/_logistic.py | 16 +++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/maint_tools/test_docstrings.py b/maint_tools/test_docstrings.py index cba5e8dfd2900..b441a7c0a96d9 100644 --- a/maint_tools/test_docstrings.py +++ b/maint_tools/test_docstrings.py @@ -104,7 +104,6 @@ "LocalOutlierFactor", "LocallyLinearEmbedding", "LogisticRegression", - "LogisticRegressionCV", "MDS", "MLPClassifier", "MLPRegressor", diff --git a/sklearn/linear_model/_logistic.py b/sklearn/linear_model/_logistic.py index b34904d686cec..c4349a18fc165 100644 --- a/sklearn/linear_model/_logistic.py +++ b/sklearn/linear_model/_logistic.py @@ -1938,6 +1938,10 @@ class LogisticRegressionCV(LogisticRegression, LinearClassifierMixin, BaseEstima .. versionadded:: 0.24 + See Also + -------- + LogisticRegression : Logistic regression. + Examples -------- >>> from sklearn.datasets import load_iris @@ -1950,11 +1954,6 @@ class LogisticRegressionCV(LogisticRegression, LinearClassifierMixin, BaseEstima (2, 3) >>> clf.score(X, y) 0.98... - - See Also - -------- - LogisticRegression - """ def __init__( @@ -2014,7 +2013,8 @@ def fit(self, X, y, sample_weight=None): Returns ------- - self : object + self + Fitted LogisticRegressionCV estimator. """ solver = _check_solver(self.solver, self.penalty, self.dual) @@ -2346,8 +2346,7 @@ def fit(self, X, y, sample_weight=None): return self def score(self, X, y, sample_weight=None): - """Returns the score using the `scoring` option on the given - test data and labels. + """Return the score using the `scoring` option on the given test data and labels. Parameters ---------- @@ -2364,7 +2363,6 @@ def score(self, X, y, sample_weight=None): ------- score : float Score of self.predict(X) wrt. y. - """ scoring = self.scoring or "accuracy" scoring = get_scorer(scoring) From 453e8fac83deb6691b2e4218698ba9cab9450020 Mon Sep 17 00:00:00 2001 From: Luccas Quadros Date: Sun, 27 Jun 2021 13:36:40 -0300 Subject: [PATCH 2/3] Fixing suggestions --- sklearn/linear_model/_logistic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sklearn/linear_model/_logistic.py b/sklearn/linear_model/_logistic.py index c4349a18fc165..0ca2e7b98c336 100644 --- a/sklearn/linear_model/_logistic.py +++ b/sklearn/linear_model/_logistic.py @@ -1940,7 +1940,8 @@ class LogisticRegressionCV(LogisticRegression, LinearClassifierMixin, BaseEstima See Also -------- - LogisticRegression : Logistic regression. + LogisticRegression : Logistic regression without tuning the + hyperparameter `C`. Examples -------- @@ -2346,7 +2347,7 @@ def fit(self, X, y, sample_weight=None): return self def score(self, X, y, sample_weight=None): - """Return the score using the `scoring` option on the given test data and labels. + """Score using the `scoring` option on the given test data and labels. Parameters ---------- From dd2ce82678a38cf6f0408b4c792390aeb45028ac Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Mon, 28 Jun 2021 09:59:58 +0200 Subject: [PATCH 3/3] Update sklearn/linear_model/_logistic.py --- sklearn/linear_model/_logistic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/linear_model/_logistic.py b/sklearn/linear_model/_logistic.py index 0ca2e7b98c336..ee6087f79bae9 100644 --- a/sklearn/linear_model/_logistic.py +++ b/sklearn/linear_model/_logistic.py @@ -2014,7 +2014,7 @@ def fit(self, X, y, sample_weight=None): Returns ------- - self + self : object Fitted LogisticRegressionCV estimator. """ solver = _check_solver(self.solver, self.penalty, self.dual)