Interface DistributionTrainer

    • Method Detail

      • addCount

        void addCount​(DistributionTrainerContext dtc,
                      AtomicSymbol 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.

        Parameters:
        dtc - the DistributionTrainerContext within which the count was added
        sym - the Symbol seen
        times - the number of times to add
        Throws:
        IllegalSymbolException - if sym is not recognised
      • getCount

        double getCount​(DistributionTrainerContext dtc,
                        AtomicSymbol sym)
                 throws IllegalSymbolException

        Get the current count for this state.

        This method may be called multiple times with the same symbol. Each time it should return the agregate of the counts added with addCount since the last invocation of clearCounts.

        Parameters:
        dtc - the DistributionTrainerContext within which the count was added
        sym - the Symbol seen
        Returns:
        the agregate of the counts
        Throws:
        IllegalSymbolException - if sym is not recognised
      • train

        void train​(DistributionTrainerContext dtc,
                   double weight)
            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.

        This method should not modify the underlying counts.

        Parameters:
        dtc - the context to use
        weight - how many lots of the null model to add
        Throws:
        ChangeVetoException - if the distribution could not have its weights modified