Open atong01 opened 2 days ago
Hi,
The default behavior is now with the KL regularization instead of the entropy. If you add reg_type="entropy"
, you should recover the result of the 0.9.4 version.
>>> import ot
>>> a = [0.5, 0.5]
>>> b = [0.5, 0.5]
>>> M = [[0, 1], [1, 0]]
>>> ot.unbalanced.sinkhorn_knopp_unbalanced(a, b, M, 1, 1, reg_type="entropy")
array([[0.51122814, 0.18807032],
[0.18807032, 0.51122814]])
Hi Clément,
Thank you! May I ask why this changed and / or why it is preferred?
I don't really have a preference but this seems to change (somewhat significantly?) a number of my projects and it would be nice to know what I should be using.
Thanks, Alex
The entropy has a weird impact that it will promote creation of mass which for unbalanced is a bit counter intuitive. For instance the mass of the plan can be greater than the mass of each of the marginals... It was not the standard in any of the unalanced papers to the bets of my knowledge and we originally implemented is to have similar regularization than sinkhorn paper but it wa sprobably a bad idea.
When using the KL you shrink toward the rank one plan (of mass 1 if both marginals sum to 1) so there is no creation of mass.
I am sorry if it breaks things, we usually promote stability in POT (and API is stable) and should have added a warning for the release. We will be more careful next time.
Thank you for the explanation Rémi!
Seems like a better default indeed. Agreed, I would have preferred a warning, but thanks for the upgrade :)
Describe the bug
The output of
ot.unbalanced.sinkhorn_knopp_unbalanced
has changed quite significantly between versionsPOT==0.9.4
andPOT==0.9.5
.CI Test failing in
torchcfm
package across all python and OS versions tested: https://github.com/atong01/conditional-flow-matching/actions/runs/11873892894/job/33098878771?pr=145Behavior has been consistent since at least 0.9.1.
To Reproduce
Steps to reproduce the behavior:
Environment (please complete the following information):
Output of the following code snippet: