cc.mallet.fst
Class CRFTrainerByValueGradients
java.lang.Object
cc.mallet.fst.TransducerTrainer
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.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CRFTrainerByValueGradients
public CRFTrainerByValueGradients(CRF crf,
Optimizable.ByGradientValue[] optimizableByValueGradientObjects)
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)