Package cc.mallet.fst

Class CRFTrainerByThreadedLabelLikelihood

    • Constructor Detail

      • CRFTrainerByThreadedLabelLikelihood

        public CRFTrainerByThreadedLabelLikelihood​(CRF crf,
                                                   int numThreads)
    • Method Detail

      • getCRF

        public CRF getCRF()
      • isConverged

        public boolean isConverged()
      • setGaussianPriorVariance

        public void setGaussianPriorVariance​(double p)
      • getGaussianPriorVariance

        public double getGaussianPriorVariance()
      • setUseSparseWeights

        public void setUseSparseWeights​(boolean b)
      • getUseSparseWeights

        public boolean getUseSparseWeights()
      • setUseSomeUnsupportedTrick

        public void setUseSomeUnsupportedTrick​(boolean b)
        Sets whether to use the 'some unsupported trick.' This trick is, if training a CRF where some training has been done and sparse weights are used, to add a few weights for feaures that do not occur in the tainig data.

        This generally leads to better accuracy at only a small memory cost.

        Parameters:
        b - Whether to use the trick
      • setAddNoFactors

        public void setAddNoFactors​(boolean flag)
        Use this method to specify whether or not factors are added to the CRF by this trainer. If you have already setup the factors in your CRF, you may not want the trainer to add additional factors.
        Parameters:
        flag - If true, this trainer adds no factors to the CRF.
      • shutdown

        public void shutdown()
      • trainIncremental

        public boolean trainIncremental​(InstanceList training)
      • train

        public boolean train​(InstanceList trainingSet,
                             int numIterations)
        Description copied from class: TransducerTrainer
        Train the transducer associated with this TransducerTrainer. You should be able to call this method with different trainingSet objects. Whether this causes the TransducerTrainer to combine both trainingSets or to view the second as a new alternative is at the discretion of the particular TransducerTrainer subclass involved.
        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.