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

Add memory to make_pipeline function #458

Merged
merged 11 commits into from Aug 26, 2018

Conversation

Projects
None yet
3 participants
@chkoar
Member

chkoar commented Aug 25, 2018

What does this implement/fix? Explain your changes.

Adds the ability to pass a joblib.Memory object to the make_pipeline function.

@chkoar chkoar changed the title from add memory to make_pipeline function to Add memory to make_pipeline function Aug 25, 2018

@glemaitre

This comment has been minimized.

Member

glemaitre commented Aug 25, 2018

Just put an entry in what's new as a bug fix. Good catch

@glemaitre

This comment has been minimized.

Member

glemaitre commented Aug 25, 2018

Oh and a regression test

chkoar added some commits Aug 25, 2018

@pep8speaks

This comment has been minimized.

pep8speaks commented Aug 25, 2018

Hello @chkoar! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on August 26, 2018 at 11:15 Hours UTC

chkoar added some commits Aug 25, 2018

@codecov

This comment has been minimized.

codecov bot commented Aug 25, 2018

Codecov Report

❗️ No coverage uploaded for pull request base (master@7b704ea). Click here to learn what that means.
The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #458   +/-   ##
=========================================
  Coverage          ?   98.78%           
=========================================
  Files             ?       75           
  Lines             ?     4628           
  Branches          ?        0           
=========================================
  Hits              ?     4572           
  Misses            ?       56           
  Partials          ?        0
Impacted Files Coverage Δ
imblearn/tests/test_pipeline.py 99.16% <100%> (ø)
imblearn/pipeline.py 97.29% <80%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b704ea...c89436c. Read the comment docs.

@glemaitre

Still need a what's new ;)

pipeline = make_pipeline(DummyTransf(), SVC(), memory=memory)
assert_true(pipeline.memory is memory)
pipeline = make_pipeline(DummyTransf(), SVC())
assert_true(pipeline.memory is None)

This comment has been minimized.

@glemaitre

glemaitre Aug 25, 2018

Member

Use assert pipeline.memory is None

cachedir = mkdtemp()
if LooseVersion(joblib_version) < LooseVersion('0.12'):
# Deal with change of API in joblib
memory = Memory(cachedir=cachedir, verbose=10)

This comment has been minimized.

@glemaitre

glemaitre Aug 25, 2018

Member

I would not bother. I would make the one that work and update when the test will break when we will update the scikit learn version

else:
memory = Memory(location=cachedir, verbose=10)
pipeline = make_pipeline(DummyTransf(), SVC(), memory=memory)
assert_true(pipeline.memory is memory)

This comment has been minimized.

@glemaitre

glemaitre Aug 25, 2018

Member

Plain assert

pipeline = make_pipeline(DummyTransf(), SVC())
assert_true(pipeline.memory is None)

shutil.rmtree(cachedir)

This comment has been minimized.

@glemaitre

glemaitre Aug 25, 2018

Member

You need a try ... finally to be sure to remove the folder even if the test fail

@chkoar

This comment has been minimized.

Member

chkoar commented Aug 26, 2018

@glemaitre does this considered as a bug fix or as an enhancement?

@glemaitre

This comment has been minimized.

Member

glemaitre commented Aug 26, 2018

Bugs I would say. It should have been there.

chkoar added some commits Aug 26, 2018

@chkoar

This comment has been minimized.

Member

chkoar commented Aug 26, 2018

glemaitre added some commits Aug 26, 2018

@glemaitre glemaitre merged commit 10c4196 into scikit-learn-contrib:master Aug 26, 2018

0 of 3 checks passed

LGTM analysis: Python Fetching git commits
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@glemaitre

This comment has been minimized.

Member

glemaitre commented Aug 26, 2018

Tanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment