Ferdinand-Genans · GitHub

added 4 commits

May 17, 2026 17:06
Introduces ot.semidiscrete: Projected Averaged SGD on the semi-dual,
with an optional decreasing entropic-regularization schedule (DRAG)
from Genans et al. 2025. Works with NumPy, PyTorch, JAX, CuPy and
TensorFlow via ot.backend.
- ot/semidiscrete.py: solve_semidiscrete, atom_weights, ot_map,
  c_transform. Closed-form gradient, no autograd graph through the
  loop; quadratic cost by default with custom-callable override.
- ot/__init__.py: register the new submodule.
- test/test_semidiscrete.py: convergence on three toy problems
  with known optimal potentials, helper-function contracts (row-
  stochasticity of atom_weights, identity for c_transform at g=0,
  shape and finiteness of ot_map), and solver options (warm-start,
  projection, log, polyak_average off, entropic regime, custom
  cost). All tests parametrized over the nx fixture (NumPy + PyTorch).
- examples/others/plot_semidiscrete.py: gallery example on a small
  2D toy problem with Laguerre cells, empirical cell masses and a
  Monte Carlo estimate of the semi-dual cost.
- RELEASES.md: new-features entry under 0.9.7.dev0.
	modified:   RELEASES.md
	modified:   examples/others/plot_semidiscrete.py
Final small doc modifications.
solve_semidiscrete, and added a more detailed
explanation of the effect of this argument on
convergence in the example scipt.
"max_cost" explanation.

@rflamary rflamary changed the title [MRG] Add backend-agnostic semi-discrete OT module and SGD-based solver in ot.semidiscrete [WIP] Add backend-agnostic semi-discrete OT module and SGD-based solver in ot.semidiscrete

May 27, 2026
- README.md: keep new [83] (Spectral-Grassmann) and [84] (BSP-OT) from
  upstream; renumber the DRAG citation to [85].
- RELEASES.md: keep both feature bullets (semidiscrete + sgot).
- ot/__init__.py: keep both new submodule imports (semidiscrete + sgot).
- examples/others/plot_semidiscrete.py: update local refs [83] -> [85]
  consistently with the README.

@Ferdinand-Genans

…rete

rflamary

- Rename public functions to semidiscrete_{atom_weights,ot_map,c_transform}
  and align params with ot.solve_sample (X_target, sampler_source, a_target,
  metric, max_iter, max_cost)
- metric accepts ot.dist strings (default 'sqeuclidean') or a callable
- sampler_source accepts built-in strings ('unif', 'ball', 'normal', ...),
  default 'unif'
- Full docstrings with equations and references to both papers
- Examplel OT-map visualization with arrow  and cell-mass plot
- Tests: use nx.from_numpy, cover the string metric/sampler paths

@Ferdinand-Genans

@Ferdinand-Genans

rflamary

@rflamary rflamary changed the title [WIP] Add backend-agnostic semi-discrete OT module and SGD-based solver in ot.semidiscrete [MRG] Add backend-agnostic semi-discrete OT module and SGD-based solver in ot.semidiscrete

Jun 29, 2026

@rflamary

Read the original on github.com ↗