Manipulation of cost matrix and infinite cost #166
Replies: 1 comment 2 replies
-
Hi Paul! thanks so much for trying out OTT. I have migrated this to a discussion, because I think the points you mention sound more like a discussion on OTT and regularized OT than issues w.r.t the code base itself. Here are a few answers inlined:
In general this can be tricky, because setting some entries of the cost matrix to infinite might, in many cases, for the problem to have an infinite optimum. When using Sinkhorn, it can be even trickier. Basically the Sinkhorn algorithm is guaranteed to converge when the kernel matrix
I am not sure I understand this fix.
In general, that won't be acceptable, but you can set it to a large value indeed.
I think that if you want to enter a custom cost matrix, the "JAX" functional way would be to consider
Yes, usually the
That would be much better.
You mean like a mask? I think that if your criteria to decide whether the cost is very large or multiplied by 1 only depends on |
Beta Was this translation helpful? Give feedback.
-
Problem:
While trying to reproduce the codes from the Single-cell genomics page on my own data, I wondered if it was possible to manipulate the cost matrix before using the
sinkhorn
function.If we know that some couplings are impossible, independently of their distance between the
x
andy
arrays, is it possible to define these costs as infinite to penalize them when running thesinkhorn
function ? Is it theoretically acceptable to have infinite costs when using OT with thesinkhorn
function or others OT algorithms? Are there alternatives to penalize couplings that do not involve infinite values? Should i just runsinkhorn
function for several separatedPointCloud
objects with only possible coupling observations (no infinite values then)?Solutions considered:
In case infinite values is acceptable, how should I create this new cost matrix?
geom.cost_matrix = new_cost_matrix
returns an error (AttributeError).CostFn
that performs this step directly, in a custompairwise
method for example?scale_cost
but for matrix multiplication)?Beta Was this translation helpful? Give feedback.
All reactions