-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
[MRG+2] ENH: used SelectorMixin in BaseRandomizedLinearModel #8263
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
Conversation
|
@@ -128,6 +128,9 @@ def _get_support_mask(self, indices=False): | |||
mask = self.scores_ > self.selection_threshold | |||
return mask if not indices else np.where(mask)[0] | |||
|
|||
def get_support(self, indices=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docstring, please
LGTM. I note that this also fixes a bug where |
So does this need an extra review or is it okay for merge? |
I would have merged if i thought that was the right thing to do. we make
changes by consensus, and so far no other core dev has suggested this is
even a worthwhile thing to do.
…On 7 Feb 2017 6:13 pm, "Aman Dalmia" ***@***.***> wrote:
So does this need an extra review or is it okay for merge?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#8263 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEz6_l-59JxknZk1OX8DjfPLR-mEelPks5raBmbgaJpZM4L0S-_>
.
|
Thanks for clearing it up. Just intended to know if there is some other improvement under consideration. |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Can you add a bug fix entry in doc/whats_new.rst
?
@TomDLT 👍 |
Xt = np.zeros((X.shape[0], support.size)) | ||
Xt[:, support] = X | ||
return Xt | ||
def get_support(self, indices=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused why do you need to override SelectorMixin.get_support
? Should _get_support_mask
not be:
def _get_support_mask(self):
check_is_fitted(self, 'scores_')
return self.scores_ > self.selection_threshold
and then SelectorMixin.get_support
would take over and do what it is supposed to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, it is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with a docstring
"""
Get the boolean mask indicating which features are selected
Returns
-------
support : boolean array of shape [# input features]
An element is True iff its corresponding feature is selected for
retention.
"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was specified to me earlier by @jnothman that since get_support
was already public, we shouldn't remove it from one release to the next.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess he overlooked it:
As the class now inherits from SelectorMixin
, the method get_support
is inherited so it is not removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that as you removed TransformerMixin
, the class does not inherit anymore from the method fit_transform
, which is public and should not be removed.
Why don't you keep TransformerMixin
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I removed it since it seemed like SelectorMixin
inherits TransformerMixin
?
class SelectorMixin(six.with_metaclass(ABCMeta, TransformerMixin)):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes of course, my mistake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the comment on get_support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll make the change.
Codecov Report
@@ Coverage Diff @@
## master #8263 +/- ##
=========================================
Coverage ? 94.74%
=========================================
Files ? 342
Lines ? 60722
Branches ? 0
=========================================
Hits ? 57531
Misses ? 3191
Partials ? 0
Continue to review full report at Codecov.
|
…learn#8263) * ENH: used SelectorMixin in BaseRandomizedLinearModel * FIX: added get_support to return _get_support_mask * FIX: added docstring for get_support() * DOC: added bug fix entry to whats_new * FIX: removed redundant get_support()
…learn#8263) * ENH: used SelectorMixin in BaseRandomizedLinearModel * FIX: added get_support to return _get_support_mask * FIX: added docstring for get_support() * DOC: added bug fix entry to whats_new * FIX: removed redundant get_support()
…learn#8263) * ENH: used SelectorMixin in BaseRandomizedLinearModel * FIX: added get_support to return _get_support_mask * FIX: added docstring for get_support() * DOC: added bug fix entry to whats_new * FIX: removed redundant get_support()
…learn#8263) * ENH: used SelectorMixin in BaseRandomizedLinearModel * FIX: added get_support to return _get_support_mask * FIX: added docstring for get_support() * DOC: added bug fix entry to whats_new * FIX: removed redundant get_support()
…learn#8263) * ENH: used SelectorMixin in BaseRandomizedLinearModel * FIX: added get_support to return _get_support_mask * FIX: added docstring for get_support() * DOC: added bug fix entry to whats_new * FIX: removed redundant get_support()
…learn#8263) * ENH: used SelectorMixin in BaseRandomizedLinearModel * FIX: added get_support to return _get_support_mask * FIX: added docstring for get_support() * DOC: added bug fix entry to whats_new * FIX: removed redundant get_support()
Reference Issue
Fixes #8259
What does this implement/fix? Explain your changes.
This uses SelectorMixin in BaseRandomizedLinearModel renaming the
get_support
function to_get_support_mask
in order to utilize the transform() and inverse_transform() methods provided bySelectorMixin
.