Skip to content

[WIP] Wrapper for OT barycenter solvers with free support #730

Open
cedricvincentcuaz wants to merge 29 commits intoPythonOT:masterfrom
cedricvincentcuaz:solvers
Open

[WIP] Wrapper for OT barycenter solvers with free support #730
cedricvincentcuaz wants to merge 29 commits intoPythonOT:masterfrom
cedricvincentcuaz:solvers

Conversation

@cedricvincentcuaz
Copy link
Collaborator

@cedricvincentcuaz cedricvincentcuaz commented Apr 21, 2025

Types of changes

  • creation of the class ot.utils.BaryResult extending OTResult

  • Long term objectives: Wrap all barycenter solvers available in POT and more, ideally establishing links between these wrappers and those for inner OT solvers ot.solve_sample, ot.solve, and ot.solve_gromov - respectively associated with their barycenter solver ot.solve_bary_sample (free support); ot.solve_bary (free masses); ot.solve_bary_gromov (free joint support)

  • a) ot.solvers.bary_free_support systematically optimizes the support of the barycenter using BCD with closed forms. Only metrics in ('sqeuclidean', 'euclidean') are supported for now. The solver calls an hidden function _bary_sample_bcd.

  • b) handle variations in masses across OT problems only for unbalanced problems - keeping masses unchanged for exact and inexact sinkhorn like solvers - via parameter update_masses in ot.solvers._bary_sample_bcd.

  • c) Handle given initialization of transport plans & potentials + warmstart strategies : added parameter warmstart to bary_sample, and based on the requested inner solver, we pick the adequate strategy warmstart_plan or warmstart_potentials passed to _bary_sample_bcd .

  • d) Options for stopping criterion between losses and barycenter variations: added parameter stopping_criterion in ('loss', 'bary') passed to _bary_sample_bcd.

Extensions let for future works:

  • a) extend metrics via the generalized free support barycenter solvers.
  • b) include lazy inner solvers referenced in the list lst_method_lazy (in ot.solvers)

How has this been tested (if it applies)

  • a) test.test_solvers.assert_allclose_bary_sol method to compare solutions as BaryResult objects.
  • b) test_solve_bary_sample grid across all available barycenter solvers depending on those available in ot.solvers.solve_sample.
  • c) test_solve_bary_sample_NotImplemented test error messages for methods not implemented yet.

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 22, 2025

Codecov Report

❌ Patch coverage is 91.55556% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.82%. Comparing base (41a4d57) to head (05b47fc).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #730      +/-   ##
==========================================
- Coverage   96.87%   96.82%   -0.06%     
==========================================
  Files         113      113              
  Lines       23062    23285     +223     
==========================================
+ Hits        22342    22546     +204     
- Misses        720      739      +19     
🚀 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] Wrappers for OT barycenter solvers [WIP] Wrapper for OT barycenter solvers with free support Mar 9, 2026
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