| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectemolib.util.proc.TextDataProcessor
emolib.classifier.Classifier
emolib.classifier.machinelearning.KNearestNeighbour
public class KNearestNeighbour
The KNearestNeighbour is an example-based classifier that uses the k-Nearest Neighbour method.
Computes the `k' nearest elements according to a distance measure (e.g., euclidean) in the feature space (e.g., the circumplex). Decides the resulting affective category according to the majority vote among these `k' elements. The number of emotional dimensions of use has to be specified.
| Field Summary | |
|---|---|
| static java.lang.String | PROP_NUM_EMO_DIMSProperty to determine the number of emotional dimensions the KNN deals with. | 
| Constructor Summary | |
|---|---|
| KNearestNeighbour()Main constructor of this example-based classifier. | |
| Method Summary | |
|---|---|
|  java.lang.String | getCategory(FeatureBox inputFeatures)The function that decides the most appropriate emotional category. | 
|  void | load(java.lang.String path)Generic function to load a previously saved classifier. | 
|  void | newProperties(PropertySheet ps)This method is called when this configurable component has new data. | 
|  void | register(java.lang.String name,
         Registry registry)Register my properties. | 
|  void | save(java.lang.String path)Generic method to save the fully fledged classifier into a given file path. | 
|  void | setNumberOfEmotionalDimensions(int numDims)Method to set the number of emotional dimensions. | 
|  void | setNumberOfNeighbours(int number)Method to set the number of neighbors to consider (k) when evaluating this classifier. | 
|  void | trainingProcedure()Void method to train required by the Classifier class. | 
| Methods inherited from class emolib.classifier.Classifier | 
|---|
| applyClassification, getData, getListOfExampleCategories, getListOfExampleFeatures, initialize, inputTrainingExample, resetExamples, train | 
| Methods inherited from class emolib.util.proc.TextDataProcessor | 
|---|
| flush, getName, getPredecessor, setPredecessor, toString | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
public static final java.lang.String PROP_NUM_EMO_DIMS
| Constructor Detail | 
|---|
public KNearestNeighbour()
| Method Detail | 
|---|
public void register(java.lang.String name,
                     Registry registry)
              throws PropertyException
Configurable
register in interface Configurableregister in class Classifiername - the name of the componentregistry - the registry for this component
PropertyException
public void newProperties(PropertySheet ps)
                   throws PropertyException
Configurable
newProperties in interface ConfigurablenewProperties in class Classifierps - a property sheet holding the new data
PropertyException - if there is a problem with the properties.public void setNumberOfEmotionalDimensions(int numDims)
numDims - The number of emotional dimensions.public void setNumberOfNeighbours(int number)
number - The number of neighbors.public java.lang.String getCategory(FeatureBox inputFeatures)
Classifier
getCategory in class ClassifierinputFeatures - The input emotional features.
public void trainingProcedure()
trainingProcedure in class Classifierpublic void save(java.lang.String path)
Classifier
save in class Classifierpath - The file path to save the classifier.public void load(java.lang.String path)
Classifier
load in class Classifierpath - The path of the file which contains the previously saved
 classifier.| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||