Skip to content

[MRG] Fix#421 pass stopThr to the sinkhorn function in empirical_sinkhorn_divergence #422

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 4 commits into from
Dec 21, 2022
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 @@ -32,6 +32,8 @@ roughly 2^31) (PR #381)
- Fixed weak optimal transport docstring (Issue #404, PR #410)
- Fixed error whith parameter `log=True`for `SinkhornLpl1Transport` (Issue #412,
PR #413)
- Fix an issue where the parameter `stopThr` in `empirical_sinkhorn_divergence` was rendered useless by subcalls
that explicitly specified `stopThr=1e-9` (Issue #421, PR #422).
- Fixed a bug breaking an example where we would try to make an array of arrays of different shapes (Issue #424, PR #425)


Expand Down
14 changes: 7 additions & 7 deletions ot/bregman.py
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ def get_reg(n): # exponential decreasing
regi = get_reg(ii)

G, logi = sinkhorn_stabilized(a, b, M, regi,
numItermax=numInnerItermax, stopThr=1e-9,
numItermax=numInnerItermax, stopThr=stopThr,
warmstart=(alpha, beta), verbose=False,
print_period=20, tau=tau, log=True)

Expand Down Expand Up @@ -3306,17 +3306,17 @@ def empirical_sinkhorn_divergence(X_s, X_t, reg, a=None, b=None, metric='sqeucli
if log:
sinkhorn_loss_ab, log_ab = empirical_sinkhorn2(X_s, X_t, reg, a, b, metric=metric,
numIterMax=numIterMax,
stopThr=1e-9, verbose=verbose,
stopThr=stopThr, verbose=verbose,
log=log, warn=warn, **kwargs)

sinkhorn_loss_a, log_a = empirical_sinkhorn2(X_s, X_s, reg, a, a, metric=metric,
numIterMax=numIterMax,
stopThr=1e-9, verbose=verbose,
stopThr=stopThr, verbose=verbose,
log=log, warn=warn, **kwargs)

sinkhorn_loss_b, log_b = empirical_sinkhorn2(X_t, X_t, reg, b, b, metric=metric,
numIterMax=numIterMax,
stopThr=1e-9, verbose=verbose,
stopThr=stopThr, verbose=verbose,
log=log, warn=warn, **kwargs)

sinkhorn_div = sinkhorn_loss_ab - 0.5 * (sinkhorn_loss_a + sinkhorn_loss_b)
Expand All @@ -3333,17 +3333,17 @@ def empirical_sinkhorn_divergence(X_s, X_t, reg, a=None, b=None, metric='sqeucli

else:
sinkhorn_loss_ab = empirical_sinkhorn2(X_s, X_t, reg, a, b, metric=metric,
numIterMax=numIterMax, stopThr=1e-9,
numIterMax=numIterMax, stopThr=stopThr,
verbose=verbose, log=log,
warn=warn, **kwargs)

sinkhorn_loss_a = empirical_sinkhorn2(X_s, X_s, reg, a, a, metric=metric,
numIterMax=numIterMax, stopThr=1e-9,
numIterMax=numIterMax, stopThr=stopThr,
verbose=verbose, log=log,
warn=warn, **kwargs)

sinkhorn_loss_b = empirical_sinkhorn2(X_t, X_t, reg, b, b, metric=metric,
numIterMax=numIterMax, stopThr=1e-9,
numIterMax=numIterMax, stopThr=stopThr,
verbose=verbose, log=log,
warn=warn, **kwargs)

Expand Down