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

[WIP] quantized gromov wasserstein solver #603

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

cedricvincentcuaz
Copy link
Collaborator

@cedricvincentcuaz cedricvincentcuaz commented Feb 11, 2024

Types of changes

Implementation of first solvers for the quantized Fused Gromov-Wasserstein (qFGW) distance.

  • creation of new files ot/gromov/_quantized.py and test/gromov/test_quantized.py .
  • quantized_fused_gromov_wasserstein_partitioned : main function to compute the OT between two partitioned joint spaces with minimal inputs to compute global and local alignments, so that the user can perform any partitioning and representant selection as pre-processing. A boolean option build_OT allows the user to construct the OT matrix between non-partitioned spaces which might require a lot of memory. Other inputs mainly relate to inner fused_gromov_wasserstein, gromov_wasserstein and emd_1d solvers.

remark 1 : i) only the (F)GW conditional gradient solver is considered here. Note that authors also made use of the entropic projected gradient solver. ii) only the square loss is considered for both types of OT problems.

  • quantized_fused_gromov_wasserstein: main function to compute the OT between two joint spaces with axioms used by authors to partition both spaces. Taking as inputs structure matrices C1 and C2 treated as graphs, optionally as feature matrices F1 and F2, optionally other structure matrices C1_aux and C2_aux used for partitioning and representant selection implemented in get_graph_partition and get_graph_representants.

  • quantized_fused_gromov_wasserstein_samples: main function to compute the OT between two distributions in different spaces potentially endowed with features, with axioms used by authors to partition both spaces. Taking as inputs samples X1 and X2 endowed with an euclidean geometry on their respective space, optionally with feature matrices F1 and F2, where both can be considered for partitioning and representant selection (e.g kmeans) implemented in get_partition_and_representants_samples.

Motivation and context / Related issue

How has this been tested (if it applies)

  • tests for all configurations in test.test_gromov.py::test_quantized_gromov

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.

@cedricvincentcuaz cedricvincentcuaz changed the title first commit : quantized gromov wasserstein solver [WIP] quantized gromov wasserstein solver Feb 11, 2024
Copy link

codecov bot commented Feb 12, 2024

Codecov Report

Attention: Patch coverage is 92.53188% with 41 lines in your changes are missing coverage. Please review.

Project coverage is 96.44%. Comparing base (2472dd4) to head (bb1b342).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #603      +/-   ##
==========================================
- Coverage   96.78%   96.44%   -0.35%     
==========================================
  Files          83       85       +2     
  Lines       16284    16833     +549     
==========================================
+ Hits        15760    16234     +474     
- Misses        524      599      +75     

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.

This is nice, I have a few comments below, contact me on slack if you want to discuss them

README.md Outdated Show resolved Hide resolved
RELEASES.md Outdated Show resolved Hide resolved
examples/gromov/plot_quantized_gromov_wasserstein.py Outdated Show resolved Hide resolved
examples/gromov/plot_quantized_gromov_wasserstein.py Outdated Show resolved Hide resolved
examples/gromov/plot_quantized_gromov_wasserstein.py Outdated Show resolved Hide resolved
ot/gromov/_quantized.py Outdated Show resolved Hide resolved
ot/gromov/_quantized.py Outdated Show resolved Hide resolved
ot/gromov/_quantized.py Outdated Show resolved Hide resolved
ot/gromov/_quantized.py Outdated Show resolved Hide resolved
ot/gromov/_quantized.py Show resolved Hide resolved
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.

None yet

2 participants