@@ -322,3 +322,48 @@ true
322322```
323323"""
324324barycenter (A, C, ε; kwargs... ) = pot. barycenter (A, C, ε; kwargs... )
325+
326+ """
327+ barycenter_unbalanced(A, C, ε, λ; kwargs...)
328+
329+ Compute the entropically regularized unbalanced Wasserstein barycenter with histograms `A`, cost matrix
330+ `C`, entropic regularization parameter `ε` and marginal relaxation parameter `λ`.
331+
332+ The Wasserstein barycenter is a histogram and solves
333+ ```math
334+ \\ inf_{a} \\ sum_{i} W_{\\ varepsilon,C,\\ lambda}(a, a_i),
335+ ```
336+ where the histograms ``a_i`` are columns of matrix `A` and ``W_{\\ varepsilon,C,\\ lambda}(a, a_i)}``
337+ is the optimal transport cost for the entropically regularized optimal transport problem
338+ with marginals ``a`` and ``a_i``, cost matrix ``C``, entropic regularization parameter
339+ ``\\ varepsilon`` and marginal relaxation parameter ``\\ lambda``. Optionally, weights of the histograms ``a_i`` can be provided with the
340+ keyword argument `weights`.
341+
342+ This function is a wrapper of the function
343+ [`barycenter_unbalanced`](https://pythonot.github.io/gen_modules/ot.unbalanced.html#ot.unbalanced.barycenter_unbalanced) in the
344+ Python Optimal Transport package. Keyword arguments are listed in the documentation of the
345+ Python function.
346+
347+ # Examples
348+
349+ ```jldoctest
350+ julia> A = rand(10, 3);
351+
352+ julia> A ./= sum(A; dims=1);
353+
354+ julia> C = rand(10, 10);
355+
356+ julia> isapprox(sum(barycenter_unbalanced(A, C, 0.01, 1; method="sinkhorn_stabilized")), 1; atol=1e-4)
357+ false
358+
359+ julia> isapprox(sum(barycenter_unbalanced(
360+ A, C, 0.01, 10_000; method="sinkhorn_stabilized", numItermax=5_000
361+ )), 1; atol=1e-4)
362+ true
363+ ```
364+
365+ See also: [`barycenter`](@ref)
366+ """
367+ function barycenter_unbalanced (A, C, ε, λ; kwargs... )
368+ return pot. barycenter_unbalanced (A, C, ε, λ; kwargs... )
369+ end
0 commit comments