T
- the type of centroids.U
- the tpe of observations. Usually, T and U are the same.
But in case of SIB, they are different.public abstract class CentroidClustering<T,U> extends PartitionClustering implements java.lang.Comparable<CentroidClustering<T,U>>
Modifier and Type | Field and Description |
---|---|
T[] |
centroids
The centroids of each cluster.
|
java.util.function.ToDoubleBiFunction<T,U> |
distance
The lambda of distance measure.
|
double |
distortion
The total distortion.
|
k, OUTLIER, size, y
Constructor and Description |
---|
CentroidClustering(double distortion,
T[] centroids,
int[] y,
java.util.function.ToDoubleBiFunction<T,U> distance)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(CentroidClustering<T,U> o) |
int |
predict(U x)
Classifies a new observation.
|
java.lang.String |
toString() |
run, seed
public final double distortion
public final T[] centroids
public CentroidClustering(double distortion, T[] centroids, int[] y, java.util.function.ToDoubleBiFunction<T,U> distance)
distortion
- the total distortion.centroids
- the centroids of each cluster.y
- the cluster labels.distance
- the lambda of distance measure.public int compareTo(CentroidClustering<T,U> o)
compareTo
in interface java.lang.Comparable<CentroidClustering<T,U>>
public int predict(U x)
x
- a new observation.public java.lang.String toString()
toString
in class PartitionClustering