Package cc.mallet.classify
Class BalancedWinnowTrainer
- java.lang.Object
-
- cc.mallet.classify.ClassifierTrainer<BalancedWinnow>
-
- cc.mallet.classify.BalancedWinnowTrainer
-
- All Implemented Interfaces:
Boostable
,java.io.Serializable
public class BalancedWinnowTrainer extends ClassifierTrainer<BalancedWinnow> implements Boostable, java.io.Serializable
An implementation of the training methods of a BalancedWinnow on-line classifier. Given a labeled instance (x, y) the algorithm computes dot(x, wi), for w1, ... , wc where wi is the weight vector for class i. The instance is classified as class j if the value of dot(x, wj) is the largest among the c dot products.The weight vectors are updated whenever the the classifier makes a mistake or just barely got the correct answer (highest dot product is within delta percent higher than the second highest). Suppose the classifier guessed j and answer was j'. For each feature i that is present, multiply w_ji by (1-epsilon) and multiply w_j'i by (1+epsilon)
The above procedure is done multiple times to the training examples (default is 5), and epsilon is cut by the cooling rate at each iteration (default is cutting epsilon by half).
- Author:
- Gary Huang ghuang@cs.umass.edu
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class cc.mallet.classify.ClassifierTrainer
ClassifierTrainer.ByActiveLearning<C extends Classifier>, ClassifierTrainer.ByIncrements<C extends Classifier>, ClassifierTrainer.ByInstanceIncrements<C extends Classifier>, ClassifierTrainer.ByOptimization<C extends Classifier>, ClassifierTrainer.Factory<CT extends ClassifierTrainer<? extends Classifier>>
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_COOLING_RATE
0.5static double
DEFAULT_DELTA
0.1static double
DEFAULT_EPSILON
0.5static int
DEFAULT_MAX_ITERATIONS
30-
Fields inherited from class cc.mallet.classify.ClassifierTrainer
finishedTraining, validationSet
-
-
Constructor Summary
Constructors Constructor Description BalancedWinnowTrainer()
Default constructor.BalancedWinnowTrainer(double epsilon, double delta, int maxIterations, double coolingRate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BalancedWinnow
getClassifier()
BalancedWinnow
train(InstanceList trainingList)
Trains the classifier on the instance list, updating class weight vectors as appropriate-
Methods inherited from class cc.mallet.classify.ClassifierTrainer
getValidationInstances, isFinishedTraining, setValidationInstances
-
-
-
-
Field Detail
-
DEFAULT_EPSILON
public static final double DEFAULT_EPSILON
0.5- See Also:
- Constant Field Values
-
DEFAULT_DELTA
public static final double DEFAULT_DELTA
0.1- See Also:
- Constant Field Values
-
DEFAULT_MAX_ITERATIONS
public static final int DEFAULT_MAX_ITERATIONS
30- See Also:
- Constant Field Values
-
DEFAULT_COOLING_RATE
public static final double DEFAULT_COOLING_RATE
0.5- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BalancedWinnowTrainer
public BalancedWinnowTrainer()
Default constructor. Sets all features to defaults.
-
BalancedWinnowTrainer
public BalancedWinnowTrainer(double epsilon, double delta, int maxIterations, double coolingRate)
- Parameters:
epsilon
- percentage by which to increase/decrease weight vectors when an example is misclassified.delta
- percentage by which the highest (and correct) dot product should exceed the second highest dot product before we consider an example to be correctly classified (margin width) when adjusting weights.maxIterations
- maximum number of times to loop through training examples.coolingRate
- percentage of epsilon to decrease after each iteration
-
-
Method Detail
-
getClassifier
public BalancedWinnow getClassifier()
- Specified by:
getClassifier
in classClassifierTrainer<BalancedWinnow>
-
train
public BalancedWinnow train(InstanceList trainingList)
Trains the classifier on the instance list, updating class weight vectors as appropriate- Specified by:
train
in classClassifierTrainer<BalancedWinnow>
- Parameters:
trainingList
- Instance list to be trained on- Returns:
- Classifier object containing learned weights
-
-