org.aisb.bio.tools
Class EuclideanMeanClassifier

java.lang.Object
  extended byorg.aisb.bio.tools.Classifier
      extended byorg.aisb.bio.tools.EuclideanMeanClassifier

public class EuclideanMeanClassifier
extends Classifier

This classifier just figures out the mean of all the features in the training data, and then classifies data by calculating the Euclidean distance between the data to be classified and the means for the categories. Pretty simple stuff.

In this particular case, the "data" must be a vector (array) of doubles. Each elemenet of data must be of the same length, but we don't need to care what that length is.

Author:
Doug DeJulio

Constructor Summary
EuclideanMeanClassifier()
           
 
Method Summary
 java.lang.String classify(java.lang.Object testData)
          Given a trained classifier, use it to classify a piece of data.
 void finishTraining()
           
 void startTraining()
           
 void train(java.lang.String label, java.lang.Object trainingDatum)
          Feed training data to the classifier.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EuclideanMeanClassifier

public EuclideanMeanClassifier()
Method Detail

startTraining

public void startTraining()
Overrides:
startTraining in class Classifier

finishTraining

public void finishTraining()
Overrides:
finishTraining in class Classifier

train

public void train(java.lang.String label,
                  java.lang.Object trainingDatum)
Description copied from class: Classifier
Feed training data to the classifier.

Specified by:
train in class Classifier
Parameters:
label - The label that this unit of data has.
trainingDatum - The data to be used for classification.

classify

public java.lang.String classify(java.lang.Object testData)
Description copied from class: Classifier
Given a trained classifier, use it to classify a piece of data.

Specified by:
classify in class Classifier
Parameters:
testData - The data to be classified.
Returns:
The label the classifier assigns to this data.