mixmodMap_M2V: Matrix of Class Assignments to Vector of Labels Conversion

Description Usage Arguments Value Author(s) References Examples

View source: R/mixmodMap_M2V.R

Description

Converts a matrix of class assignments to a vector of labels.

Usage

1
mixmodMap_M2V(M, n = nrow(M), K = ncol(M))

Arguments

M

matrix of class assignments. Rows correspond to observations and columns correspond to classes. Each row contains only zeros except for the column corresponding to the class to which the observation is assigned, which value is one.

n

number of observations.

K

number of classes.

Value

a vector of labels of length n.

Author(s)

J.-P. Baudry and G. Celeux

References

J.-P. Baudry, A. E. Raftery, G. Celeux, K. Lo and R. Gottardo (2010). Combining mixture components for clustering. Journal of Computational and Graphical Statistics, 19(2):332-353.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(1) 

data(Baudry_etal_2010_JCGS_examples)
res <- mixmodCombi(ex4.1, nbCluster = 1:8)

res@hierarchy[[3]]@proba[1:10,] # Is the matrix of posterior probabilities of each of the combined
# classes in the 3-class solution, for the 10 first observations

mixmodMap(res@hierarchy[[3]]@proba[1:10,]) # Is the matrix of corresponding class assignments for
# the 10 first observations 

mixmodMap_M2V(mixmodMap(res@hierarchy[[3]]@proba[1:10,])) # Is the labels vector of the classes
# assigned to the 10 first observations

RmixmodCombi documentation built on May 2, 2019, 1:27 p.m.