|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectAlgorithm
AlgorithmKMeans
public class AlgorithmKMeans
implements the K nearest neighbor algorithms
Field Summary | |
---|---|
static long |
RAND_SEED
The random number generator |
Constructor Summary | |
---|---|
AlgorithmKMeans()
|
Method Summary | |
---|---|
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. |
Methods inherited from class Algorithm |
---|
computeMeans, disableControl, enableControl, nextStep, prevStep, scaleToFitData, setDataPoints, setOutputPanel, setProcessBox |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long RAND_SEED
Constructor Detail |
---|
public AlgorithmKMeans()
Method Detail |
---|
public boolean initialize()
initialize
in class Algorithm
public void run()
run
in interface java.lang.Runnable
run
in class Algorithm
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 cluster
MyPoint
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 implementation
public java.util.Vector<MyPoint> getDecisionRegion(java.util.Vector<MyPoint> vec)
vec
- vector of initial guesses
public void outputDecisionRegion()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |