|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ir.classifiers.Classifier
public abstract class Classifier
Abstract class specifying the functionality of a classifier. Provides methods for training and testing a classifier
Field Summary | |
---|---|
protected java.lang.String[] |
categories
Array of categories (classes) in the data |
protected static java.util.Random |
random
Used for breaking ties in argMax() |
Constructor Summary | |
---|---|
Classifier()
|
Method Summary | |
---|---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.Random random
protected java.lang.String[] categories
Constructor Detail |
---|
public Classifier()
Method Detail |
---|
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |