Conversation
…s_cost div_to_product(pi, a, b, pi1, pi2) was called as (pi, pi1, pi2, a, b), so with reg_type="independent" (UCOOT) the entropic terms used the plan marginals as reference measures and the reference measures as marginals. Fixes PythonOT#854 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
6Ulm
approved these changes
Sep 15, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #855 +/- ##
=======================================
Coverage 96.85% 96.85%
=======================================
Files 128 128
Lines 26161 26181 +20
=======================================
+ Hits 25337 25357 +20
Misses 824 824 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Types of changes
Motivation and context / Related issue
Fixes #854.
div_to_producttakes(pi, a, b, pi1=None, pi2=None, ...), but both calls infused_unbalanced_across_spaces_cost(thereg_type="independent"/ UCOOT branch) passed(pi, pi1, pi2, a, b, ...). The entropic terms were therefore computed with the plan marginals as the reference measuresa,band the reference measurespx,pyas the marginalspi1,pi2. Fordivergence="l2", wherepi1/pi2are ignored, the cost was taken against the product of the plan's own marginals instead ofpx ⊗ py.This swaps the arguments back into the documented order for both the sample and the feature coupling.
How has this been tested (if it applies)
Added
test_fused_unbalanced_across_spaces_cost_independent_reg(KL and L2): it checks that the regularisation part of the cost equalseps_samp * div_to_product(pi_samp, px_samp, py_samp) + eps_feat * div_to_product(pi_feat, px_feat, py_feat). The test fails on current master for both divergences and passes with the fix.test/gromov(217 passed) andtest/test_ucoot.py(133 passed) pass locally with the numpy backend.AI disclosure: this fix and test were made with Claude Code under my supervision; I checked the argument order against the
div_to_productsignature and ran the tests locally.PR checklist
🤖 Generated with Claude Code