# Confusion Matrix - External Measures, Cluster Stability

### Description

For two different partitioning function computes *confusion matrix*.

### Usage

1 | ```
confusion.matrix(clust1, clust2)
``` |

### Arguments

`clust1` |
integer |

`clust2` |
integer |

### 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', |

|A| | - cardinality of set A. |

### Value

`cls.set.section`

returns a n x m integer `matrix`

where n = |P| and m = |P'| defined above.

### Author(s)

Lukasz Nieweglowski

### See Also

Result used in `similarity.index`

.

### Examples

1 2 3 4 5 6 | ```
# 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]))
``` |