Skip to content

[WIP] Restructure unbalanced OT module #658

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

Merged
merged 25 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- Improved `ot.plot.plot1D_mat` (PR #649)
- Added `nx.det` (PR #649)
- `nx.sqrtm` is now broadcastable (takes ..., d, d) inputs (PR #649)
- restructure `ot.unbalanced` module (PR #658)
- add `ot.unbalanced.lbfgsb_unbalanced2` and add flexible reference measure `c` in all unbalanced solvers (PR #658)

#### Closed issues
- Fixed `ot.gaussian` ignoring weights when computing means (PR #649, Issue #648)
Expand Down
2 changes: 1 addition & 1 deletion ot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@
'factored_optimal_transport', 'solve', 'solve_gromov', 'solve_sample',
'smooth', 'stochastic', 'unbalanced', 'partial', 'regpath', 'solvers',
'binary_search_circle', 'wasserstein_circle',
'semidiscrete_wasserstein2_unif_circle', 'sliced_wasserstein_sphere_unif', 'lowrank_sinkhorn',
'semidiscrete_wasserstein2_unif_circle', 'sliced_wasserstein_sphere_unif', 'lowrank_sinkhorn',
'lowrank_gromov_wasserstein_samples']
2 changes: 1 addition & 1 deletion ot/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def solve(M, a=None, b=None, reg=None, reg_type="KL", unbalanced=None,

value_linear = nx.sum(M * plan)

value = log['loss']
value = log['cost']

else:
raise (NotImplementedError('Not implemented reg_type="{}" and unbalanced_type="{}"'.format(reg_type, unbalanced_type)))
Expand Down
27 changes: 27 additions & 0 deletions ot/unbalanced/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
"""
Solvers related to Unbalanced Optimal Transport problems.

"""

# Author: Quang Huy Tran <[email protected]>
#
# License: MIT License

# All submodules and packages
from ._sinkhorn import (sinkhorn_knopp_unbalanced,
sinkhorn_unbalanced,
sinkhorn_stabilized_unbalanced,
sinkhorn_unbalanced2,
barycenter_unbalanced_sinkhorn,
barycenter_unbalanced_stabilized,
barycenter_unbalanced)

from ._mm import (mm_unbalanced, mm_unbalanced2)

from ._lbfgs import (lbfgsb_unbalanced, lbfgsb_unbalanced2)

__all__ = ['sinkhorn_knopp_unbalanced', 'sinkhorn_unbalanced', 'sinkhorn_stabilized_unbalanced',
'sinkhorn_unbalanced2', 'barycenter_unbalanced_sinkhorn', 'barycenter_unbalanced_stabilized',
'barycenter_unbalanced', 'mm_unbalanced', 'mm_unbalanced2', '_get_loss_unbalanced',
'lbfgsb_unbalanced', 'lbfgsb_unbalanced2']
Loading
Loading