calhoun.analysis.crf.solver
Class SimplexOptimizer

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

public class SimplexOptimizer
extends java.lang.Object
implements CRFTraining

uses a nelder-mead algorithm (the simplex method) to do a general function optimization objective function. This optimization method does not use the gradient but requires many iterations and so is mainly useful in debugging. Use the StandardOptimizer for most problems.

This optimizer has several configuration properties that allow control over the optimization process:


Constructor Summary
SimplexOptimizer()
           
 
Method Summary
 int getMaxIters()
           
 CRFObjectiveFunctionGradient getObjectiveFunction()
          returns the configured objective function gradient which will be used by the optimizer during the training process.
 double[] getStarts()
           
 double getStepSize()
           
 boolean isRequireConvergence()
           
 double[] optimize(ModelManager fm, java.util.List<? extends TrainingSequence<?>> data)
          find the set of weights which maximizes the value of the objective function.
 void setMaxIters(int maxIters)
           
 void setObjectiveFunction(CRFObjectiveFunctionGradient objectiveFunction)
          sets the objective function gradient.
 void setRequireConvergence(boolean requireConvergence)
           
 void setStarts(double[] starts)
          Sets the starting weights for the optimization.
 void setStepSize(double stepSize)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplexOptimizer

public SimplexOptimizer()
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.

getObjectiveFunction

public CRFObjectiveFunctionGradient getObjectiveFunction()
returns the configured objective function gradient which will be used by the optimizer during the training process.

Returns:
the configured objective function gradient

setObjectiveFunction

public void setObjectiveFunction(CRFObjectiveFunctionGradient objectiveFunction)
sets the objective function gradient. Called automatically during configuration.


getMaxIters

public int getMaxIters()

setMaxIters

public void setMaxIters(int maxIters)

isRequireConvergence

public boolean isRequireConvergence()

setRequireConvergence

public void setRequireConvergence(boolean requireConvergence)

getStarts

public double[] getStarts()

setStarts

public void setStarts(double[] starts)
Description copied from interface: CRFTraining
Sets the starting weights for the optimization.

Specified by:
setStarts in interface CRFTraining
Parameters:
starts - an array of weights to use as the starting point for the optimizer. The optimzier is not required to use this as a starting point.

getStepSize

public double getStepSize()

setStepSize

public void setStepSize(double stepSize)