Package cc.mallet.fst

Class CRFTrainerByStochasticGradient

    • Field Detail

      • crf

        protected CRF crf
      • learningRate

        protected double learningRate
      • t

        protected double t
      • lambda

        protected double lambda
      • iterationCount

        protected int iterationCount
      • converged

        protected boolean converged
    • Constructor Detail

      • CRFTrainerByStochasticGradient

        public CRFTrainerByStochasticGradient​(CRF crf,
                                              InstanceList trainingSample)
      • CRFTrainerByStochasticGradient

        public CRFTrainerByStochasticGradient​(CRF crf,
                                              double learningRate)
    • Method Detail

      • setLearningRateByLikelihood

        public void setLearningRateByLikelihood​(InstanceList trainingSample)
        Automatically sets the learning rate to one that would be good
      • setLearningRate

        public void setLearningRate​(double r)
      • getLearningRate

        public double getLearningRate()
      • 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 trainingSet,
                             int numIterations,
                             int numIterationsBetweenEvaluation)
      • trainIncrementalLikelihood

        public double trainIncrementalLikelihood​(Instance trainingInstance)
        Adjust the parameters by default learning rate according to the gradient of this single Instance, and return the true label sequence likelihood.
      • trainIncrementalLikelihood

        public double trainIncrementalLikelihood​(Instance trainingInstance,
                                                 double rate)
        Adjust the parameters by learning rate according to the gradient of this single Instance, and return the true label sequence likelihood.