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

[MRG] Faster gromov-wasserstein linesearch for symmetric matrices #607

Merged

Conversation

KrzakalaPaul
Copy link
Contributor

Types of changes

Add a new argument "symmetric" to ot.gromov._gw.solve_gromov_linesearch. The default value symmetric=False results in the previous behaviour. When C1 and C2 are symmetric however, one can set symmetric=True which results in faster computations as the formula can be simplified in that case.

ot.gromov._gw.fused_gromov_wasserstein and ot.gromov._gw.gromov_wasserstein have been changed accordingly to automatically pass symmetric=False or symmetric=True to solve_gromov_linesearch.

A new file symmetric_linesearch.py has been added to examples.gromov to check the usefullness of setting symmetric=True.

Motivation and context / Related issue

The formula for solving the gromov linesearch can be simplified in the (very common case) where the matrices C1 and C2 are symmetric, resulting in a small (but free) improvement in computationnal cost.

How has this been tested (if it applies)

PR checklist

  • I have read the CONTRIBUTING document.
  • The documentation is up-to-date with the changes I made (check build artifacts).
  • All tests passed, and additional code has been covered with new tests.
  • I have added the PR and Issue fix to the RELEASES.md file.

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Merging #607 (5e28029) into master (737b20d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #607   +/-   ##
=======================================
  Coverage   96.78%   96.78%           
=======================================
  Files          77       77           
  Lines       16002    16004    +2     
=======================================
+ Hits        15488    15490    +2     
  Misses        514      514           

Copy link
Collaborator

@cedricvincentcuaz cedricvincentcuaz left a comment

Choose a reason for hiding this comment

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

Good catch @KrzakalaPaul , thank you :)
Could you edit the releases.md with your PR ? then the PR will be ready for merging.

Best, Cédric.

@KrzakalaPaul
Copy link
Contributor Author

Hi :)
I tried to edit releases.md, tell me if it's alright.
Best, Paul

@cedricvincentcuaz cedricvincentcuaz merged commit f1fe593 into PythonOT:master Feb 29, 2024
15 checks passed
@KrzakalaPaul KrzakalaPaul deleted the symetric_gw_linesearch branch March 1, 2024 13:28
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