match_support_entropy: Match Datasets probabilistically

Description Usage Arguments Value Examples

View source: R/tward.R

Description

Matches the maps using probabilistic entropy maximization

Usage

1
match_support_entropy(X, Y, sigma = 0.1, numReps = 100)

Arguments

X

an n x d matrix of vectors

Y

an n x d matrix of vectors

sigma

a tuning parameter

numReps

the number of iterations.

Value

The final orthogonal matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
library(rstiefel)
set.seed(2019)
#generate a bunch of normals
X <- matrix(rnorm(1000,1,.2),ncol= 4)
#implicit assignment from X to Y
Y <- rbind(X,X)
#generate a random 4 x 4 orthogonal matrix
W <- rustiefel(4,4)

#hit Y by the orthogonal matrix
Y <- Y %*% W

#Solve the problem using both max entropy and optimal transport
test <- match_support_entropy(X,Y,numReps = 20)
test2 <-match_support(X,Y,numReps = 50, alpha =.5)


X <- matrix(rnorm(100,.2,.02),ncol= 5)
Y <- rbind(X,X)
W <- rustiefel(5,5)
Y <- Y %*% W
test <- match_support_entropy(X,Y,numReps = 10)

test2 <- match_support(X,Y,numReps = 10)


set.seed(2018)
X <- matrix(rnorm(900,1,.1),ncol= 9)
Y <- rbind(X,X)
W <- rustiefel(9,9)
Y <- Y %*% W
test <- match_support_entropy(X,Y,numReps = 50)
test2 <- match_support(X,Y,lambda_init = 4,numReps = 10,Q=W)


D <- 3
N <- 50
M <- 60
X <- matrix(rnorm(N*D),N,D)
X <- t(t(X)/sqrt(colSums(X^2)))
Y <- matrix(rnorm(M*D),M,D)
Y = t(t(Y)/sqrt(colSums(Y^2)))
X = abs(X)
Y = -abs(Y)
sigma = 0.1
niter = 50
test <- match_support_entropy(X,Y,sigma=.1,numReps = 50)
test2 <- match_support(X,Y,lambda_init = 1,numReps =10)

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