relabelTRUE: Relabel MCMC output by minimizing KL-divergence to true...

View source: R/relabelTRUE.R

relabelTRUER Documentation

Relabel MCMC output by minimizing KL-divergence to true assignment probabilities

Description

Relabels the membership vectors of a mixed membership model or mixed membership stochastic blockmodel, by minimizing the KL-divergence to a priori known true labels.

Usage

relabelTRUE(
  x,
  x_true,
  log_p = TRUE,
  renormalize = FALSE,
  nthreads = 0L,
  verbose = TRUE
)

Arguments

x

an S\*N\*K array of MCMC samples containing the the assignment probabilities to latent classes/extreme types, where N is the number of units/individuals, K the number of latent classes, and S the number of posterior samples

x_true

matrix of dimension N\*K which contains the true assignment/mixed-membership probabilities

log_p

if TRUE, treats elements in x as log-probabilities

renormalize

if TRUE, renormalizes the rows of x and x_true

nthreads

number of threads to use in parallel calculations

verbose

if true, prints KL-divergence to true probabilities before and after relabeling

Value

Returns a list of two elements: permuted, the relabeled array and, perms, the permutation pattern used for each sample


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