Description Usage Arguments Value Examples
View source: R/optimal_transport.R
Function to iterate over a decreasing sequence of lambdas, the penalization parameters. If lambda is big, the function is more concave, so we iterate, starting from Lambda = .5, and decreasing each time by alpha. This method takes longer, but is more likely to converge to the true solution, since we start from a more concave problem and iteratively solve it by setting lambda = alpha * lambda, for alpha in (0,1).
1 2 3 | match_support(X, Y, Q = NULL, lambda_init = 0.5, lambda_final = 0.01,
alpha = 0.95, eps = 0.01, numReps = 100, eps_OT = 0.01,
p = dim(X)[2], q = 0)
|
X |
an n x d dataset of vectors |
Y |
an m x d dataset of vectors |
Q |
an initial guess |
lambda_init |
the initial value of lambda for penalization |
lambda_final |
For termination |
alpha |
the parameter for which lambda is multiplied by |
eps |
the tolerance for the iterative optimal transport problem |
numReps |
the number of reps for each subiteration |
eps_OT |
the tolerance for the individual optimal transport problem |
p |
the dimension of the positive component |
q |
the dimension of the negative component |
a list of the final orthogonal matrix and the assignment matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | library(rstiefel)
set.seed(2030)
X <- matrix(rnorm(100,1,.2),ncol= 4)
Y <- rbind(X,X)
W <- rustiefel(4,4)
Y <- Y %*% W
test <- match_support(X,Y,numReps = 10,Q = diag(c(1,-1,-1,1)))
#cheating a bit by starting with Q with the diagonals equal to
# the sign of the true matrix
# others have pointed out that initializing Q at all 2^d sign matrices ( diagonal matrices
# whose entries are plus or minus one) might have better global
# convergence
set.seed(2010)
X <- matrix(rnorm(100,.2,.02),ncol= 5)
Y <- rbind(X,X)
W <- rustiefel(5,5)
Y <- Y %*% W
test2 <- match_support(X,Y)
norm(test2$Q - W)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.