Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scikit-learn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ian Johnson
scikit-learn
Commits
a6753f3e
Commit
a6753f3e
authored
7 years ago
by
Alexandre Gramfort
Committed by
Joel Nothman
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[MRG+1] Ridgecv normalize (#9302)
* FIX : normalize was not passed to grid search in RidgeCV * update what's new
parent
a08555a2
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/whats_new.rst
+4
-1
4 additions, 1 deletion
doc/whats_new.rst
sklearn/linear_model/ridge.py
+2
-1
2 additions, 1 deletion
sklearn/linear_model/ridge.py
sklearn/linear_model/tests/test_ridge.py
+11
-0
11 additions, 0 deletions
sklearn/linear_model/tests/test_ridge.py
with
17 additions
and
2 deletions
doc/whats_new.rst
+
4
−
1
View file @
a6753f3e
...
@@ -471,10 +471,13 @@ Bug fixes
...
@@ -471,10 +471,13 @@ Bug fixes
by :user:`Andre Ambrosio Boechat <boechat107>`, :user:`Utkarsh Upadhyay
by :user:`Andre Ambrosio Boechat <boechat107>`, :user:`Utkarsh Upadhyay
<musically-ut>`, and `Joel Nothman`_.
<musically-ut>`, and `Joel Nothman`_.
- Add ``data_home`` parameter to
- Add ``data_home`` parameter to
:func:`sklearn.datasets.fetch_kddcup99` by `Loic Esteve`_.
:func:`sklearn.datasets.fetch_kddcup99` by `Loic Esteve`_.
- Fix inconsistent results between :class:`linear_model.RidgeCV`
and :class:`linear_model.Ridge` when using ``normalize=True``
by `Alexandre Gramfort`_.
API changes summary
API changes summary
-------------------
-------------------
...
...
This diff is collapsed.
Click to expand it.
sklearn/linear_model/ridge.py
+
2
−
1
View file @
a6753f3e
...
@@ -1119,7 +1119,8 @@ class _BaseRidgeCV(LinearModel):
...
@@ -1119,7 +1119,8 @@ class _BaseRidgeCV(LinearModel):
raise
ValueError
(
"
cv!=None and store_cv_values=True
"
raise
ValueError
(
"
cv!=None and store_cv_values=True
"
"
are incompatible
"
)
"
are incompatible
"
)
parameters
=
{
'
alpha
'
:
self
.
alphas
}
parameters
=
{
'
alpha
'
:
self
.
alphas
}
gs
=
GridSearchCV
(
Ridge
(
fit_intercept
=
self
.
fit_intercept
),
gs
=
GridSearchCV
(
Ridge
(
fit_intercept
=
self
.
fit_intercept
,
normalize
=
self
.
normalize
),
parameters
,
cv
=
self
.
cv
,
scoring
=
self
.
scoring
)
parameters
,
cv
=
self
.
cv
,
scoring
=
self
.
scoring
)
gs
.
fit
(
X
,
y
,
sample_weight
=
sample_weight
)
gs
.
fit
(
X
,
y
,
sample_weight
=
sample_weight
)
estimator
=
gs
.
best_estimator_
estimator
=
gs
.
best_estimator_
...
...
This diff is collapsed.
Click to expand it.
sklearn/linear_model/tests/test_ridge.py
+
11
−
0
View file @
a6753f3e
...
@@ -383,6 +383,16 @@ def _test_ridge_loo(filter_):
...
@@ -383,6 +383,16 @@ def _test_ridge_loo(filter_):
return
ret
return
ret
def
_test_ridge_cv_normalize
(
filter_
):
ridge_cv
=
RidgeCV
(
normalize
=
True
,
cv
=
3
)
ridge_cv
.
fit
(
filter_
(
10.
*
X_diabetes
),
y_diabetes
)
gs
=
GridSearchCV
(
Ridge
(
normalize
=
True
),
cv
=
3
,
param_grid
=
{
'
alpha
'
:
ridge_cv
.
alphas
})
gs
.
fit
(
filter_
(
10.
*
X_diabetes
),
y_diabetes
)
assert_equal
(
gs
.
best_estimator_
.
alpha
,
ridge_cv
.
alpha_
)
def
_test_ridge_cv
(
filter_
):
def
_test_ridge_cv
(
filter_
):
ridge_cv
=
RidgeCV
()
ridge_cv
=
RidgeCV
()
ridge_cv
.
fit
(
filter_
(
X_diabetes
),
y_diabetes
)
ridge_cv
.
fit
(
filter_
(
X_diabetes
),
y_diabetes
)
...
@@ -462,6 +472,7 @@ def check_dense_sparse(test_func):
...
@@ -462,6 +472,7 @@ def check_dense_sparse(test_func):
def
test_dense_sparse
():
def
test_dense_sparse
():
for
test_func
in
(
_test_ridge_loo
,
for
test_func
in
(
_test_ridge_loo
,
_test_ridge_cv
,
_test_ridge_cv
,
_test_ridge_cv_normalize
,
_test_ridge_diabetes
,
_test_ridge_diabetes
,
_test_multi_ridge_diabetes
,
_test_multi_ridge_diabetes
,
_test_ridge_classifiers
,
_test_ridge_classifiers
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment