public abstract class Classifier
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| protected java.lang.String[] | categoriesArray of categories (classes) in the data | 
| protected static java.util.Random | randomUsed for breaking ties in argMax() | 
| Constructor and Description | 
|---|
| Classifier() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected int | argMax(double[] results)Returns the array index with the maximum value | 
| java.lang.String[] | getCategories()Returns the categories (classes) in the data | 
| abstract java.lang.String | getName()The name of a classifier | 
| abstract boolean | test(Example testExample)Returns true if the predicted category of the test example matches the correct category,
 false otherwise | 
| abstract void | train(java.util.List<Example> trainingExamples)Trains the classifier on the training examples | 
protected static java.util.Random random
protected java.lang.String[] categories
public abstract java.lang.String getName()
public java.lang.String[] getCategories()
public abstract void train(java.util.List<Example> trainingExamples)
trainingExamples - a list of Example objects that will be used
                         for training the classifierpublic abstract boolean test(Example testExample)
protected int argMax(double[] results)
results - Array of doubles whose index with max value is to be found.
                Ties are broken randomly.