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

Add memory to make_pipeline function #458

Merged

Conversation

@chkoar
Copy link
Member

@chkoar 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 add memory to make_pipeline function Add memory to make_pipeline function Aug 25, 2018
@glemaitre
Copy link
Member

@glemaitre glemaitre commented Aug 25, 2018

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

@glemaitre
Copy link
Member

@glemaitre glemaitre commented Aug 25, 2018

Oh and a regression test

@pep8speaks
Copy link

@pep8speaks 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
@codecov
Copy link

@codecov 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.

Copy link
Member

@glemaitre glemaitre left a comment

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
Copy link
Member Author

@chkoar chkoar commented Aug 26, 2018

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

@glemaitre
Copy link
Member

@glemaitre glemaitre commented Aug 26, 2018

Bugs I would say. It should have been there.

@chkoar
Copy link
Member Author

@chkoar chkoar commented Aug 26, 2018

@glemaitre glemaitre merged commit 10c4196 into scikit-learn-contrib:master Aug 26, 2018
0 of 3 checks passed
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
Copy link
Member

@glemaitre glemaitre commented Aug 26, 2018

Tanks

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

Successfully merging this pull request may close these issues.

None yet

3 participants