Class WardLinkage

java.lang.Object
smile.clustering.linkage.Linkage
smile.clustering.linkage.WardLinkage

public class WardLinkage extends Linkage
Ward's linkage. Ward's linkage follows the analysis of variance approach The dissimilarity between two clusters is computed as the increase in the "error sum of squares" (ESS) after fusing two clusters into a single cluster. Ward's Method seeks to choose the successive clustering steps so as to minimize the increase in ESS at each step. Note that it is only valid for Euclidean distance based proximity matrix.
  • Constructor Details

    • WardLinkage

      public WardLinkage(double[][] proximity)
      Constructor.
      Parameters:
      proximity - the proximity matrix. Only the lower half will be referred.
    • WardLinkage

      public WardLinkage(int size, float[] proximity)
      Constructor. Initialize the linkage with the lower triangular proximity matrix.
      Parameters:
      size - the data size.
      proximity - the column-wise linearized proximity matrix that stores only the lower half. The length of proximity should be size * (size+1) / 2. To save space, Linkage will use this argument directly without copy. The elements may be modified.
  • Method Details

    • of

      public static WardLinkage of(double[][] data)
      Computes the proximity and the linkage.
      Parameters:
      data - the data points.
      Returns:
      the linkage.
    • of

      public static <T> WardLinkage of(T[] data, Distance<T> distance)
      Computes the proximity and the linkage.
      Type Parameters:
      T - the data type of points.
      Parameters:
      data - the data points.
      distance - the distance function.
      Returns:
      the linkage.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • merge

      public void merge(int i, int j)
      Description copied from class: Linkage
      Merges two clusters into one and update the proximity matrix.
      Specified by:
      merge in class Linkage
      Parameters:
      i - cluster id.
      j - cluster id.