dragon.ml.seqmodel.crf
Class AbstractTrainer

java.lang.Object
  |
  +--dragon.ml.seqmodel.crf.AbstractCRF
        |
        +--dragon.ml.seqmodel.crf.AbstractTrainer
All Implemented Interfaces:
Trainer
Direct Known Subclasses:
CollinsBasicTrainer, LBFGSBasicTrainer

public abstract class AbstractTrainer
extends AbstractCRF
implements Trainer

Abstract class for training conditional random field

Copyright: Copyright (c) 2005

Company: IST, Drexel University

Version:
1.0
Author:
Davis Zhou

Field Summary
protected  boolean doScaling
           
protected  int maxIteration
           
protected static double xtol
           
 
Fields inherited from class dragon.ml.seqmodel.crf.AbstractCRF
edgeGen, featureGenerator, lambda, model
 
Constructor Summary
AbstractTrainer(ModelGraph model, FeatureGenerator featureGen)
           
 
Method Summary
protected  void genStateVector(DoubleDenseMatrix transMatrix, double[] oldStateVector, double[] newStateVector, boolean transpose)
           
protected  void genStateVectorLog(DoubleDenseMatrix transMatrix, double[] oldStateVector, double[] newStateVector, boolean transpose)
           
 int getMaxIteration()
          Gets the number of maximum iterations
 boolean needScaling()
          Gets the scaling option.
 void setMaxIteration(int maxIteration)
          Sets the number of maximum iterations
 void setScalingOption(boolean option)
          Sets the scaling option
 
Methods inherited from class dragon.ml.seqmodel.crf.AbstractCRF
computeTransMatrix, computeTransMatrix, getFeatureGenerator, getModelGraph, getModelParameter, readModelParameter, saveModelParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface dragon.ml.seqmodel.crf.Trainer
getFeatureGenerator, getModelGraph, getModelParameter, saveModelParameter, train
 

Field Detail

xtol

protected static double xtol

doScaling

protected boolean doScaling

maxIteration

protected int maxIteration
Constructor Detail

AbstractTrainer

public AbstractTrainer(ModelGraph model,
                       FeatureGenerator featureGen)
Method Detail

needScaling

public boolean needScaling()
Description copied from interface: Trainer
Gets the scaling option. The likelihood of the sequence may be too small. Thus it may be necessary to scale the likelihood

Specified by:
needScaling in interface Trainer
Returns:
true if the training needs scaling

setScalingOption

public void setScalingOption(boolean option)
Description copied from interface: Trainer
Sets the scaling option

Specified by:
setScalingOption in interface Trainer
Parameters:
option - the scaling option

getMaxIteration

public int getMaxIteration()
Description copied from interface: Trainer
Gets the number of maximum iterations

Specified by:
getMaxIteration in interface Trainer
Returns:
the number of maximum iterations

setMaxIteration

public void setMaxIteration(int maxIteration)
Description copied from interface: Trainer
Sets the number of maximum iterations

Specified by:
setMaxIteration in interface Trainer
Parameters:
maxIteration - the number of maximum iterations

genStateVector

protected void genStateVector(DoubleDenseMatrix transMatrix,
                              double[] oldStateVector,
                              double[] newStateVector,
                              boolean transpose)

genStateVectorLog

protected void genStateVectorLog(DoubleDenseMatrix transMatrix,
                                 double[] oldStateVector,
                                 double[] newStateVector,
                                 boolean transpose)