Do.boolean.membership.matrix {mosclust} | R Documentation |
Function to compute and build up a pairwise boolean membership matrix.
Description
It computes the pairwise membership matrix for a given clustering. The number of rows is equal to the number of columns (the number of examples).
The element m_{ij}
is set to 1 if the examples i
and j
belong to the same cluster, otherwise to 0.
This function may be used also with clusterings that do not define strictly a partition of the data and using
diferent number of clusters for each clustering.
Usage
Do.boolean.membership.matrix(cl, dim.M, examplelabels)
Arguments
cl |
a clustering (list of vectors defining a clustering) |
dim.M |
dimension of the similarity matrix (number of examples) |
examplelabels |
labels of the examples drawn from the original data |
Value
the pairwise boolean membership square matrix.
Author(s)
Giorgio Valentini valentini@di.unimi.it
Examples
library("clusterv")
library("stats")
# Synthetic data set generation (3 clusters with 20 examples for each cluster)
M <- generate.sample3(n=20, m=2)
# k-means clustering with 3 clusters
r<-kmeans(t(M), c=3, iter.max = 1000);
# this function is implemented in the clusterv package:
cl <- Transform.vector.to.list(r$cluster);
# generation of boolean membership square matrix:
B <- Do.boolean.membership.matrix(cl, 60, 1:60)
[Package mosclust version 1.0.2 Index]