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