Class ObservationClassifier

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
    Direct Known Subclasses:
    HMMExponentialClassifier, HMMGaussianClassifier, HMMMultinomialClassifier

    public abstract class ObservationClassifier
    extends TypedAtomicActor

    This actor performs Maximum-Likelihood classification of the partially-observed Bayesian Network models. ClassifyObservations is designed to work with ExpectationMaximization, which provides the Maximum-Likelihood model parameters from which the observations are assumed to be drawn. The output is an integer array of labels, representing the maximum-likelihood hidden state sequence of the given model.

    The user provides a set of parameter estimates as inputs to the model, and The mean is a double array input containing the mean estimate and sigma is a double array input containing standard deviation estimate of each mixture component. If the modelType is HMM, then an additional input, transitionMatrix is provided, which is an estimate of the transition matrix governing the Markovian process representing the hidden state evolution. The prior input is an estimate of the prior state distribution.

    References

    [1] Jordan, Michael I., et al. An introduction to variational methods for graphical models, Springer Netherlands, 1998.

    [2] Bilmes, Jeff A. A gentle tutorial of the EM algorithm and its application to parameter estimation for Gaussian mixture and hidden Markov models. International Computer Science Institute 4.510 (1998): 126.

    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Ilge Akkaya
    See Also:
    ParameterEstimator, HMMGaussianClassifier, HMMMultinomialClassifier
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (ilgea)
    • Field Detail

      • prior

        public PortParameter prior
        An array that defines priors on initial states.
      • transitionMatrix

        public PortParameter transitionMatrix
        The transition probability matrix of the hidden markov chain.
      • output

        public TypedIOPort output
        An array of state labels assigned to input symbols.
      • input

        public TypedIOPort input
        An array of input symbols to be classified.
      • likelihood

        public TypedIOPort likelihood
        Likelihood of the input stream given the parameterized HMM.
      • _classificationLength

        protected int _classificationLength
        length of the observation array to be classified.
      • _likelihood

        protected double _likelihood
        sequence likelihood assigned to current input.
      • _observations

        protected double[][] _observations
        observation array.
      • _nStates

        protected int _nStates
        number of hidden states.
      • _transitionMatrixEstimate

        protected double[][] _transitionMatrixEstimate
        transition matrix estimate for the markov chain model.
      • _priors

        protected double[] _priors
        prior hidden state distribution.
    • Method Detail

      • classifyHMM

        protected final int[] classifyHMM​(double[][] y,
                                          double[] prior,
                                          double[][] A)
                                   throws IllegalActionException
        Alpha-beta recursion.
        Parameters:
        y - input sequence
        prior - prior guess vectors
        A - transition probability matrix
        Returns:
        An array of assigned labels to observations
        Throws:
        IllegalActionException - If thrown while calculating the emmission probablity
      • gaussianClassifyMM

        public static final int[] gaussianClassifyMM​(double[] y,
                                                     double[] mu,
                                                     double[] sigma,
                                                     double[] prior)
        Classify the incoming symbols into hidden states.
        Parameters:
        y - input array
        mu - mean array containing current mean estimates for hidden states
        sigma - mean array containing current standard deviation estimates for hidden states
        prior - prior distribution estimates
        Returns:
        labels of assigned states
      • emissionProbability

        protected abstract double emissionProbability​(double[] y,
                                                      int hiddenState)
                                               throws IllegalActionException
        Abstract class defining the emission probability computation of the latent variable.
        Parameters:
        y - The y values
        hiddenState - The hidden state
        Returns:
        the emission probability
        Throws:
        IllegalActionException - If there is a problem calculating the emission probability.