public class RandomLongClusterer extends Object implements SpatialClusterer<LongCentroidsResult,long[]>
Modifier and Type | Field and Description |
---|---|
protected int |
K |
protected int |
M |
protected Random |
random |
protected long |
seed |
Constructor and Description |
---|
RandomLongClusterer(int M)
Creates a new random byte cluster used to create centroids with data containing M elements.
|
RandomLongClusterer(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 |
---|---|
LongCentroidsResult |
cluster(DataSource<long[]> data)
Selects K elements from the provided
DataSource as the centroids of the clusters. |
LongCentroidsResult |
cluster(long[][] data)
Selects K elements from the provided data as the centroids of the clusters.
|
int[][] |
performClustering(long[][] data) |
void |
setSeed(long seed) |
public RandomLongClusterer(int M, int K)
M
- number of elements in each data vectorK
- number of centroids to be createdpublic RandomLongClusterer(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 LongCentroidsResult cluster(long[][] data)
cluster
in interface SpatialClusterer<LongCentroidsResult,long[]>
data
- the data.public int[][] performClustering(long[][] data)
performClustering
in interface Clusterer<long[][]>
public LongCentroidsResult cluster(DataSource<long[]> 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<LongCentroidsResult,long[]>
data
- the data.