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

Duplicate Gaussian code #124

Open
JTT94 opened this issue Aug 19, 2022 · 1 comment
Open

Duplicate Gaussian code #124

JTT94 opened this issue Aug 19, 2022 · 1 comment

Comments

@JTT94
Copy link
Collaborator

JTT94 commented Aug 19, 2022

Duplicate code for estimating Gaussian moments and computing transport maps for Gaussian OT problems
- In tools, Gaussian


and
m = matrix_square_root.sqrtm_only(

- And in ICNN initialisers,
def compute_gaussian_map(self, inputs):
,
mo = sqrtm_only(jnp.dot(jnp.dot(covs_sqrt, covt), covs_sqrt))

It may be worth consolidating these. It may also be worth moving Gaussian computations to /core, or creating a hierarchical structure that does not cause cyclical import errors (see e.g. #98 (comment))

@marcocuturi
Copy link
Contributor

thanks for spotting these James, and, yes, I agree, there's too many sqrtm_only in our code :)

if i can ask another comment, i think the way we store gaussians is not ideal, or requires some debate. When doing gaussian OT, we might have to use $A^{0.5}$, $A$ or $A^{-0.5}$. When computing $W_2^2$, either the first or the second are needed (if computing $A$ to $B$ then $A^{0.5}$ is used, the other way around $A$ is used) whereas to compute the map one needs, similarly, either (1,3) or (2).

I am wondering if, as a preprocessing, we should not store the 3 of them. I know we can recover (2) from (1*1) but that sounds a bit like overkill. so maybe storing the 3 triangular parts is not too complicated? and then redefining the Bures cost (or creating a new one, e.g. BuresTril) could make sense to save memory and compute.

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

No branches or pull requests

2 participants