|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.fst.TransducerTrainer cc.mallet.fst.CRFTrainerByValueGradients
public class CRFTrainerByValueGradients
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 |
Field Summary | |
---|---|
static int |
DEFAULT_MAX_RESETS
|
Constructor Summary | |
---|---|
CRFTrainerByValueGradients(CRF crf,
Optimizable.ByGradientValue[] optimizableByValueGradientObjects)
|
Method Summary | |
---|---|
CRF |
getCRF()
|
int |
getIteration()
|
Optimizable.ByGradientValue[] |
getOptimizableByGradientValueObjects()
|
CRFTrainerByValueGradients.OptimizableCRF |
getOptimizableCRF(InstanceList trainingSet)
Returns an optimizable CRF that contains a collection of objective functions. |
Optimizer |
getOptimizer()
|
Optimizer |
getOptimizer(InstanceList trainingSet)
Returns a L-BFGS optimizer, creating if one doesn't exist. |
Transducer |
getTransducer()
|
boolean |
isConverged()
Returns true if training converged, false otherwise. |
boolean |
isFinishedTraining()
Returns true if training converged, false otherwise. |
void |
setMaxResets(int maxResets)
Sets the max. |
boolean |
train(InstanceList trainingSet,
int numIterations)
Trains a CRF until convergence or specified number of iterations, whichever is earlier. |
boolean |
train(InstanceList training,
int numIterationsPerProportion,
double[] trainingProportions)
Train a CRF on various-sized subsets of the data. |
boolean |
trainIncremental(InstanceList training)
Trains a CRF until convergence. |
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 |
Field Detail |
---|
public static final int DEFAULT_MAX_RESETS
Constructor Detail |
---|
public CRFTrainerByValueGradients(CRF crf, Optimizable.ByGradientValue[] optimizableByValueGradientObjects)
Method Detail |
---|
public Transducer getTransducer()
getTransducer
in class TransducerTrainer
public CRF getCRF()
public Optimizer getOptimizer()
getOptimizer
in interface TransducerTrainer.ByOptimization
public boolean isConverged()
public boolean isFinishedTraining()
isFinishedTraining
in class TransducerTrainer
public int getIteration()
getIteration
in class TransducerTrainer
public Optimizable.ByGradientValue[] getOptimizableByGradientValueObjects()
public CRFTrainerByValueGradients.OptimizableCRF getOptimizableCRF(InstanceList trainingSet)
If one doesn't exist then creates one and sets the optimizer to null.
public Optimizer getOptimizer(InstanceList trainingSet)
Also creates an optimizable CRF if required.
public boolean trainIncremental(InstanceList training)
public boolean train(InstanceList trainingSet, int numIterations)
Also creates an optimizable CRF and an optmizer if required.
train
in class TransducerTrainer
public boolean train(InstanceList training, int numIterationsPerProportion, double[] trainingProportions)
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.
public void setMaxResets(int maxResets)
Default value: DEFAULT_MAX_RESETS.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |