Skip to content

[MRG] add screenkhorn: screening Sinkhorn algorithm #121

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 40 commits into from
Jan 24, 2020

Conversation

mzalaya
Copy link
Contributor

@mzalaya mzalaya commented Jan 6, 2020

No description provided.

Copy link
Collaborator

@rflamary rflamary left a comment

Choose a reason for hiding this comment

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

Hello @mzalaya,

Thank you for your PR. I think screenkhorn has its place in POT. I have several comments that should be taken care of before marge. Note that i don't want to add new dependencies so you should code your function to work with numpy if bottleneck is not installed (and use bottleneck if installed).

You will also need to respect pep8. you can do an automatic autopep8 with make aautopep8 in the POT main folder.

Finally you need to check that all tests are passing and you need to write tests to check that your function runs without bugs and return a meaningful solution in test/test_bregman.py

Welcome to the POT contributors

@rflamary rflamary changed the title add screenkhorn: screening Sinkhorn algorithm [WIP] add screenkhorn: screening Sinkhorn algorithm Jan 7, 2020
@rflamary
Copy link
Collaborator

rflamary commented Jan 8, 2020

Hello @mzalaya,

I see you have implemented a lot of our comments and the code is shaping up very well.

There is still the binary indexing that needs to be looked at and I would also like you to add an example of you solver in the example folder of the repository. The examples are afterwards included semi automatically in the documentation with the plots and everything and it will definitely make your new contribution more visible. Also we need some tests on the new function that i don't see running in travis yet.

I triggered the build for your last commit to see if the tests pass. I don't know why it did not trigger itself (spoiler alert it failed because of pep8 violations).

@rflamary
Copy link
Collaborator

Hello @mzalaya,

We are nearly there. What is still missing before merge:

  • Test should pass: use autopep8 on the example file also
  • Add a test that call your function ,and check that the output makes sens.
  • you should use r"""doc""" for using the latex backslash in the documentatiion

@mzalaya
Copy link
Contributor Author

mzalaya commented Jan 22, 2020

@rflamary I think screenkhorn is ready to be merged in POT : )

ot/bregman.py Outdated
try:
import bottleneck
except ImportError:
print("Bottleneck module doesn't exist. Install it from https://pypi.org/project/Bottleneck/")
Copy link
Collaborator

Choose a reason for hiding this comment

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

The function should not fail when bottleneck is not installed and it will because it uses bottleneck afterwards. As already said we don't want to add dependencies.

i would do something like

try:
    import bottleneck
except ImportError:
    warning("Bottleneck module is not installed. Install it from https://pypi.org/project/Bottleneck/ for better performance")
    bottleneck=np

this would use the numpy partition that is not as efficient but works on any numpy machine. I'm surprise the test passes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good suggestion to sent a warning for non installed Bottelenck module.

@rflamary
Copy link
Collaborator

Hello @mzalaya,

So now autograd breaks on python 2.7. While we could deactivate the tests on 2.7 (it is deprecated) is would like to force to use an older version of pymanopt for the tests.

for that i think we can change the line pymanopt in requirement.txt and replace it with the two following lines:

pymanopt== 0.2.4, python_version < '3'
pymanopt, python_version >= '3'

Could you try to do that please? We will remove support for 2.7 at a future date but this is another PR ;)

@mzalaya
Copy link
Contributor Author

mzalaya commented Jan 24, 2020

@rflamary
a semicolon is needed between. cool now it's working :)
pymanopt==0.2.4; python_version <'3'
pymanopt; python_version >= '3'

@rflamary rflamary merged commit da37513 into PythonOT:master Jan 24, 2020
@rflamary rflamary changed the title [WIP] add screenkhorn: screening Sinkhorn algorithm [MRG] add screenkhorn: screening Sinkhorn algorithm Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants