For two different partitioning function computes *confusion matrix*.

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

`clust1` |
integer |

`clust2` |
integer |

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. |

`cls.set.section`

returns a n x m integer `matrix`

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

Lukasz Nieweglowski

Result used in `similarity.index`

.

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]))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.