Skip to content
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

added y argument to fit methods #59

Merged
merged 5 commits into from
Aug 3, 2016

Conversation

vzaretsk
Copy link
Contributor

Added optional y argument to fit methods of TransformerPipeline and DataFrameMapper. I'm using try/except TypeError to handle fit methods of pipeline transformers that don't accept a y argument. @dukebody

added optional y argument to fit methods of TransformerPipeline and
DataFrameMapper
@dukebody
Copy link
Collaborator

I like this! :) It's simple enough, doesn't break existing code (I believe) and adds interesting functionality.

As you mentioned in #58, we should add some more tests that exercise this new functionality, as well as updating README documentation. Can you do this? If you need any pointers I'd be happy to help. :)

Thanks!

@vzaretsk
Copy link
Contributor Author

Yes, I'll do this. Let me work on it during the week and see how far I get. Do you have a Python 2 environment you can test the code in when it's ready? I don't have one and it would be nice if I didn't need to set one up. Thanks.

@dukebody
Copy link
Collaborator

Sure, we use tox to test everything on Python 2 and 3.

2016-07-10 22:46 GMT+02:00 Vitaley Zaretskey notifications@github.com:

Yes, I'll do this. Let me work on it during the week and see how far I
get. Do you have a Python 2 environment you can test the code in when it's
ready? I don't have one and it would be nice if I didn't need to set one
up. Thanks.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#59 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AACj4Z6yp3LvDuuhJbe6lGpXiVjVf-BSks5qUVoggaJpZM4JIu0Y
.

refactored pipeline and dataframe_mapper to use _call_fit helper
function, consolidating code to handle fit with 1 or 2 arguments
added unit tests for _call_fit to test_pipeline
added unit tests to test_dataframe_mapper and updated README
@vzaretsk
Copy link
Contributor Author

I added unit tests for the new functionality and updated the README. Everything is passing on Python 3. Let me know if you see any issues or anything else that needs to be added. Thanks.
@dukebody

[ 0., 1., 0., 3., 1.],
[ 1., 0., 0., 5., -0.],
[ 0., 0., 1., 4., -1.]])
>>> np.round(mapper4.fit_transform(data.copy()), 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why does one need to pass "1" as second argument to this transform, and why is the output different from the previous case in the last column?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "1" is the second argument of np.round. This test case was failing even though I don't think I modified anything that affected it. The issue seems to be that on my machine np.round(-0.3) equals "0.", not "-0." Changing it to round to 1 decimal place fixed the test case.

@dukebody
Copy link
Collaborator

dukebody commented Jul 25, 2016

My apologies for the delay reviewing this.

Good work! Tests pass both on Python 2.7 and 3.5.

Merging once you've addressed the inline comments I did on the existing commits.

removed unused import
@vzaretsk
Copy link
Contributor Author

Thanks. I answered the comments and made a new commit. @dukebody

@dukebody dukebody merged commit 665d66d into scikit-learn-contrib:master Aug 3, 2016
@dukebody
Copy link
Collaborator

dukebody commented Aug 3, 2016

All tests passing, so merged!

@vzaretsk vzaretsk deleted the add-y-arg-to-fit branch August 3, 2016 16:31
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.

None yet

2 participants