Interface DistributionTrainerContext

    • Method Detail

      • getNullModelWeight

        double getNullModelWeight()
        Return the number of pseudocounts added to the distribution when training.
        the null model weight
      • setNullModelWeight

        void setNullModelWeight​(double weight)
        Set the number of pseudocounts to add when training the distribution. These counts are added in proportion to the null model of the distribution being trained.
        weight - the new null model weight
      • registerDistribution

        void registerDistribution​(Distribution dist)

        Register a distribution object with this context.

        This method is a request to the context to register dist. If dist is already registered then this method should do nothing. If it is not registered, then it should invoke dist.registerWithTrainer

        dist - the Distribution to register
      • registerTrainer

        void registerTrainer​(Distribution dist,
                             DistributionTrainer trainer)

        Register a Distribution and an associated DistributionTrainer object.

        In the registerWithTrainer method of a Distribution, it should associate itself with a trainer using this method.

        dist - the distribution to be registered.
        trainer - the distribution's trainer object to be registered.
      • getTrainer

        DistributionTrainer getTrainer​(Distribution dist)
        Return the Distribution trainer object from the current context.
        dist - the Distribution whose trainer is required
        the DistributionTrainer for the distribution
      • addCount

        void addCount​(Distribution dist,
                      Symbol sym,
                      double times)
               throws IllegalSymbolException

        Registers that sym was counted in this state.

        This method may be called multiple times with the same symbol. In this case, the times should be summed.

        dist - the Distribution that the symbol was associated with
        sym - the Symbol seen
        times - the number of times to add
        IllegalSymbolException - if sym is not recognised by dist
      • getCount

        double getCount​(Distribution dist,
                        Symbol sym)
                 throws IllegalSymbolException
        Return the number of counts of a particular symbol which will be used to train the specified distribution.
        dist - the Distribution to return counts for
        sym - the symbol to get the count for
        the number of counts
        IllegalSymbolException - if the symbol is not accepted by the distribution
      • train

        void train()
            throws ChangeVetoException

        Trains the Distribution, given a null model.

        This will use the information collected with multiple addCount calls, and the null model to generate the new weights.

        ChangeVetoException - if any of the distributions can't be trained
      • clearCounts

        void clearCounts()
        Clears all of the counts to zero.