transport_plan {approxOT} | R Documentation |
Optimal transport plans
Description
Optimal transport plans
Usage
transport_plan(
X,
Y,
a = NULL,
b = NULL,
p = 2,
ground_p = 2,
observation.orientation = c("rowwise", "colwise"),
method = transport_options(),
...
)
Arguments
X |
The covariate data of the first sample. |
Y |
The covariate data of the second sample. |
a |
Optional. Empirical measure of the first sample |
b |
Optional. Empirical measure of the second sample |
p |
The power of the Wasserstein distance |
ground_p |
The power of the Lp norm |
observation.orientation |
Are observations by row ("rowwise") or column ("colwise"). |
method |
Which transportation method to use. See [transport_options][transport_options] |
... |
Additional arguments for various methods
|
Value
a list with slots "tplan" and "cost". "tplan" is the optimal transport plan and "cost" is the optimal transport distance.
Examples
set.seed(203987)
n <- 100
d <- 10
x <- matrix(stats::rnorm(d*n), nrow=d, ncol=n)
y <- matrix(stats::rnorm(d*n), nrow=d, ncol=n)
#get hilbert sort orders for x in backwards way
transx <- transport_plan(X=x, Y=x, ground_p = 2, p = 2,
observation.orientation = "colwise",
method = "hilbert")