com.pawjaw.classification.crf.lmcbt
Class CRFTrainer

java.lang.Object
  extended by com.pawjaw.classification.crf.lmcbt.CRFTrainer

public class CRFTrainer
extends java.lang.Object

Main entry point for training new CRF model. Following instantiation, set all training examples using set() method, then run one of the train() methods.


Constructor Summary
CRFTrainer(Configuration c, int example_sequences)
          Instantiate this, then use set() repeatedly finally followed by train().
 
Method Summary
 double[][][] serialize()
          Serialize trained CRF model to be written to disk and/or used for subsequent inference (labeling new data).
 void set(int sequence_index, Point[] points, int[] labels)
          Set a new training example.
 void train()
          Train a new CRF model with the number of boosting iterations specified in the configuration given to the constructor.
 void train(java.util.List<Point[]> pointss, java.util.List<int[]> true_labelss)
          Train a new CRF model with the maximum number of boosting iterations specified in the configuration given to the constructor but with the option to stop early if the incremental improvement in Viterbi accuracy is less than the amount specified in the configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CRFTrainer

public CRFTrainer(Configuration c,
                  int example_sequences)
Instantiate this, then use set() repeatedly finally followed by train(). Same configuration should be used for inference.

Parameters:
c - options for training specified here
example_sequences - number of example sequences to be used in training
Method Detail

set

public void set(int sequence_index,
                Point[] points,
                int[] labels)
Set a new training example. sequence_index ranges up to example_sequences specified in constructor. True labels range to the value specified in the configuraton given to the constructor.

Parameters:
sequence_index - ranges from 0 to example_sequences - 1 (inclusive)
points - data points in the given sequence
labels - true labels for the given sequence

train

public void train()
Train a new CRF model with the number of boosting iterations specified in the configuration given to the constructor.


train

public void train(java.util.List<Point[]> pointss,
                  java.util.List<int[]> true_labelss)
Train a new CRF model with the maximum number of boosting iterations specified in the configuration given to the constructor but with the option to stop early if the incremental improvement in Viterbi accuracy is less than the amount specified in the configuration. Use the arguments to this method to validate the model for accuracy.

Parameters:
pointss - validation data points
true_labelss - validation labels

serialize

public double[][][] serialize()
Serialize trained CRF model to be written to disk and/or used for subsequent inference (labeling new data).

Returns:
CRF model for subsequent inference