Minimize/Compute Posterior Expectation of Binders Loss Function
Minimize/Compute Posterior Expectation of Binders Loss Function
Based on a posterior similarity matrix of a sample of clusterings minbinder finds the clustering that minimizes the posterior expectation of Binders loss function, while binder computes the posterior expected loss for several provided clusterings.
psm: a posterior similarity matrix, usually obtained from a call to comp.psm.
cls, cls.draw: a matrix in which every row corresponds to a clustering of the ncol(cls) objects. cls.draw refers to the clusterings that have been used to compute psm, cls.draw has to be provided if method="draw" or "all".
method: the maximization method used. Should be one of "avg", "comp", "draws", "laugreen" or "all". The default is "avg".
max.k: integer, if method="avg" or "comp" the maximum number of clusters up to which the hierarchical clustering is cut. Defaults to ceiling(nrow(psm)/4).
include.lg: logical, should method "laugreen" be included when method="all"? Defaults to FALSE.
start.cl: clustering used as starting point for method="laugreen". If NULLstart.cl= 1:nrow(psm) is used.
tol: convergence tolerance for method="laugreen".
Details
The posterior expected loss is the sum of the absolute differences of the indicator function of observation i and j clustering together and the posterior probability that they are in one cluster.
For method="avg" and "comp"1-psm is used as a distance matrix for hierarchical clustering with average/complete linkage. The hierachical clustering is cut for the cluster sizes 1:max.k and the posterior expected loss is computed for these clusterings.
Method "draws" simply computes the posterior expected loss for each row of cls.draw and takes the minimum.
Method "laugreen" implements the algorithm of Lau and Green (2007), which is based on binary integer programming. Since the method can take some time to converge it is only used if explicitly demanded with method="laugreen" or method="all"andinclude.lg=TRUE. If method="all" all minimization methods except "laugreen" are applied.
Returns
cl: clustering with minimal value of expected loss. If method="all" a matrix containing the clustering with the smallest value of the expected loss over all methods in the first row and the clusterings of the individual methods in the next rows.
value: value of posterior expected loss. A vector corresponding to the rows of cl if method="all".
method: the maximization method used.
iter.lg: if method="laugreen" the number of iterations the method needed to converge.
comp.psm for computing posterior similarity matrix, maxpear, medv, relabel
for other possibilities for processing a sample of clusterings. lp for the linear programming.
Examples
data(cls.draw2)# sample of 500 clusterings from a Bayesian cluster model tru.class <- rep(1:8,each=50)# the true grouping of the observationspsm2 <- comp.psm(cls.draw2)mbind2 <- minbinder(psm2)table(mbind2$cl, tru.class)# Does hierachical clustering with Ward's method lead # to a lower value of Binders loss?hclust.ward <- hclust(as.dist(1-psm2), method="ward")cls.ward <- t(apply(matrix(1:20),1,function(k) cutree(hclust.ward,k=k)))ward2 <- binder(cls.ward, psm2)min(ward2)< mbind2$value
# Method laugreen is applied to 40 randomly selected observationsind <- sample(1:400,40)mbind.lg <- minbinder(psm2[ind, ind],cls.draw2[,ind], method="all", include.lg=TRUE)mbind.lg$value