Class MaxEntTrainer

    • Constructor Detail

      • MaxEntTrainer

        public MaxEntTrainer()
      • MaxEntTrainer

        public MaxEntTrainer​(MaxEnt theClassifierToTrain)
        Construct a MaxEnt trainer using a trained classifier as initial values.
      • MaxEntTrainer

        public MaxEntTrainer​(double gaussianPriorVariance)
        Constructs a trainer with a parameter to avoid overtraining. 1.0 is the default value.
    • Method Detail

      • setClassifier

        public void setClassifier​(MaxEnt theClassifierToTrain)
        Initialize parameters using the provided classifier.
      • getOptimizer

        public Optimizer getOptimizer​(InstanceList trainingSet)
        This method is called by the train method. This is the main entry point for the optimizable and optimizer compontents.
      • setNumIterations

        public MaxEntTrainer setNumIterations​(int i)
        Specifies the maximum number of iterations to run during a single call to train or trainWithFeatureInduction. Not currently functional.
        Returns:
        This trainer
      • setGaussianPriorVariance

        public MaxEntTrainer setGaussianPriorVariance​(double gaussianPriorVariance)
        Sets a parameter to prevent overtraining. A smaller variance for the prior means that feature weights are expected to hover closer to 0, so extra evidence is required to set a higher weight.
        Returns:
        This trainer
      • setL1Weight

        public MaxEntTrainer setL1Weight​(double l1Weight)
        Use an L1 prior. Larger values mean parameters will be closer to 0. Note that this setting overrides any Gaussian prior.
      • toString

        public java.lang.String toString()

        Like the other version of trainWithFeatureInduction, but allows some default options to be changed.

        Overrides:
        toString in class java.lang.Object
        Parameters:
        maxent - An initial partially-trained classifier (default null). This classifier may be modified during training.
        gainName - The estimate of gain (log-likelihood increase) we want our chosen features to maximize. Should be one of MaxEntTrainer.EXP_GAIN, MaxEntTrainer.GRADIENT_GAIN, or MaxEntTrainer.INFORMATION_GAIN (default EXP_GAIN).
        Returns:
        The trained MaxEnt classifier