calhoun.analysis.crf.solver
Class FixedWeightOptimizer

java.lang.Object
  extended by calhoun.analysis.crf.solver.FixedWeightOptimizer
All Implemented Interfaces:
CRFTraining

public class FixedWeightOptimizer
extends java.lang.Object
implements CRFTraining

a dummy optimizer that just fixed the weights at values specified in the configuration. If no weights are specified, then a default all weights being fixed at 1.0 is used.


Constructor Summary
FixedWeightOptimizer()
           
 
Method Summary
 double[] getStarts()
          gets the fixed weights that will be used in place of an optimization.
 double[] optimize(ModelManager fm, java.util.List<? extends TrainingSequence<?>> data)
          find the set of weights which maximizes the value of the objective function.
 void setStarts(double[] starts)
          sets the values to use as feature weights.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedWeightOptimizer

public FixedWeightOptimizer()
Method Detail

optimize

public double[] optimize(ModelManager fm,
                         java.util.List<? extends TrainingSequence<?>> data)
Description copied from interface: CRFTraining
find the set of weights which maximizes the value of the objective function. The CRFObjectiveFunctionGradient object will already be configured witht eh appropriate training data, so it appears here as a pure function evaluation.

Specified by:
optimize in interface CRFTraining
Parameters:
fm - the model to train on.
data - the training data to use for training.
Returns:
an array of doubles containing the optimal weights.

getStarts

public double[] getStarts()
gets the fixed weights that will be used in place of an optimization.

Returns:
array of feature weights to use

setStarts

public void setStarts(double[] starts)
sets the values to use as feature weights. A null value sets all weights to 1.0.

Specified by:
setStarts in interface CRFTraining
Parameters:
starts - array of feature weights to use