Skip to content

[FEAT] Entropic gw/fgw/srgw/srfgw solvers #455

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 27 commits into from
Jun 12, 2023

Conversation

cedricvincentcuaz
Copy link
Collaborator

@cedricvincentcuaz cedricvincentcuaz commented Apr 10, 2023

Types of changes

changes to file ot/gromov/_bregman.py:

  • new features in entropic_gromov_wasserstein(2):
    i) solver: Set by default to solver='PGD' to not change the Projected Gradient Descent solver already implemented in the API. Add solver='PPA' to use the Proximal Point Algorithm from [50].
    ii) warmstart: Either to perform warmstart of dual potentials in the successive Sinkhorn projections.
    iii) kwargs: to pass parameters to ot.sinkhorn solver e.g to control its maximum number of iterations.

  • new features in entropic_gromov_barycenters:
    i) warmstartT: Either to perform warmstart of transport plans in the successive gromov-wasserstein transport problems.
    ii) kwargs: to pass parameters to ot.entropic_gromov_wasserstein e.g using solver='PGD' or solver='PPA'.

  • new functions: entropic_fused_gromov_wasserstein, entropic_fused_gromov_wasserstein2, entropic_fused_gromov_barycenters that extend existing functions for entropic GW to graphs with node features via FGW.

changes to file ot/gromov/_gw.py:

  • new feature in gromov_barycenters and fgw_barycenters:
    i) warmstartT: Either to perform warmstart of transport plans in the successive (fused) gromov-wasserstein transport problems.
    ii) Fix bug in the update over structures when using loss_fun='kl_loss'
  • remove redundant function update_structure_matrix which was equivalent to ot.gromov._utils.update_square_loss

changes to file ot/gromov/_semirelaxed.py:

  • new functions entropic_semirelaxed_gromov_wasserstein, entropic_semirelaxed_gromov_wasserstein2, entropic_semirelaxed_fused_gromov_wasserstein, entropic_semirelaxed_fused_gromov_wasserstein2: mirror descent algorithms following the KL geometry to solve semi-relaxed (Fused) Gromov-Wasserstein problems.

changes to file ot/gromov/_utils.py:

  • move ot.gromov._gw.update_feature_matrix to ot.gromov._utils.update_feature_matrix as now use in both _gw.py and _bregman.py

Nb : The marginals have been made optional for all solvers in these files.

Motivation and context / Related issue

Keep up with the (F)GW literature

How has this been tested (if it applies)

changes to file ot/gromov/_bregman.py:
new tests: test_entropic_proximal_gromov, test_entropic_proximal_fgw, test_entropic_fgw, test_asymmetric_entropic_fgw, test_entropic_fgw_dtype_device, test_entropic_fgw_barycenter
modified tests: test_entropic_gromov_dtype_device, test_entropic_fgw_dtype_device, test_gromov_entropic_barycenter

changes to file ot/gromov/_gw.py:
modified tests: test_gromov_barycenter, test_fgw_barycenter

changes to file ot/gromov/_semirelaxed.py:
new tests: test_entropic_semirelaxed_gromov, test_entropic_semirelaxed_gromov_dtype_device, test_entropic_semirelaxed_fgw, test_entropic_semirelaxed_fgw_dtype_device

  • new test test_not_implemented_solver for entropic solvers and loss_fun=kl_loss for semi-relaxed solvers.

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.

@codecov
Copy link

codecov bot commented Apr 10, 2023

Codecov Report

Merging #455 (c809707) into master (2bbfbbb) will increase coverage by 0.22%.
The diff coverage is 99.31%.

❗ Current head c809707 differs from pull request most recent head 7d96efe. Consider uploading reports for the commit 7d96efe to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #455      +/-   ##
==========================================
+ Coverage   94.92%   95.15%   +0.22%     
==========================================
  Files          31       31              
  Lines        6879     7137     +258     
==========================================
+ Hits         6530     6791     +261     
+ Misses        349      346       -3     

@cedricvincentcuaz cedricvincentcuaz changed the title [WIP] Entropic gw/fgw/srgw/srfgw solvers [MRG] Entropic gw/fgw/srgw/srfgw solvers Apr 11, 2023
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.

very nice PR, next time do a smaller one but keep on with the quality code ;).

Small comments about usability below

@cedricvincentcuaz
Copy link
Collaborator Author

Thanks for the review Rémi :)

One thing I just realised. In entropic gw and fgw, there is no test on marginals if an initial transport plan G0 is given (different than None), should we add them ?
It would force us to recompute marginals at every iterations in the functions entropic (f)gw barycenter if warmstartT=True.

@rflamary rflamary changed the title [MRG] Entropic gw/fgw/srgw/srfgw solvers [FEAT] Entropic gw/fgw/srgw/srfgw solvers Jun 12, 2023
@rflamary rflamary merged commit 9076f02 into PythonOT:master Jun 12, 2023
@cedricvincentcuaz cedricvincentcuaz deleted the entropic_gw_solvers branch August 4, 2023 12:07
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.

2 participants