cc.mallet.fst
Class CRFTrainerByValueGradients

java.lang.Object
  extended by cc.mallet.fst.TransducerTrainer
      extended by cc.mallet.fst.CRFTrainerByValueGradients
All Implemented Interfaces:
TransducerTrainer.ByOptimization

public class CRFTrainerByValueGradients
extends TransducerTrainer
implements TransducerTrainer.ByOptimization

A CRF trainer that can combine multiple objective functions, each represented by a Optmizable.ByValueGradient.


Nested Class Summary
 class CRFTrainerByValueGradients.OptimizableCRF
          An optimizable CRF that contains a collection of objective functions.
 
Nested classes/interfaces inherited from class cc.mallet.fst.TransducerTrainer
TransducerTrainer.ByIncrements, TransducerTrainer.ByInstanceIncrements, TransducerTrainer.ByOptimization
 
Constructor Summary
CRFTrainerByValueGradients(CRF crf, Optimizable.ByGradientValue[] optimizableByValueGradientObjects)
           
 
Method Summary
 CRF getCRF()
           
 int getIteration()
           
 Optimizable.ByGradientValue[] getOptimizableByGradientValueObjects()
           
 CRFTrainerByValueGradients.OptimizableCRF getOptimizableCRF(InstanceList trainingSet)
           
 Optimizer getOptimizer()
           
 Optimizer getOptimizer(InstanceList trainingSet)
           
 Transducer getTransducer()
           
 boolean isConverged()
           
 boolean isFinishedTraining()
           
 void setMaxResets(int maxResets)
           
 boolean train(InstanceList trainingSet, int numIterations)
          Train the transducer associated with this TransducerTrainer.
 boolean train(InstanceList training, int numIterationsPerProportion, double[] trainingProportions)
          Train a CRF on various-sized subsets of the data.
 boolean trainIncremental(InstanceList training)
           
 
Methods inherited from class cc.mallet.fst.TransducerTrainer
addEvaluator, addEvaluators, removeEvaluator, runEvaluators, train
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CRFTrainerByValueGradients

public CRFTrainerByValueGradients(CRF crf,
                                  Optimizable.ByGradientValue[] optimizableByValueGradientObjects)
Method Detail

getTransducer

public Transducer getTransducer()
Specified by:
getTransducer in class TransducerTrainer

getCRF

public CRF getCRF()

getOptimizer

public Optimizer getOptimizer()
Specified by:
getOptimizer in interface TransducerTrainer.ByOptimization

isConverged

public boolean isConverged()

isFinishedTraining

public boolean isFinishedTraining()
Specified by:
isFinishedTraining in class TransducerTrainer

getIteration

public int getIteration()
Specified by:
getIteration in class TransducerTrainer

getOptimizableByGradientValueObjects

public Optimizable.ByGradientValue[] getOptimizableByGradientValueObjects()

getOptimizableCRF

public CRFTrainerByValueGradients.OptimizableCRF getOptimizableCRF(InstanceList trainingSet)

getOptimizer

public Optimizer getOptimizer(InstanceList trainingSet)

trainIncremental

public boolean trainIncremental(InstanceList training)

train

public boolean train(InstanceList trainingSet,
                     int numIterations)
Description copied from class: TransducerTrainer
Train the transducer associated with this TransducerTrainer. You should be able to call this method with different trainingSet objects. Whether this causes the TransducerTrainer to combine both trainingSets or to view the second as a new alternative is at the discretion of the particular TransducerTrainer subclass involved.

Specified by:
train in class TransducerTrainer

train

public boolean train(InstanceList training,
                     int numIterationsPerProportion,
                     double[] trainingProportions)
Train a CRF on various-sized subsets of the data. This method is typically used to accelerate training by quickly getting to reasonable parameters on only a subset of the parameters first, then on progressively more data.

Parameters:
training - The training Instances.
numIterationsPerProportion - Maximum number of Maximizer iterations per training proportion.
trainingProportions - If non-null, train on increasingly larger portions of the data, e.g. new double[] {0.2, 0.5, 1.0}. This can sometimes speedup convergence. Be sure to end in 1.0 if you want to train on all the data in the end.
Returns:
True if training has converged.

setMaxResets

public void setMaxResets(int maxResets)