public abstract class Linkage
extends java.lang.Object
HierarchicalClustering
Constructor and Description |
---|
Linkage(double[][] proximity)
Initialize the linkage with the lower triangular proximity matrix.
|
Linkage(int size,
float[] proximity)
Initialize the linkage with the lower triangular proximity matrix.
|
Modifier and Type | Method and Description |
---|---|
float |
d(int i,
int j)
Returns the distance/dissimilarity between two clusters/objects, which
are indexed by integers.
|
abstract void |
merge(int i,
int j)
Merge two clusters into one and update the proximity matrix.
|
static float[] |
proximity(double[][] data)
Calculate the proximity matrix (linearized in column major) with Euclidean distance.
|
static <T> float[] |
proximity(T[] data,
smile.math.distance.Distance<T> distance)
Calculate the proximity matrix (linearized in column major).
|
int |
size()
Returns the proximity matrix size.
|
public Linkage(double[][] proximity)
public Linkage(int size, float[] proximity)
size
- the data size.proximity
- 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.public int size()
public float d(int i, int j)
public abstract void merge(int i, int j)
i
- cluster id.j
- cluster id.public static float[] proximity(double[][] data)
public static <T> float[] proximity(T[] data, smile.math.distance.Distance<T> distance)