Initialization step for the variational expectation maximization algorithm.
expSBM_init(edgelist, K,
method = c("random", "SBM_binary", "SBM_gaussian", "spectral"),
sbm_density = 0.5, blur_value = 1)
A matrix with 4 columns: on the first column the sender node, on the second the receiver, on the third either a one or zero to indicate whether it is an interaction or a non-interaction respectively, on the fourth the corresponding exponential length.
Number of latent groups.
Method used to initialise the allocations. Can be one of random
, SBM_binary
, SBM_gaussian
or spectral
. See details.
If method == "SBM_binary"
, this is the target density for the thresholded binary stochastic blockmodel.
A value between 0 and 1. If 1, the initialization method returns a hard partition where each node belongs to one group and one only. Reducing this value introduces noise, i.e. it gradually transforms the hard clustering into a soft clustering where each node is equally likely to belong to any of the K given clusters.
A NxK
matrix indicating the partitioning of the nodes.
All initialisation methods return a NxK
matrix indicating the partitioning of the nodes.
The method random
intialises the allocation variables uniformly at random.
The method SBM_binary
first calculates the aggregated interaction and non-interaction times for each pair of nodes. Then, it calculates the portion of time when the nodes where interacting over the whole time period. Then it obtains an adjacency matrix by thresholding these values, i.e. values above a given threshold are replaced by ones and values below the threshold are replaced by zeros. The threshold is chosen by setting the parameter sbm_density
which defines the desired density of the graph. Once the adjacency matrix is obtained, a binary stochastic blockmodel is fit on the data hence obtaining the partition.
The method SBM_gaussian
aggregates the interaction values and non-interaction values for each pair of nodes. Then it log-transforms both of these quantities. Then it fits a stochastic blockmodel with multivariate Gaussian edges to obtain the partition.
The method spectral
first calculates the aggregated interaction and non-interaction times for each pair of nodes. Then, it calculates the portion of time when the nodes where interacting over the whole time period. Then it performs model-based clustering on the Laplacian associated to this weighted matrix.
# NOT RUN {
set.seed(12345)
data(high_school)
K <- 4
lambda_init <- rep(1/K,K)
expSBM_init(high_school$edgelist, K, "random")
# }
Run the code above in your browser using DataLab