Skip to content
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

fix #375, converged flag when predefined number of iterations. #386

Merged
merged 5 commits into from
Jul 6, 2023

Conversation

marcocuturi
Copy link
Contributor

@marcocuturi marcocuturi commented Jul 4, 2023

Fix #375

New way to compute converged property of SinkhornOutput objects. It was shown that when the number of iterations was predefined (this can be done setting min_iterations=max_iterations in the solver), the output was never marked as converged (the rule to test convergence was simply whether the iteration counter had reached max_iterations.

This fix requires forces the (re?)computation of the error at the very last iteration, and to store the convergence threshold in the SinkhornOutput, to compare it when converged is called.

@marcocuturi marcocuturi requested a review from michalk8 July 4, 2023 13:59
@codecov-commenter
Copy link

codecov-commenter commented Jul 4, 2023

Codecov Report

Merging #386 (6c0ca9e) into main (b2b7ebb) will increase coverage by 0.65%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #386      +/-   ##
==========================================
+ Coverage   87.95%   88.61%   +0.65%     
==========================================
  Files          52       55       +3     
  Lines        5679     5945     +266     
  Branches      841      865      +24     
==========================================
+ Hits         4995     5268     +273     
+ Misses        561      551      -10     
- Partials      123      126       +3     
Impacted Files Coverage Δ
src/ott/math/fixed_point_loop.py 100.00% <ø> (ø)
src/ott/tools/soft_sort.py 95.23% <ø> (ø)
src/ott/solvers/linear/sinkhorn.py 97.53% <100.00%> (+0.59%) ⬆️
src/ott/tools/sinkhorn_divergence.py 94.73% <100.00%> (ø)

... and 8 files with indirect coverage changes

src/ott/solvers/linear/sinkhorn.py Outdated Show resolved Hide resolved
src/ott/solvers/linear/sinkhorn.py Outdated Show resolved Hide resolved
@marcocuturi
Copy link
Contributor Author

thanks for the comments @michalk8 !

@marcocuturi marcocuturi merged commit db9f58a into main Jul 6, 2023
@marcocuturi marcocuturi deleted the mott-375 branch July 13, 2023 17:09
michalk8 pushed a commit that referenced this pull request Jun 27, 2024
* fix 375

* handle conversion of `threshold` in SinkhornOutput

* fix bug in converged when static_b is True

* take Michal comments into account + pydocs

* shape issue in the convergence[0]
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.

converged flag in SinkhornOutput is not reliable.
3 participants