Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## calhoun.analysis.crf.solver
Class TwoPassOptimizer

    java.lang.Object
      calhoun.analysis.crf.solver.TwoPassOptimizer

All Implemented Interfaces:
  CRFTraining

    public class TwoPassOptimizer

extends java.lang.Object
implements CRFTraining

a two pass optimizer that does an initial optimization and then uses the weights generated from that as the start of a second optimization. It is configured with two separate CRFOptimizer oibjects for the two passes and additionally needs a CRFObjectiveFunctionGradient for the first pass.

This optimizer has two configuration properties that must be set and control the optimization process

- `firstPass` - A reference to a configured `CRFTraining` object that will be used to optimize the weights in the first pass of the optimization.
- `secondPass` - A reference to a configured `CRFTraining` object that will be used to optimize the weights in the second pass of the optimization. The second pass will begin using the weights computed during the first pass.

  Constructor Summary
  `TwoPassOptimizer()`

  Method Summary
  `CRFTraining` | `getFirstPass()`
  `CRFTraining` | `getSecondPass()`
  `double[]` | `optimize(ModelManager fm, java.util.List<? extends TrainingSequence<?>> data)` find the set of weights which maximizes the value of the objective function.
  `void` | `setFirstPass(CRFTraining firstPass)`
  `void` | `setSecondPass(CRFTraining secondPass)`
  `void` | `setStarts(double[] weights)` Sets the starting weights for the optimization.

  Methods inherited from class java.lang.Object
  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  Constructor Detail

  ### TwoPassOptimizer

      public TwoPassOptimizer()

  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.

  ### setStarts

      public void setStarts(double[] weights)

    Description copied from interface: `CRFTraining`
    Sets the starting weights for the optimization.

    Specified by:
      `setStarts` in interface `CRFTraining`
    Parameters:
      `weights` - 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.

  ### getFirstPass

      public CRFTraining getFirstPass()

    Returns:
      the firstPass

  ### setFirstPass

      public void setFirstPass(CRFTraining firstPass)

    Parameters:
      `firstPass` - the firstPass to set

  ### getSecondPass

      public CRFTraining getSecondPass()

    Returns:
      the secondPass

  ### setSecondPass

      public void setSecondPass(CRFTraining secondPass)

    Parameters:
      `secondPass` - the secondPass to set

  Overview | Package | Class | Use | Tree | Deprecated | Index | Help
  PREV CLASS NEXT CLASS | FRAMES NO FRAMES
  SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD