public class RandomShortClusterer extends Object implements SpatialClusterer<ShortCentroidsResult,short[]>
| Modifier and Type | Field and Description |
|---|---|
protected int |
K |
protected int |
M |
protected Random |
random |
protected long |
seed |
| Constructor and Description |
|---|
RandomShortClusterer(int M)
Creates a new random byte cluster used to create centroids with data containing M elements.
|
RandomShortClusterer(int M,
int K)
Creates a new random byte cluster used to create K centroids with data containing M elements.
|
| Modifier and Type | Method and Description |
|---|---|
ShortCentroidsResult |
cluster(DataSource<short[]> data)
Selects K elements from the provided
DataSource as the centroids of the clusters. |
ShortCentroidsResult |
cluster(short[][] data)
Selects K elements from the provided data as the centroids of the clusters.
|
int[][] |
performClustering(short[][] data) |
void |
setSeed(long seed) |
public RandomShortClusterer(int M, int K)
M - number of elements in each data vectorK - number of centroids to be createdpublic RandomShortClusterer(int M)
M - number of elements in each data vectorpublic void setSeed(long seed)
seed - the seed for the Random object used to select random data points.public ShortCentroidsResult cluster(short[][] data)
cluster in interface SpatialClusterer<ShortCentroidsResult,short[]>data - the data.public int[][] performClustering(short[][] data)
performClustering in interface Clusterer<short[][]>public ShortCentroidsResult cluster(DataSource<short[]> data)
DataSource as the centroids of the clusters.
If K is -1 all provided data points will be selected. It is not guaranteed that the same data
point will not be selected many times.cluster in interface SpatialClusterer<ShortCentroidsResult,short[]>data - the data.