public class KMeansClustering extends Object
Constructor and Description |
---|
KMeansClustering(double[][] samples,
String[] sampleIds,
int numClusters)
Constructor.
|
KMeansClustering(File dataFile,
int numClusters)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ArrayList<String> |
getClusterMembers(int clusterIndex)
Get the sample names of all the members in the given cluster.
|
HashMap<String,ArrayList<Double>> |
getClusterMembersData(int clusterIndex)
Returns a hashmap with the values for the members in the given cluster.
|
int |
getMaxIterations()
Returns the maximum number of iterations.
|
int |
getNumberOfClusters()
Returns the number of clusters.
|
void |
kMeanCluster(WaitingHandler waitingHandler)
Run the k-means clustering.
|
static void |
main(String[] args)
Main method for testing purposes.
|
void |
printCentroids()
Print the centroids.
|
void |
printClusters()
Print the current clusters.
|
void |
setMaxIterations(int maxIterations)
Set the maximum number of iterations.
|
public KMeansClustering(double[][] samples, String[] sampleIds, int numClusters)
samples
- the datasampleIds
- the sample identifiersnumClusters
- the number of clusterspublic KMeansClustering(File dataFile, int numClusters)
dataFile
- the file with the datanumClusters
- the number of clusterspublic void kMeanCluster(WaitingHandler waitingHandler)
waitingHandler
- the waiting handlerpublic static void main(String[] args)
args
- the command line argumentspublic void printCentroids()
public void printClusters()
public ArrayList<String> getClusterMembers(int clusterIndex)
clusterIndex
- the index of the clusterpublic HashMap<String,ArrayList<Double>> getClusterMembersData(int clusterIndex)
clusterIndex
- the index of the clusterpublic int getNumberOfClusters()
public int getMaxIterations()
public void setMaxIterations(int maxIterations)
maxIterations
- the maximum number of iterationsCopyright © 2016. All rights reserved.