Skip to content

enable & expose ground distance power#60

Open
corybrunson wants to merge 4 commits into
mainfrom
pq
Open

enable & expose ground distance power#60
corybrunson wants to merge 4 commits into
mainfrom
pq

Conversation

@corybrunson

Copy link
Copy Markdown
Member

This PR makes minimal changes to the C++ to enable the use of the internal_p argument, which corresponds to the Wasserstein distance parameter designated $q$ in help(wasserstein_distance). It would resolve #47. In addition to C++ and R source code, the documentation and validation vignette are updated accordingly.

While i think external source code should in general be modified only as needed for binding purposes, i think this change is justified by the companion journal article, which states that this parameter is available to users, i.e. the software was originally designed with it in mind. A natural use case is for statistical analysis packages that depend on phutil to be able to tune this parameter.

In a breaking change to the current version, wasserstein_distance() deploys bottleneck_distance() only when p == Inf && q == Inf; when p is large, it proceeds with the internal wassersteinDistance() with a warning. The threshold for this warning is p >= 6, which is smaller than the current p > 20, due to my lesson from experience that R may crash for certain pairs of small diagrams even with these values. We may want to replace the warning with an error, perhaps with a parameter that allows the user to override it; but at least the bottleneck deployment is more honest.

I want to proceed cautiously with this upgrade, but i've experimented enough locally that i feel comfortable initiating it. : )

@corybrunson
corybrunson requested a review from astamm July 10, 2026 15:51
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

Successfully merging this pull request may close these issues.

expose alternative Minkowski metrics for the plane

1 participant