-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG + 1] Function transformer rebase #5059
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
[MRG + 1] Function transformer rebase #5059
Conversation
1934501
to
70d31b0
Compare
Maybe @larsmans wants to review? |
if self.validate: | ||
X = check_array(X, self.accept_sparse) | ||
|
||
return (self.func or _identity)(X, *((y,) if self.pass_y else ())) |
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.
Nitpick: This should really check for self.func is None
. While obscure, it's possible for an object to be boolean False and still callable.
Btw, while I'm fine with merging this as-is, I actually prefered the version with |
CallableTransformer allows a user to convert a standard python callable into a transformer for use in a Pipeline.
Makes `pass_y` an argument to FunctionTransformer to indicate that the labels should be passed to the wrapped function.
70d31b0
to
73532be
Compare
73532be
to
a2a2d83
Compare
from nose.tools import assert_equal | ||
import numpy as np | ||
|
||
from ..function_transformer import FunctionTransformer |
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.
Test should use public import (full path). In fact, I think the module should be called _function_transformer
so people don't import it directly.
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.
good point.
Thanks @larsmans. Are you making the module private or should I? |
I'm on it. |
Thanks. We also need a whatsnew. |
👍 |
🍻 indeed |
Rebase of #4798. Should be good to go.