Skip to content

[WIP] Wrappers for OT barycenter solvers #730

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

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

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 samples and predefined metric ot.solvers.bary_sample built on top of ot.solvers.solve_sample extending significantly available OT losses for the barycenter problem.

  • 1-a) learn_X=True and learn_b=False equivalent to free support POT solvers using BCD with closed form. Only metrics in ('sqeuclidean', 'euclidean') are support for now. The solver calls an hidden function _bary_sample_bcd.
  • 1-b) [TO DO] extend metrics
  • 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 best handle learn_X=True and learn_b=True
    1. [TO DO] learn_X=False and learn_b=True should be solved via future ot.solvers.bary after computing built-in cost matrices.
    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

Attention: Patch coverage is 83.64486% with 35 lines in your changes missing coverage. Please review.

Project coverage is 85.27%. Comparing base (8aed2d7) to head (671788d).

❗ There is a different number of reports uploaded between BASE (8aed2d7) and HEAD (671788d). Click for more details.

HEAD has 25 uploads less than BASE
Flag BASE (8aed2d7) HEAD (671788d)
26 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #730       +/-   ##
===========================================
- Coverage   97.09%   85.27%   -11.82%     
===========================================
  Files         100      100               
  Lines       20432    20644      +212     
===========================================
- Hits        19839    17605     -2234     
- Misses        593     3039     +2446     
🚀 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.

1 participant