Class MedianLinkage

java.lang.Object
ch.usi.inf.sape.hac.agglomeration.MedianLinkage
All Implemented Interfaces:
AgglomerationMethod

public final class MedianLinkage extends Object implements AgglomerationMethod
The "median", "weighted centroid", "weighted center of mass distance", "Gower", or "Weighted Pair-Group Method using Centroids (WPGMC)" method is a geometric approach. The size of the clusters is assumed to be equal and the position of the new centroid is always between the two old centroids. This method preserves the importance of a small cluster when it is merged with a large cluster. [The data analysis handbook. By Ildiko E. Frank, Roberto Todeschini] Can produce a dendrogram that is not monotonic (it can have so called inversions, which are hard to interpret). This occurs when the distance from the union of two clusters, r and s, to a third cluster is less than the distance between r and s. Used only for Euclidean distance! The distance between two clusters is the Euclidean distance between their weighted centroids. The general form of the Lance-Williams matrix-update formula: d[(i,j),k] = ai*d[i,k] + aj*d[j,k] + b*d[i,j] + g*|d[i,k]-d[j,k]| For the "median" method: ai = 0.5 aj = 0.5 b = -0.25 g = 0 Thus: d[(i,j),k] = 0.5*d[i,k] + 0.5*d[j,k] - 0.25*d[i,j]
  • Constructor Details

    • MedianLinkage

      public MedianLinkage()
  • Method Details

    • computeDissimilarity

      public double computeDissimilarity(double dik, double djk, double dij, int ci, int cj, int ck)
      Description copied from interface: AgglomerationMethod
      Compute the dissimilarity between the newly formed cluster (i,j) and the existing cluster k.
      Specified by:
      computeDissimilarity in interface AgglomerationMethod
      Parameters:
      dik - dissimilarity between clusters i and k
      djk - dissimilarity between clusters j and k
      dij - dissimilarity between clusters i and j
      ci - cardinality of cluster i
      cj - cardinality of cluster j
      ck - cardinality of cluster k
      Returns:
      dissimilarity between cluster (i,j) and cluster k.
    • toString

      public String toString()
      Overrides:
      toString in class Object