chens5 / w1estimators

4 stars 1 forks source link

About the norm used to calculate 1-wasserstein distance in the table 2 of the article #1

Open yh329 opened 1 month ago

yh329 commented 1 month ago

Since we have $L_1$, $L2$ and $L\infty$ in the table 2 of the paper 2104.07710, while the code only provides the flowtree method implementation with $L_2$-norm, is it the case that in these three scenarios in table 2 ($L_1$, $L2$, $L\infty$), the wasserstein distance of the flowtree approach are all calculated through $L_2$-norm?

chens5 commented 1 month ago

Hello, the flowtree relies on an underlying quadtree structure which is computed assuming that the underlying metric is $$L_2$$ distance. Given an optimal flow on the quadtree, the $$L_1$$, $$L2$$, and $$L\infty$$ in table 2 refer to the norm used to compute $$\sum_{(p, q) \in P \times Q} | p - q| f(p, q) $$. The ground truth Wasserstein distance in each case is computed via the $$L_1$$, $$L2$$, and $$L\infty$$ norms, respectively.

yh329 commented 2 weeks ago

I just reviewed the example code given in python/example.py (line 83-87) and found that the norm used in flowtree approach can be adjusted:

for i in queries:
        for j in candidates:
            hera_results.append(gudhi.hera.wasserstein_distance(diagrams[i], diagrams[j], order =1, internal_p=2))
            ft_results.append(solver.flowtree_distance(flowtree_diagrams[i], flowtree_diagrams[j], 2))
            emb_results.append(solver.embedding_distance(i, j))

But can we change the norm used by solver.embedding_distance, which (as I understand) is the function that calculates the distance by the embedding approach?

chens5 commented 2 weeks ago

No, solver.embedding_distance always uses $$L_1$$ because it is the same as the tree shortest path distance.

yh329 commented 2 days ago

If I understand it correctly is all the three algorithms in example.py approximating $$d{W,1}^{\text{per}}(P,Q):= \min{\Gamma} \sum_{(p,q)\in \Gamma}\Vert p-q\Vert_2$$?

Or is the $L1$ embedding approach approximating $$d{W,1}^{\text{per}}(P,Q):= \min{\Gamma} \sum{(p,q)\in \Gamma}\Vert p-q\Vert_1$$?