Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 5 commits into from
Aug 3, 2015

Conversation

amueller
Copy link
Member

Rebase of #4798. Should be good to go.

@amueller amueller force-pushed the function_transformer_rebase branch 2 times, most recently from 1934501 to 70d31b0 Compare July 30, 2015 16:48
@amueller
Copy link
Member Author

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 ()))
Copy link
Member

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.

@amueller
Copy link
Member Author

amueller commented Aug 3, 2015

Btw, while I'm fine with merging this as-is, I actually prefered the version with *args, **kwargs.

Joe Jevnik and others added 4 commits August 3, 2015 11:45
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.
@amueller amueller force-pushed the function_transformer_rebase branch from 70d31b0 to 73532be Compare August 3, 2015 15:48
@amueller amueller force-pushed the function_transformer_rebase branch from 73532be to a2a2d83 Compare August 3, 2015 16:59
from nose.tools import assert_equal
import numpy as np

from ..function_transformer import FunctionTransformer
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point.

larsmans added a commit that referenced this pull request Aug 3, 2015
@larsmans larsmans merged commit 3c6cf99 into scikit-learn:master Aug 3, 2015
@amueller
Copy link
Member Author

amueller commented Aug 3, 2015

Thanks @larsmans. Are you making the module private or should I?

@larsmans
Copy link
Member

larsmans commented Aug 3, 2015

I'm on it.

@amueller
Copy link
Member Author

amueller commented Aug 3, 2015

Thanks. We also need a whatsnew.

@larsmans
Copy link
Member

larsmans commented Aug 3, 2015

b09afb0

@amueller
Copy link
Member Author

amueller commented Aug 3, 2015

👍

@amueller
Copy link
Member Author

amueller commented Aug 3, 2015

🍻 indeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants