Class HSMMParameterEstimator

    • Field Detail

      • priorDurationDistribution

        public Parameter priorDurationDistribution
        The user-provided initial guess on the prior probability distribution.
      • durationProbabilities

        public Parameter durationProbabilities
        The user-provided initial guess on the prior probability distribution.
      • durationEstimates

        public TypedIOPort durationEstimates
        DurationEstimates.
      • durationPriorEstimates

        public TypedIOPort durationPriorEstimates
        Duration Prior estimates.
      • clusterAssignments

        public TypedIOPort clusterAssignments
        Hidden-State Assignments.
      • maxStateDuration

        public Parameter maxStateDuration
        Maximum Duration.
      • _durationPriors

        protected double[] _durationPriors
        Duration priors - an nStates-by-nDurations matrix.
      • D_new

        protected double[][] D_new
        new duration distribution.
      • _D0

        protected double[][] _D0
        initial duration distribution.
      • _D

        protected double[][] _D
        current duration distribution.
      • _dPriors0

        protected double[] _dPriors0
        The user defined duration priors. Note that while _durationPriors gets updated on Baum-Welch Iterations, this array stays set at the initial user setting such that if the algorithm fails to converge, the value of _durationPriors is rolled back to _dPriors0.
      • _maxDuration

        protected int _maxDuration
        maximum duration ( in time steps).
      • _etaDimension

        protected int _etaDimension
        Total number of categories among all observation dimensions.
      • _likelihoodHistory

        protected java.util.List<java.lang.Double> _likelihoodHistory
        Likelihood history over iterations. Used for debugging at the moment.
    • Method Detail

      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        Description copied from class: NamedObj
        React to a change in an attribute. This method is called by a contained attribute when its value changes. In this base class, the method does nothing. In derived classes, this method may throw an exception, indicating that the new attribute value is invalid. It is up to the caller to restore the attribute to a valid value if an exception is thrown.
        Overrides:
        attributeChanged in class ParameterEstimator
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - If the change is not acceptable to this container (not thrown in this base class).
      • preinitialize

        public void preinitialize()
                           throws IllegalActionException
        Description copied from class: AtomicActor
        Create receivers and declare delay dependencies. Derived classes can override this method to perform additional initialization functions, but they should call this base class methods or create the receivers themselves. This method gets executed exactly once prior to any other action methods. It cannot produce output data since type resolution is typically not yet done. It also gets invoked prior to any static scheduling that might occur in the domain, so it can change scheduling information.
        Specified by:
        preinitialize in interface Initializable
        Overrides:
        preinitialize in class AtomicActor<TypedIOPort>
        Throws:
        IllegalActionException - Not thrown in this base class.
      • _EMParameterEstimation

        protected boolean _EMParameterEstimation()
        Description copied from class: ParameterEstimator
        Expectation-Maximization, which internally executes a gradient-descent algorithm for parameter estimation.
        Overrides:
        _EMParameterEstimation in class ParameterEstimator
        Returns:
        whether parameter estimation has succeded
      • emissionProbability

        protected abstract double emissionProbability​(double[] y,
                                                      int hiddenState)
        Description copied from class: ParameterEstimator
        Computes the emission probability. Implemented by the child class.
        Specified by:
        emissionProbability in class ParameterEstimator
        Parameters:
        y - input observation
        hiddenState - index of hidden state
        Returns:
        P(Y=y | X=hiddenState)
      • durationProbability

        protected abstract double durationProbability​(int y,
                                                      int hiddenState)
        Return the duration probability of duration y at hidden state.
        Parameters:
        y - The duration index
        hiddenState - The hidden state index
        Returns:
        p(y|hiddenState)
      • _checkForConvergence

        protected abstract boolean _checkForConvergence​(int i)
        Description copied from class: ParameterEstimator
        Check whether the gradient-descent algorithm has converged.
        Specified by:
        _checkForConvergence in class ParameterEstimator
        Parameters:
        i - Current iteration index
        Returns:
        boolean indicating whether algorithm has converged
      • HSMMAlphaBetaRecursion

        protected java.util.HashMap HSMMAlphaBetaRecursion​(double[][] y,
                                                           double[][] A,
                                                           double[] prior,
                                                           int[] nCategories)
        Java implementation of the Baum-Welch algorithm (Alpha-Beta Recursion) for parameter estimation and cluster assignment. This method uses normalized alpha values for computing the conditional probabilities of input sequences, to ensure numerical stability. Set nCategories to zero for continuous distribution types
        Parameters:
        y - Observation array
        A - transition probability matrix
        prior - State priors
        nCategories - Number of categories in multinomial distribution
        Returns:
        a Map of parameter estimates