org.apache.mahout.classifier.discriminative
Class WinnowTrainer
java.lang.Object
org.apache.mahout.classifier.discriminative.LinearTrainer
org.apache.mahout.classifier.discriminative.WinnowTrainer
public class WinnowTrainer
- extends LinearTrainer
This class implements training according to the winnow update algorithm.
Constructor Summary |
WinnowTrainer(int dimension)
Initializes with dimension and promotionStep of 2. |
WinnowTrainer(int dimension,
double promotionStep)
|
WinnowTrainer(int dimension,
double promotionStep,
double threshold,
double init,
double initBias)
|
Method Summary |
protected void |
update(double label,
Vector dataPoint,
LinearModel model)
Implement this method to match your training strategy. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WinnowTrainer
public WinnowTrainer(int dimension,
double promotionStep,
double threshold,
double init,
double initBias)
WinnowTrainer
public WinnowTrainer(int dimension,
double promotionStep)
throws CardinalityException
- Throws:
CardinalityException
WinnowTrainer
public WinnowTrainer(int dimension)
- Initializes with dimension and promotionStep of 2.
- Parameters:
dimension
- number of features.
update
protected void update(double label,
Vector dataPoint,
LinearModel model)
- Implement this method to match your training strategy. Winnow update works such that in case the predicted label
does not match the real label, the weight vector is updated as follows: In
case the prediction was positiv but should have been negative, all entries
in the weight vector that correspond to non null features in the example
are doubled.
In case the prediction was negative but should have been positive, all
entries in the weight vector that correspond to non null features in the
example are halfed.
- Specified by:
update
in class LinearTrainer
- Parameters:
label
- the target label of the wrongly classified data point.dataPoint
- the data point that was classified incorrectly.model
- the model to update.
Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.