|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ir.classifiers.PerceptronUnit
public class PerceptronUnit
An individual perceptron object used by the Perceptron classifier Includes methods for classifying an Example and training the unit to fire only for a given category of examples.
Field Summary | |
---|---|
protected java.lang.String[] |
categories
Array of categories (classes) in the data |
boolean |
debug
Flag for debug print statements |
double |
learningRate
The learning rate for weight updating |
int |
maxEpochs
Maximum number of training epochs allowed |
protected double |
threshold
The threshold of the perceptron. |
protected HashMapVector |
weights
The weights of the perceptron. |
Constructor Summary | |
---|---|
PerceptronUnit(java.lang.String[] categories,
boolean debug)
Create an PerceptronUnit with these attributes |
Method Summary | |
---|---|
double |
classify(Example example)
Classify an example using the perceptron and return the amount by which the net input exceeds the threshold as a measure of confidence of the prediction of being positive for this perceptron |
void |
clear()
Clear the weights and threshold all back to zero |
void |
trainCategory(java.util.List trainExamples,
int category)
Trains the perceptron to only fire for examples in the given category, i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected double threshold
protected HashMapVector weights
public int maxEpochs
public double learningRate
protected java.lang.String[] categories
public boolean debug
Constructor Detail |
---|
public PerceptronUnit(java.lang.String[] categories, boolean debug)
categories
- The array of Strings containing the category namesdebug
- Flag to turn on detailed outputMethod Detail |
---|
public void clear()
public double classify(Example example)
public void trainCategory(java.util.List trainExamples, int category)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |