Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Update _coordinate_descent.py #30416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
Loading
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion 10 sklearn/linear_model/_coordinate_descent.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ def __init__(
warm_start=False,
positive=False,
random_state=None,
selection="cyclic",
selection="cyclic"
):
self.alpha = alpha
self.l1_ratio = l1_ratio
Expand Down Expand Up @@ -2052,7 +2052,9 @@ def __init__(
positive=False,
random_state=None,
selection="cyclic",
refit=True,
):
self.refit = refit
super().__init__(
eps=eps,
n_alphas=n_alphas,
Expand Down Expand Up @@ -2082,6 +2084,7 @@ def __sklearn_tags__(self):
return tags

def fit(self, X, y, sample_weight=None, **params):
params.pop('refit', None)
"""Fit Lasso model with coordinate descent.

Fit is on grid of alphas and best alpha estimated by cross-validation.
Expand Down Expand Up @@ -2119,8 +2122,13 @@ def fit(self, X, y, sample_weight=None, **params):
self : object
Returns an instance of fitted model.
"""

return super().fit(X, y, sample_weight=sample_weight, **params)

if self.refit:
self._fit(X, y)

return self

class ElasticNetCV(RegressorMixin, LinearModelCV):
"""Elastic Net model with iterative fitting along a regularization path.
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.