public class KMeansAlg extends Object
Constructor and Description |
---|
KMeansAlg(DataHolder data)
Initialize the standard K-means algorithm
|
Modifier and Type | Method and Description |
---|---|
void |
delete()
Clear
|
void |
generateSeed()
Generate random seeds for initial centroids
|
DataHolder |
getCenters()
Returns cluster centers
|
int |
getClusters()
Get number of clusters
|
double |
getCompactness()
This method returns the Compactness
|
int |
getError()
Return error
|
String |
getName()
Name for this algorithm.
|
int[] |
getNumberPoints()
Returns the number of points in each cluster
|
double[][] |
getSeed()
Return seeds
|
DataHolder |
getSeedHolder()
Get positions of seeds
|
long |
getSize()
This method returns the estimated size (steps) for this task.
|
void |
run()
Run classic K-Means clustering algorithm.
|
void |
run(int Iter)
Runs the k-means several iterations to find best seed values
Only iteration with the best compactness is taken.
|
void |
runKM()
Classic K-Means clustering algorithm.
|
void |
setClusters(int numClusters)
Set the designed number of clusters
|
void |
setOptions(int maxIterations,
double epsilon)
Set initial options for calculations
|
void |
setSeed(double[][] seed)
Set seeds by hand
|
public KMeansAlg(DataHolder data)
data
- input datapublic void setClusters(int numClusters)
numClusters
- expected number of clusterspublic int getClusters()
public void generateSeed()
public void setSeed(double[][] seed)
seed
- positions of seedspublic double[][] getSeed()
public void setOptions(int maxIterations, double epsilon)
maxIterations
- the maximum number of iterations.epsilon
- a small value used to verify if clustering has converged.public void delete()
public DataHolder getCenters()
public DataHolder getSeedHolder()
public int[] getNumberPoints()
public void run()
public void runKM()
public double getCompactness()
public void run(int Iter)
Iter
- Number of iterationspublic int getError()
public long getSize()
public String getName()
Jas4pp 1.5 © Java Analysis Studio for Particle Physics