# Class WeightedAverageLinkage

java.lang.Object
ch.usi.inf.sape.hac.agglomeration.WeightedAverageLinkage

All Implemented Interfaces:
  `AgglomerationMethod`

public final class WeightedAverageLinkage extends Object implements AgglomerationMethod
The "weighted average", "McQuitty", or "Weighted Pair-Group Method using Arithmetic averages, or WPGMA)" method. Average linkage where the sizes of the clusters are assumed to be equal. This method, similar to "Median", weights small and large clusters equally. [The data analysis handbook. By Ildiko E. Frank, Roberto Todeschini] 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 "McQuitty" method: ai = 0.5 aj = 0.5 b = 0 g = 0 Thus: d[(i,j),k] = 0.5*d[i,k] + 0.5*d[j,k]

## Constructor Summary

Constructors
Constructor
Description
`WeightedAverageLinkage()`

## Method Summary

Modifier and Type
Method
Description
`double`
`computeDissimilarity(double dik, double djk, double dij, int ci, int cj, int ck)`
Compute the dissimilarity between the newly formed cluster (i,j) and the existing cluster k.
`String`
`toString()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### WeightedAverageLinkage

public WeightedAverageLinkage()

## 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`