Class MedianLinkage

  • All Implemented Interfaces:
    GeometricLinkage, Linkage

    @Reference(authors="J. C. Gower",
               title="A comparison of some methods of cluster analysis",
               booktitle="Biometrics (1967)",
               url="https://doi.org/10.2307/2528417",
               bibkey="doi:10.2307/2528417")
    @Alias({"wpgmc","WPGMC","weighted-centroid"})
    public class MedianLinkage
    extends java.lang.Object
    implements GeometricLinkage
    Median-linkage — weighted pair group method using centroids (WPGMC).

    Similar to WeightedAverageLinkage (WPGMA), the weight of points in this method decreases with the depth of the tree. This yields to difficult to understand semantics of the result, as it does not yield the distance of medians. The method is best defined recursively: \[d_{\text{WPGMC}}(A\cup B,C):=\tfrac{1}{2}d(A,C)+\tfrac{1}{2}d(B,C) -\tfrac{1}{4}d(A,B)\]

    Reference:

    J. C. Gower
    A comparison of some methods of cluster analysis
    Biometrics (1967): 623-637.

    Since:
    0.6.0
    Author:
    Erich Schubert
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MedianLinkage.Par
      Class parameterizer.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static MedianLinkage STATIC
      Static instance of class.
    • Constructor Summary

      Constructors 
      Constructor Description
      MedianLinkage()
      Deprecated.
      use the static instance STATIC instead.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double combine​(int sizex, double dx, int sizey, double dy, int sizej, double dxy)
      Compute combined linkage for two clusters.
      double distance​(double[] x, int sizex, double[] y, int sizey)
      Distance of two aggregated clusters.
      double[] merge​(double[] x, int sizex, double[] y, int sizey)
      Merge the aggregated vectors.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • STATIC

        public static final MedianLinkage STATIC
        Static instance of class.
    • Constructor Detail

      • MedianLinkage

        @Deprecated
        public MedianLinkage()
        Deprecated.
        use the static instance STATIC instead.
        Constructor.
    • Method Detail

      • combine

        public double combine​(int sizex,
                              double dx,
                              int sizey,
                              double dy,
                              int sizej,
                              double dxy)
        Description copied from interface: Linkage
        Compute combined linkage for two clusters.
        Specified by:
        combine in interface Linkage
        Parameters:
        sizex - Size of first cluster x before merging
        dx - Distance of cluster x to j before merging
        sizey - Size of second cluster y before merging
        dy - Distance of cluster y to j before merging
        sizej - Size of candidate cluster j
        dxy - Distance between clusters x and y before merging
        Returns:
        Combined distance
      • merge

        public double[] merge​(double[] x,
                              int sizex,
                              double[] y,
                              int sizey)
        Description copied from interface: GeometricLinkage
        Merge the aggregated vectors.
        Specified by:
        merge in interface GeometricLinkage
        Parameters:
        x - Center of the first cluster
        sizex - Weight of the first cluster
        y - Center of the second cluster
        sizey - Weight of the second cluster
        Returns:
        Combined vector
      • distance

        public double distance​(double[] x,
                               int sizex,
                               double[] y,
                               int sizey)
        Description copied from interface: GeometricLinkage
        Distance of two aggregated clusters.
        Specified by:
        distance in interface GeometricLinkage
        Parameters:
        x - Center of the first cluster
        sizex - Weight of the first cluster
        y - Center of the second cluster
        sizey - Weight of the second cluster
        Returns:
        Distance