Learn R Programming

clv (version 0.3-2.1)

confusion.matrix: Confusion Matrix - External Measures, Cluster Stability

Description

For two different partitioning function computes confusion matrix.

Usage

confusion.matrix(clust1, clust2)

Arguments

clust1
integer vector with information about cluster id the object is assigned to. If vector is not integer type, it will be coerced with warning.
clust2
integer vector with information about cluster id the object is assigned to. If vector is not integer type, it will be coerced with warning.

Value

cls.set.section returns a n x m integer matrix where n = |P| and m = |P'| defined above.

Details

Let P and P' be two different partitioning of the same data. Partitionings are represent as two vectors clust1, clust2. Both vectors should have the same length. Confusion matrix measures the size of intersection between clusters comming from P and P' according to equation: M[i,j] = | intersection of P(i) and P'(j) | where:
P(i)
- cluster which belongs to partitioning P,
P'(j)
- cluster which belongs to partitioning P',

See Also

Result used in similarity.index.

Examples

Run this code
# create two different subsamples 
mx1 <- matrix(as.integer( c(1,2,3,4,5,6,1,1,2,2,3,3) ), 6, 2 )
mx2 <- matrix(as.integer( c(1,2,4,5,6,7,1,1,2,2,3,3) ), 6, 2 )
# find section
m = cls.set.section(mx1,mx2)
confusion.matrix(as.integer(m[,2]),as.integer(m[,3]))

Run the code above in your browser using DataLab