[MRG] Implement fitting intercept with sparse_cg solver in Ridge regression#13336
Merged
GaelVaroquaux merged 13 commits intoscikit-learn:masterfrom Mar 1, 2019
Merged
Conversation
glemaitre
reviewed
Feb 28, 2019
584709b to
86248d1
Compare
agramfort
reviewed
Mar 1, 2019
agramfort
reviewed
Mar 1, 2019
agramfort
reviewed
Mar 1, 2019
Member
|
@btel you have pep8 errors cf. circle lint |
7 tasks
1b8a2e8 to
c3c6e8f
Compare
glemaitre
reviewed
Mar 1, 2019
GaelVaroquaux
approved these changes
Mar 1, 2019
Member
GaelVaroquaux
left a comment
There was a problem hiding this comment.
LGTM (although the addition of _ridge_regression is ugly).
+1 for merge.
Merging.
Contributor
Author
@GaelVaroquaux I am happy to discuss/implement prettier solutions for propagating |
Member
|
one solution would be to change the current design so Ridge just calls
ridge_regression and all prepare_data and set_intercept code is done in
ridge_regression not any more in the object.
… |
Contributor
Author
|
@agramfort sounds good, but it will require a good deal of refactoring. |
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
…gression (scikit-learn#13336) * add skeleton for fit_intercept with sparse_cg * fix sparse_cg solver with fit_intercept=True * fix test * linting * add what's new entry * remove X_scale and X_offset from public interface of ridge_regression * reformat if clause * fixed linting issues * add comments on about the conditions of different code branches * update warning * remove whitespace * add extra checks in the test of ridge with fit_intercept * remove unused argument
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
…Ridge regression (scikit-learn#13336)" This reverts commit 3ed0547.
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
…Ridge regression (scikit-learn#13336)" This reverts commit 3ed0547.
koenvandevelde
pushed a commit
to koenvandevelde/scikit-learn
that referenced
this pull request
Jul 12, 2019
…gression (scikit-learn#13336) * add skeleton for fit_intercept with sparse_cg * fix sparse_cg solver with fit_intercept=True * fix test * linting * add what's new entry * remove X_scale and X_offset from public interface of ridge_regression * reformat if clause * fixed linting issues * add comments on about the conditions of different code branches * update warning * remove whitespace * add extra checks in the test of ridge with fit_intercept * remove unused argument
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
See also #470
It follows the same trick as introduced in PR #13279 by @agramfort
What does this implement/fix? Explain your changes.
This implements fitting intercept with
sparse_cgsolver in Ridge regression (i.e. whenfit_intercept==True) for sparse inputs. It also means that both sparse and dense cases give the same result.Any other comments?
Important: This PR changes the auto-selected solver (
solver='auto') fromsagtosparse_cgwhenfit_intercept==Trueand input is sparse.There are still problems with the code:
'auto' mode in ridge_regression function may trigger wrong solvers (for example, when inputs is sparse and sample_weight is passed)
Warning message about changing the solver is not fully informative/correct. For example, user might choose the
sparse_cgsolver instead of going thesagway.The estimator object is not informed about the fact that the solver was changed (or which solver was selected by
auto)They are not related to this PR and will be fixed in another PR.