Skip to content

Conversation

cedricvincentcuaz
Copy link
Collaborator

@cedricvincentcuaz cedricvincentcuaz commented Apr 21, 2025

Types of changes

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

first draft for OT barycenter solvers with free support and predefined metric ot.solvers.bary_free_support built on top of ot.solvers.solve_sample, extending significantly available OT objectives for the barycenter problem.

  • 1-a) ot.solvers.bary_free_support systematically optimize the support of the barycenter using BCD with closed forms, and optionally learn masses if not learn_b=False. Only metrics in ('sqeuclidean', 'euclidean') are support for now. The solver calls an hidden function _bary_sample_bcd.
  • 1-b) [TO Check] extend metrics via the generalized free support barycenter solvers.
  • 1-c) 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.
  • 1-d) 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 .
  • 1-e) Options for stopping criterion between losses and barycenter variations: added parameter stopping_criterion in ('loss', 'bary') passed to _bary_sample_bcd.
    1. [TO DO] see how to handle best learn_b=True
    1. [TO DO] Extension to support lazy tensors as in ot.solve_sample
    1. [TO DO] Complete documentation

Motivation and context / Related issue

    1. test.test_solvers.assert_allclose_bary_sol method to compare solutions as BaryResult objects. test_bary_sample grid across all available barycenter solvers depending on those available in ot.solvers.solve_sample.

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

Codecov Report

❌ Patch coverage is 87.92271% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.06%. Comparing base (5a7d086) to head (7132f62).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #730      +/-   ##
==========================================
- Coverage   97.15%   97.06%   -0.09%     
==========================================
  Files         107      107              
  Lines       21877    22082     +205     
==========================================
+ Hits        21254    21434     +180     
- Misses        623      648      +25     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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