struct.classification
Class KBestMiraClassifierTrainer

java.lang.Object
  extended by edu.umass.cs.mallet.base.classify.ClassifierTrainer
      extended by struct.classification.KBestMiraClassifierTrainer

public class KBestMiraClassifierTrainer
extends edu.umass.cs.mallet.base.classify.ClassifierTrainer

The KBestMira classifier trainer which trains a linear classifier.

Version:
08/22/2006

Field Summary
private  boolean averaging
           
private  double C
           
private  int iterations
           
private  int K
           
private static java.util.logging.Logger logger
           
 
Constructor Summary
KBestMiraClassifierTrainer(int K)
          Trains default # of iterations (5).
KBestMiraClassifierTrainer(int K, int iterations)
          Trains without slack variable (C).
KBestMiraClassifierTrainer(int K, int iterations, double C)
          Trains with averaging.
KBestMiraClassifierTrainer(int K, int iterations, double C, boolean averaging)
           
 
Method Summary
private  edu.umass.cs.mallet.base.classify.Classifier getNewClassifier(edu.umass.cs.mallet.base.types.InstanceList trainingSet)
           
private  edu.umass.cs.mallet.base.classify.Classifier modify(edu.umass.cs.mallet.base.types.InstanceList trainingSet, edu.umass.cs.mallet.base.classify.Classifier initialClassifier)
           
private  ClassificationInstance[] readData(edu.umass.cs.mallet.base.types.InstanceList iList)
           
 edu.umass.cs.mallet.base.classify.Classifier train(edu.umass.cs.mallet.base.types.InstanceList trainingSet, edu.umass.cs.mallet.base.types.InstanceList validationSet, edu.umass.cs.mallet.base.types.InstanceList testSet, edu.umass.cs.mallet.base.classify.ClassifierEvaluating evaluator, edu.umass.cs.mallet.base.classify.Classifier initialClassifier)
          Creates a new linear classifier and trains it or else just trains the classifier if the classifier is not null.
private  void trainClassifier(LinearClassifier linearClassifier, edu.umass.cs.mallet.base.types.InstanceList trainingSet, int numIter)
          Trains the classifier.
 
Methods inherited from class edu.umass.cs.mallet.base.classify.ClassifierTrainer
main, toString, train, train, train, train
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static java.util.logging.Logger logger

K

private int K

C

private double C

iterations

private int iterations

averaging

private boolean averaging
Constructor Detail

KBestMiraClassifierTrainer

public KBestMiraClassifierTrainer(int K)
Trains default # of iterations (5). Trains without slack variable (C = infinity). Trains with averaging.

Parameters:
K - - the K in KBestMira

KBestMiraClassifierTrainer

public KBestMiraClassifierTrainer(int K,
                                  int iterations)
Trains without slack variable (C). Trains with averaging.

Parameters:
K - - the K in KBestMira
iterations - - the number of iterations to use in training

KBestMiraClassifierTrainer

public KBestMiraClassifierTrainer(int K,
                                  int iterations,
                                  double C)
Trains with averaging.

Parameters:
K - - the K in KBestMira
iterations - - the number of iterations to use in training
C - - The slack variable (clipping). Reasonable values are .1, .01. 1 usually ensures a full update, 0 will never update.

KBestMiraClassifierTrainer

public KBestMiraClassifierTrainer(int K,
                                  int iterations,
                                  double C,
                                  boolean averaging)
Parameters:
averaging - - Train with averaging.
K - - the K in KBestMira
iterations - - the number of iterations to use in training
C - - The slack variable (clipping). Reasonable values are .1, .01. 1 usually ensures a full update, 0 will never update.
Method Detail

train

public edu.umass.cs.mallet.base.classify.Classifier train(edu.umass.cs.mallet.base.types.InstanceList trainingSet,
                                                          edu.umass.cs.mallet.base.types.InstanceList validationSet,
                                                          edu.umass.cs.mallet.base.types.InstanceList testSet,
                                                          edu.umass.cs.mallet.base.classify.ClassifierEvaluating evaluator,
                                                          edu.umass.cs.mallet.base.classify.Classifier initialClassifier)
Creates a new linear classifier and trains it or else just trains the classifier if the classifier is not null.

Specified by:
train in class edu.umass.cs.mallet.base.classify.ClassifierTrainer

getNewClassifier

private edu.umass.cs.mallet.base.classify.Classifier getNewClassifier(edu.umass.cs.mallet.base.types.InstanceList trainingSet)

trainClassifier

private void trainClassifier(LinearClassifier linearClassifier,
                             edu.umass.cs.mallet.base.types.InstanceList trainingSet,
                             int numIter)
                      throws java.io.IOException
Trains the classifier.

Parameters:
numIter - - the number of iterations
Throws:
java.io.IOException

modify

private edu.umass.cs.mallet.base.classify.Classifier modify(edu.umass.cs.mallet.base.types.InstanceList trainingSet,
                                                            edu.umass.cs.mallet.base.classify.Classifier initialClassifier)

readData

private ClassificationInstance[] readData(edu.umass.cs.mallet.base.types.InstanceList iList)
                                   throws java.io.IOException
Throws:
java.io.IOException


Copyright (C) 2006 University of Pennsylvania.