iterative_optimal_transport: Iterate the optimal transport problem with penalization for...

Description Usage Arguments Value Examples

View source: R/optimal_transport.R

Description

Function to iterate optimal transport based on sinkhorn divergence, for a fixed penalization parameter

Usage

1
2
3
iterative_optimal_transport(X, Y, Q = NULL, lambda = 0.01,
  eps = 0.01, numReps = 1000, eps_OT = 0.01, p = dim(X)[2],
  q = 0)

Arguments

X

the n x d matrix of vectors

Y

the m x d matrix of vectors

Q

optional, an initialization point

lambda

the penalization parameter

eps

tolerance for computing sinkhorn divergence

numReps

when to stop

eps_OT

tolerance for the individual optimal transport problem

p

the dimension of the positive component

q

the dimension of the negative component

Value

a list of the final Pi and Q

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(rstiefel)
set.seed(2019)
X <- matrix(rnorm(1000,1,.2),ncol= 4)
Y <- rbind(X,X)
W <- rustiefel(4,4)
Y <- Y %*% W
test <- iterative_optimal_transport(X,Y,numReps = 1000,lambda = .0001)
norm(test$Q - W,"2")
X <- matrix(rnorm(5000,.2,.02),ncol= 5)
Y <- rbind(X,X)
W <- rustiefel(5,5)
Y <- Y %*% W
Y <- matrix(rnorm(200,.7),ncol =5)
test2 <- iterative_optimal_transport(X,Y,numReps = 1000,lambda = .0001)
norm(test2$Q - W,"2")

jagterberg/nonparGraphTesting documentation built on Feb. 4, 2022, 1:31 a.m.