TensorFlow 2.0 Beta is available Learn more

tfp.edward2.HiddenMarkovModel

Create a random variable for HiddenMarkovModel.

tfp.edward2.HiddenMarkovModel(
    *args,
    **kwargs
)

Defined in python/edward2/interceptor.py.

See HiddenMarkovModel for more details.

Returns:

RandomVariable.

Original Docstring for Distribution

Initialize hidden Markov model.

Args:

  • initial_distribution: A Categorical-like instance. Determines probability of first hidden state in Markov chain. The number of categories must match the number of categories of transition_distribution as well as both the rightmost batch dimension of transition_distribution and the rightmost batch dimension of observation_distribution.
  • transition_distribution: A Categorical-like instance. The rightmost batch dimension indexes the probability distribution of each hidden state conditioned on the previous hidden state.
  • observation_distribution: A tfp.distributions.Distribution-like instance. The rightmost batch dimension indexes the distribution of each observation conditioned on the corresponding hidden state.
  • num_steps: The number of steps taken in Markov chain. A python int.
  • validate_args: Python bool, default False. When True distribution parameters are checked for validity despite possibly degrading runtime performance. When False invalid inputs may silently render incorrect outputs. Default value: False.
  • allow_nan_stats: Python bool, default True. When True, statistics (e.g., mean, mode, variance) use the value "NaN" to indicate the result is undefined. When False, an exception is raised if one or more of the statistic's batch members are undefined. Default value: True.
  • name: Python str name prefixed to Ops created by this class. Default value: "HiddenMarkovModel".

Raises:

  • ValueError: if num_steps is not at least 1.
  • ValueError: if initial_distribution does not have scalar event_shape.
  • ValueError: if transition_distribution does not have scalar event_shape.
  • ValueError: if transition_distribution and observation_distribution are fully defined but don't have matching rightmost dimension.