ir.classifiers
Class Classifier
java.lang.Object
|
+--ir.classifiers.Classifier
- Direct Known Subclasses:
- KNN, NaiveBayes, Rocchio
- public abstract class Classifier
- extends java.lang.Object
Abstract class specifying the functionality of a classifier. Provides methods for
training and testing a classifier
Method Summary |
protected int |
argMax(double[] results)
Returns the array index with the maximum value |
abstract java.lang.String |
getName()
To be overloaded by the extending class |
abstract void |
setInvertedIndex(ir.vsr.InvertedIndex index)
For classifiers that use invertedIndices, this function sets
them -- needed for efficient memory management |
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.Vector trainingExamples)
Trains the classifier on the training examples |
abstract boolean |
usesInvertedIndex()
To indicated whether this classifier uses inverted index |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Classifier
public Classifier()
usesInvertedIndex
public abstract boolean usesInvertedIndex()
- To indicated whether this classifier uses inverted index
setInvertedIndex
public abstract void setInvertedIndex(ir.vsr.InvertedIndex index)
- For classifiers that use invertedIndices, this function sets
them -- needed for efficient memory management
getName
public abstract java.lang.String getName()
- To be overloaded by the extending class
train
public abstract void train(java.util.Vector trainingExamples)
- Trains the classifier on the training examples
test
public abstract boolean test(Example testExample)
- Returns true if the predicted category of the test example matches the correct category,
false otherwise
argMax
protected int argMax(double[] results)
- Returns the array index with the maximum value