edu.cmu.minorthird.classify.algorithms.linear
Class MarginPerceptron
java.lang.Object
edu.cmu.minorthird.classify.OnlineClassifierLearner
edu.cmu.minorthird.classify.OnlineBinaryClassifierLearner
edu.cmu.minorthird.classify.algorithms.linear.MarginPerceptron
- All Implemented Interfaces:
- BinaryClassifierLearner, ClassifierLearner, java.lang.Cloneable
public class MarginPerceptron
- extends OnlineBinaryClassifierLearner
Perceptron algorithm. Slighly modified to (a) update when
examples don't satisfy a margin requirement and (b) optionally,
classify with a voting scheme.
- Author:
- William Cohen
Method Summary |
void |
addExample(Example example)
Subclasses should use this method to perform whatever
incremental update is needed after in response to a new
example. |
void |
completeTraining()
A promise from the caller that no further examples will be added. |
Classifier |
getClassifier()
Subclasses should use this method to return the current
classifier. |
void |
reset()
'forget' everything about the last learning task, and
start a new task. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MarginPerceptron
public MarginPerceptron()
MarginPerceptron
public MarginPerceptron(double minMargin,
boolean voteBeforeTrainingComplete,
boolean voteAfterTrainingComplete)
reset
public void reset()
- Description copied from class:
OnlineClassifierLearner
- 'forget' everything about the last learning task, and
start a new task. Subclasses need to implement this
method
- Specified by:
reset
in interface ClassifierLearner
- Specified by:
reset
in class OnlineClassifierLearner
addExample
public void addExample(Example example)
- Description copied from class:
OnlineClassifierLearner
- Subclasses should use this method to perform whatever
incremental update is needed after in response to a new
example.
- Specified by:
addExample
in interface ClassifierLearner
- Specified by:
addExample
in class OnlineClassifierLearner
completeTraining
public void completeTraining()
- Description copied from class:
OnlineClassifierLearner
- A promise from the caller that no further examples will be added.
Override this method if it's appropriate.
- Specified by:
completeTraining
in interface ClassifierLearner
- Overrides:
completeTraining
in class OnlineClassifierLearner
getClassifier
public Classifier getClassifier()
- Description copied from class:
OnlineClassifierLearner
- Subclasses should use this method to return the current
classifier.
- Specified by:
getClassifier
in interface ClassifierLearner
- Specified by:
getClassifier
in class OnlineClassifierLearner
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object