Description Usage Arguments Details Value Examples
You can relate this type of question to weighted bipartite graphs and subsets of them. In a bipartite graph a matching is a subset of the edges so that no two edges in the subset share a common vertex. It is called a minimum weighted bipartite matching when the graph is a weighted bipartite graph and the sum of all edges in the subset is minimal.
1 | minWeightBipartiteMatching(clusteringA, clusteringB)
|
clusteringA |
Cluster labels from clustering A |
clusteringB |
Cluster labels from clustering B |
This could be represented as a distance matrix having the dimension of the number of clusters where the value between two instances depicts the agreement between these two partitions (one constraint for this approach is that there is the same number of partitions in both clusterings). One clustering is represented by columns and the other one by row or vice versa.
The agreement can be calculated as follows: Calculate the number of elements in the intersection of the two partitions and subtract it twice from the sum of the number of elements in both clusters. The notion behind this computation is that if all elements are in the intersection, the value is zero and hence it is very likely that these two partitions are mapped on each other. The higher the value the more different are the two partitions.
Adapted from: http://things-about-r.tumblr.com/post/36087795708/matching-clustering-solutions-using-the-hungarian
To make the final match based on the created distance matrix solve_LSAP function from 'clue' package is used. It implements Hungarian method of matching with minimization/maximization.
Match between labels of clustering A and labels of clustering B
1 | res <- minWeightBipartiteMatching(labs1, labs2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.