Skip to content

Add memory to make_pipeline function #458

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

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

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

@glemaitre
Copy link
Member

Oh and a regression test

@pep8speaks
Copy link

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 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

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

Plain assert

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

shutil.rmtree(cachedir)
Copy link
Member

Choose a reason for hiding this comment

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

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

@chkoar
Copy link
Member Author

chkoar commented Aug 26, 2018

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

@glemaitre
Copy link
Member

Bugs I would say. It should have been there.

@chkoar
Copy link
Member Author

chkoar commented Aug 26, 2018

@glemaitre ok

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

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
Development

Successfully merging this pull request may close these issues.

3 participants