relabel_kl_log: Relabel membership vector by minimizing KL-algorithm...

View source: R/RcppExports.R

relabel_kl_logR Documentation

Relabel membership vector by minimizing KL-algorithm (log-scale)

Description

Relabels the membership vectors of a mixed membership model or mixed membership stochastic blockmodel, using the KL-algorithm proposed by Stephens (2000).

Usage

relabel_kl_log(
  lphi,
  renormalize = FALSE,
  maxit = 100L,
  nthreads = 0L,
  verbose = TRUE
)

Arguments

lphi

cube of length S, each element of which is a matrix of dimension N times K, where N is the number of individuals and K is the number of extreme types (or classes).

renormalize

if true, renormalizes the rows of each slice of lphi

maxit

the number of maximum iterations to run, defaults to 100.

nthreads

number of threads to use in parallel processing

verbose

if TRUE, number of iterations and corresponding KL-distance values are printed.

Details

OpenMP is enabled if available. Due to overhead, the inner-most loop is parallelized only if the number of latent classes/types is larger than 3.

Value

The function returns a Rcpp::List of three elements. 1) A cube, permuted, of the same dimensions as phi but with the labels permuted; 2) perms is a S times K matrix containing the permutations necessary to produce permuted from phi (i.e., the mapping from phi to permuted); and 3) the number of iterations run.


baruuum/relabelKL documentation built on Feb. 1, 2024, 12:23 a.m.