Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Low Rank - Linear, Quadratic problems API #26

Open
zoepiran opened this issue Jan 18, 2022 · 0 comments
Open

Low Rank - Linear, Quadratic problems API #26

zoepiran opened this issue Jan 18, 2022 · 0 comments

Comments

@zoepiran
Copy link

Hi,
we noticed some inconsistencies in the API for solvers (Regular and Low Rank) between Linear and Quadratic problems and thought it may be useful to report them. Surely these may be a result of our misunderstanding and in that case we would be grateful for your clarifications.
Issues:
(1) epsilon: for a Linear problem one must provide it through the Geometry object whereas in Quadratic passed to the solver.
(2) Low Rank solver: two separate solvers in the Linear case, single solver for the Quadratic case.

We believe the code snippet below depicts the above in a straightforward manner.
Thank you in advance! :)

    if alpha == 0: # Linear problem
        ot_prob = ott.core.problems.LinearProblem(M)
        if epsilon: # regular (epsilon passed through Geometry M )
            solver = ott.core.sinkhorn.Sinkhorn()
        else: # Low rank (rank passed)
            solver = ott.core.sinkhorn_lr.LRSinkhorn(rank=rank)
    else: # Quadratic problem
        if alpha == 1: # GW
            ot_prob = ott.core.quad_problems.QuadraticProblem(geom_xx=C1,
                                                              geom_yy=C2,
                                                              fused_penalty=0)
        else: # FGW
            ot_prob = ott.core.quad_problems.QuadraticProblem(geom_xx=C1,
                                                              geom_yy=C2,
                                                              geom_xy=M,
                                                              fused_penalty=(1 - alpha) / alpha)
        [a one liner passing both epsilon and rank (whichever is not None implies usage)]
        solver = ott.core.gromov_wasserstein.GromovWasserstein(epsilon=epsilon, rank=rank)
    ot_gw = solver(ot_prob)```
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant