Skip to content

[WIP] Gaussian initialization for sinkhorn#555

Open
rflamary wants to merge 1 commit intomasterfrom
gauss_init
Open

[WIP] Gaussian initialization for sinkhorn#555
rflamary wants to merge 1 commit intomasterfrom
gauss_init

Conversation

@rflamary
Copy link
Copy Markdown
Collaborator

@rflamary rflamary commented Nov 2, 2023

Types of changes

This is a first shot for intializing empirical sinkhorn but the computational gain is not very clear on tests I did locally.

The following code

n = 2000
rng = np.random.RandomState(0)

x = rng.randn(n, 2)
x2 = 10*rng.randn(n//2, 2)
x2[:,0]+=2


ot.tic()
G, log = ot.empirical_sinkhorn(x,x2, 1, method='sinkhorn_log', warmstart=None, verbose=False, isLazy=False, stopThr=1e-5, log = True)
ot.toc()
print("Err=",log['err'][-1], "niter=", log['niter'])

ot.tic()
G2, log2 = ot.empirical_sinkhorn(x,x2, 1, method='sinkhorn_log', warmstart='gaussian', verbose=False, isLazy=False, stopThr=1e-5, log = True)
ot.toc()
print("Err=",log2['err'][-1], "niter=", log2['niter'])

give sthe following output

Elapsed time : 3.0527355670928955 s
Err= 9.441113655553818e-06 niter= 140
Elapsed time : 2.391462564468384 s
Err= 9.89690596643644e-06 niter= 110`

Quite far from the computational gains in the paper. Will investigate it more.

Motivation and context / Related issue

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 2, 2023

Codecov Report

❌ Patch coverage is 91.83673% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.70%. Comparing base (53dde7a) to head (b3be5a6).
⚠️ Report is 136 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (53dde7a) and HEAD (b3be5a6). Click for more details.

HEAD has 12 uploads less than BASE
Flag BASE (53dde7a) HEAD (b3be5a6)
14 2
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #555       +/-   ##
===========================================
- Coverage   96.49%   83.70%   -12.79%     
===========================================
  Files          67       67               
  Lines       14663    14708       +45     
===========================================
- Hits        14149    12312     -1837     
- Misses        514     2396     +1882     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cedricvincentcuaz
Copy link
Copy Markdown
Collaborator

I believe that your implementation is correct, i am not sure how authors handle the bias in empirical_bures_wasserstein_mapping set by default to True in POT.
From the experiments in the paper I would say that gains seem specific to low regimes for the entropic regularization, did you check that ?

@rflamary
Copy link
Copy Markdown
Collaborator Author

will do. iI have students looking into this. Will come ack to the PR after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants