init_start | R Documentation |
Initialize the start matrix for graph matching iteration.
init_start(start, nns, ns = 0, soft_seeds = NULL, seeds = NULL, ...)
start |
A matrix, character, or function. A |
nns |
An integer. Number of non-seeds. |
ns |
An integer. Number of seeds. |
soft_seeds |
A vector, a matrix or a data frame indicating entries of the start matrix that will be initialized at 1 to indicate . See check_seeds. |
seeds |
A vector, a matrix or a data frame. Indicating hard seeds. These are used for "convex" start but otherwise are ignored. |
... |
Arguments passed to other start functions. See details in Values section. |
When start
is a character, there are five options.
"bari"
initializes at the barycenter.
"rds_perm_bari"
gives a random linear combination of barycenter and
a random permutation matrix, (1-a) B + a P. The argument g
controls a
with a being sampled as g * runif()
.
"rds"
gives a random doubly stochastic matrix. Users can specify a
random deviates generator to the distribution
argument, and the default is runif
.
A random matrix with iid entries from distribution
and the the Sinkhorn algorithm is applied
to produce the output.
"rds_from_sim"
gives a random doubly stochastic matrix derived from
similarity scores. One needs to input a similarity score matrix to the sim
argument for this method. The procedure is the same as "rds"
but before
the Sinkhorn algorithm is applied, the entries of the random matrix are scaled by
sim
.
"convex"
returns the doubly stochastic matrix from the last iteration of running the Frank-
Wolfe algorithm with convex relaxation initialized at the barycenter. For this method, one needs to
input two graphs A
and B
, as well as seeds
if applicable.
init_start
returns a nns-by-nns
doubly stochastic matrix as the start
matrix in the graph matching iteration. If conduct a soft seeding graph matching, returns a
nns-by-nns
doubly stochastic matrix with 1's corresponding to the soft seeds and values
at the other places are derived by different start method.
ss <- matrix(c(5, 4, 4, 3), nrow = 2)
# initialize start matrix without soft seeds
init_start(start = "bari", nns = 5)
init_start(start = "rds", nns = 3)
init_start(start = "rds_perm_bari", nns = 5)
init_start(start = "rds_from_sim", nns = 3, sim = matrix(runif(9), 3))
# initialize start matrix with soft seeds
init_start(start = "bari", nns = 5, ns = 1, soft_seeds = ss)
init_start(start = "rds", nns = 5, soft_seeds = ss)
init_start(start = "rds_perm_bari", nns = 5, soft_seeds = ss)
# initialize start matrix for convex graph matching
cgnp_pair <- sample_correlated_gnp_pair(n = 10, corr = 0.3, p = 0.5)
g1 <- cgnp_pair$graph1
g2 <- cgnp_pair$graph2
seeds <- 1:10 <= 2
init_start(start = "convex", nns = 8, A = g1, B = g2, seeds = seeds)
# FW graph matching with incorrect seeds to start at convex start
init_start(start = "convex", nns = 8, ns = 2, soft_seeds = ss, A = g1, B = g2, seeds = seeds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.