Skip to content

[MRG] Fix quantized (F)GW solvers - #857

Open
cedricvincentcuaz wants to merge 24 commits into
PythonOT:masterfrom
cedricvincentcuaz:quantizedgw
Open

cedricvincentcuaz wants to merge 24 commits into
PythonOT:masterfrom
cedricvincentcuaz:quantizedgw

Conversation

@cedricvincentcuaz

@cedricvincentcuaz cedricvincentcuaz commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Types of changes

Fix quantized (F)GW solvers that output mis-ordered indices in final OT plan (Issue #786 ).
Implies modifications of API, providing:

  • new parameters part1 and part2 as inputs to quantized_fused_gromov_wasserstein_partitioned. These variables were computed via get_graph_partition but formatted as a list or array-like containing the node assignments. This has been reformatted as a list of array-like, where each array contains the indices of the nodes in the partition, to avoid redundant steps in the previous implementations.

  • The construction of the transport plan in quantized_fused_gromov_wasserstein_partitioned is support by two hidden functions _build_full_transport_by_assignment (numpy, torch - mutable) and _build_full_transport_by_concatenation (other non-mutable backends) to leverage a more memory-efficient approach for mutable backends.

  • Also fixed a few issues in the example file, where the detailed steps leading to the use of quantized_fused_gromov_wasserstein_partitioned were not leading to the same outputs as the wrapper quantized_fused_gromov_wasserstein because the fallback strategies in the latter for partitioning and representative selection, when networkx and sklearn could be imported, were incorrect.

Motivation and context / Related issue

How has this been tested (if it applies)

  • This ordering mismatch was missed by previous tests because marginals were systematically instantiated as uniform ones. I alternated between random marginals and uniform ones to catch potential issues.
  • Additional tests were integrated to cover the different situations where NetworkX and/or scikit-learn cannot be imported, with more sensitive fallback strategies in the qFGW wrapper to random partitioning and representative selection schemes -> see test_quantized_gw_only_falls_back_for_missing_dependencies.

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 Quantizedgw [WIP] Fix quantized (F)GW solvers Sep 14, 2026
@codecov

codecov Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.54%. Comparing base (415e95b) to head (7f48113).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #857      +/-   ##
==========================================
- Coverage   96.86%   95.54%   -1.33%     
==========================================
  Files         128      128              
  Lines       26307    26349      +42     
==========================================
- Hits        25483    25174     -309     
- Misses        824     1175     +351     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cedricvincentcuaz cedricvincentcuaz changed the title [WIP] Fix quantized (F)GW solvers [MRG] Fix quantized (F)GW solvers Oct 3, 2026

This branch has not been deployed

No deployments
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.

2 participants