Package cc.mallet.fst

Class CRFTrainerByValueGradients

    • Constructor Detail

    • Method Detail

      • getCRF

        public CRF getCRF()
      • isConverged

        public boolean isConverged()
        Returns true if training converged, false otherwise.
      • getOptimizableCRF

        public CRFTrainerByValueGradients.OptimizableCRF getOptimizableCRF​(InstanceList trainingSet)
        Returns an optimizable CRF that contains a collection of objective functions.

        If one doesn't exist then creates one and sets the optimizer to null.

      • getOptimizer

        public Optimizer getOptimizer​(InstanceList trainingSet)
        Returns a L-BFGS optimizer, creating if one doesn't exist.

        Also creates an optimizable CRF if required.

      • trainIncremental

        public boolean trainIncremental​(InstanceList training)
        Trains a CRF until convergence.
      • train

        public boolean train​(InstanceList trainingSet,
                             int numIterations)
        Trains a CRF until convergence or specified number of iterations, whichever is earlier.

        Also creates an optimizable CRF and an optmizer if required.

        Specified by:
        train in class TransducerTrainer
      • train

        public boolean train​(InstanceList training,
                             int numIterationsPerProportion,
                             double[] trainingProportions)
        Train a CRF on various-sized subsets of the data. This method is typically used to accelerate training by quickly getting to reasonable parameters on only a subset of the parameters first, then on progressively more data.
        Parameters:
        training - The training Instances.
        numIterationsPerProportion - Maximum number of Maximizer iterations per training proportion.
        trainingProportions - If non-null, train on increasingly larger portions of the data, e.g. new double[] {0.2, 0.5, 1.0}. This can sometimes speedup convergence. Be sure to end in 1.0 if you want to train on all the data in the end.
        Returns:
        True if training has converged.
      • setMaxResets

        public void setMaxResets​(int maxResets)
        Sets the max. number of times the optimizer can be reset before throwing an exception.

        Default value: DEFAULT_MAX_RESETS.