[MRG+1] Fix Error: 'MultiTaskLasso' object has no attribute 'coef_' when warm_start = True#12361
Merged
jnothman merged 3 commits intoscikit-learn:masterfrom Oct 21, 2018
Merged
[MRG+1] Fix Error: 'MultiTaskLasso' object has no attribute 'coef_' when warm_start = True#12361jnothman merged 3 commits intoscikit-learn:masterfrom
jnothman merged 3 commits intoscikit-learn:masterfrom
Conversation
Member
|
Please add a non-regression test |
Contributor
Author
|
AppVeyor build seems to be failing for I'm not sure if this was triggered by the test I added. Please let me know if there's anything required on my side to rectify this. |
jnothman
approved these changes
Oct 16, 2018
| X, y, self.fit_intercept, self.normalize, copy=False) | ||
|
|
||
| if not self.warm_start or self.coef_ is None: | ||
| if not self.warm_start or not hasattr(self, "coef_"): |
Member
There was a problem hiding this comment.
Just to be safe, we might want to handle the case where coef_ is None in case someone relied on this broken implementation...?
Contributor
Author
There was a problem hiding this comment.
Maybe this condition
Suggested change
| if not self.warm_start or not hasattr(self, "coef_"): | |
| if not self.warm_start or not hasattr(self, "coef_") or self.coef_ is None: |
should be able to handle that?
Member
|
got to go from my end |
Member
|
Yes, that should work. Writing a test is a better way to be sure, though
|
Member
|
what's new is updated and test is there. @jnothman ok to merge? |
jnothman
approved these changes
Oct 21, 2018
Member
|
Thanks @joaak |
jnothman
pushed a commit
to jnothman/scikit-learn
that referenced
this pull request
Feb 19, 2019
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
…m_start = True (scikit-learn#12361)" This reverts commit cab496e.
xhluca
pushed a commit
to xhluca/scikit-learn
that referenced
this pull request
Apr 28, 2019
…m_start = True (scikit-learn#12361)" This reverts commit cab496e.
koenvandevelde
pushed a commit
to koenvandevelde/scikit-learn
that referenced
this pull request
Jul 12, 2019
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
Fixes #12360
What does this implement/fix? Explain your changes.
In the original source code, within the class MultiTaskElaticNet,
if not self.warm_start or self.coef_ is None:(line 1798) throws an error that the object has no attribute 'coef_' when a MultiTaskElaticNet/MultiTaskLasso object is created withwarm_start = True.Potential Fix:
Replace
if not self.warm_start or self.coef_ is None:with
if not self.warm_start or not hasattr(self, "coef_"):(The replacement is what has been done in line 733 within the ElasticNet class in the original source code).