-
Notifications
You must be signed in to change notification settings - Fork 2
Optimal Transport from 1D Vector #13
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
Conversation
|
The issue is type instability as I thought :( To try to deal with the case where the plan is the in the sorted order. But I guess this causes problems for the compiler. Any ideas on how to solve this? |
|
Ok, so it was actually a typo in the test! This piece of code is actually solid :) |
Pull Request Test Coverage Report for Build 1396825672
💛 - Coveralls |
Codecov Report
@@ Coverage Diff @@
## main #13 +/- ##
==========================================
+ Coverage 96.83% 97.07% +0.24%
==========================================
Files 4 4
Lines 158 171 +13
==========================================
+ Hits 153 166 +13
Misses 5 5
Continue to review full report at Codecov.
|
|
@devmotion and @zsteve , are you guys good with such kind of dispatch? This allows users to simple do: I'll be doing a PR for the multivariate case shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not happy about this PR. We already support OT with 1D vectors and also ot_cost, ot_plan, and wasserstein with 1D vectors. Maybe it should just be better documented.
I think we should not define ot_cost and ot_plan in this way and in particular we should not make uprobs and vprobs keyword arguments (BTW the signature in the docstring is different from the implementation). We should be consistent with the other ot_cost and ot_plan and only allow the cost and the measures (no vectors) as inputs. Users should just use discretemeasure.
In the same way, a consistent API should require them to write e.g squared2wasserstein(discretemeasure(rand(10)), discretemeasure(rand(10), probs)). This is much clearer and avoids redundant implementations.
|
Ok. So I guess we should export |
Pull Request Test Coverage Report for Build 1396802728Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
This PR creates a version of
ot_costandot_planthat receivesusupport,vsupportanduprobs,uprobs. In case the vector of probabilities is not passed, it assumes that all entries have equal probability.The PR has one test that is failing that I was not able to figure out where is coming from.
One thing that I tried doing was "NOT" sorting the vector, but returning the transport plan for the order given. I'm guessing this is the thing that is causing some issues, because when the transport plan is provided to the
ot_costfunction, it has to reorder it for to be properly used, and I'm guessing there might be some compilation issues.