init_start {iGraphMatch} | R Documentation |
Initialization of the start matrix
Description
Initialize the start matrix for graph matching iteration.
Usage
init_start(start, nns, ns = 0, soft_seeds = NULL, seeds = NULL, ...)
Arguments
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. |
Details
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 argumentg
controls a with a being sampled asg * runif()
. -
"rds"
gives a random doubly stochastic matrix. Users can specify a random deviates generator to thedistribution
argument, and the default isrunif
. A random matrix with iid entries fromdistribution
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 thesim
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 bysim
. -
"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 graphsA
andB
, as well asseeds
if applicable.
Value
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.
Examples
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)