public class AlgorithmKMeans extends Algorithm
Modifier and Type | Field and Description |
---|---|
static long |
RAND_SEED
The random number generator
|
Constructor and Description |
---|
AlgorithmKMeans() |
Modifier and Type | Method and Description |
---|---|
void |
classify(DecisionRegion region)
Classifies the data sets based on the k-means iterative algorithm
|
void |
computeMeans(DecisionRegion region)
Computes the means of the data sets after each iteraion
|
int |
displayClusterError(int closest,
java.util.Vector cluster,
int id)
determines the number of points in error, i.e, not classified
by finding the distance of the datapoints from the closest of
the vector set
|
void |
generateMeans(int numMeans)
Generates random initial guesses (means) for the data set
|
void |
generatePool()
Collects all the data points of all the data sets
|
int |
getClosestSet(MyPoint mean)
Determines the closest data sets to the cluster
|
java.util.Vector<MyPoint> |
getDecisionRegion(java.util.Vector<MyPoint> vec)
Computes the k-mean decision region - nearest neighbor algorithm
|
boolean |
initialize()
Overrides the initialize() method in the base class.
|
void |
initializeKmeans()
Initializes the kmean array with the original data sets
|
void |
outputDecisionRegion()
displays the decision region on the output panel
|
void |
run()
Implementation of the run function from the Runnable interface.
|
computeMeans, disableControl, enableControl, nextStep, prevStep, scaleToFitData, setDataPoints, setInputPanel, setOutputPanel, setProcessBox
public static final long RAND_SEED
public boolean initialize()
initialize
in class Algorithm
public void run()
public void generatePool()
public void generateMeans(int numMeans)
numMeans
- number of mean pointspublic void initializeKmeans()
public void classify(DecisionRegion region)
region
- - stored data sets from the classificationDecisionRegion
public void computeMeans(DecisionRegion region)
region
- - classified data setsDecisionRegion
public int getClosestSet(MyPoint mean)
mean
- mean point of the clusterMyPoint
public int displayClusterError(int closest, java.util.Vector cluster, int id)
closest
- the data specifying which of the dataset is the
closest.cluster
- the data points which form a closest clusterid
- unused in current implementationpublic java.util.Vector<MyPoint> getDecisionRegion(java.util.Vector<MyPoint> vec)
vec
- vector of initial guessespublic void outputDecisionRegion()