Package dev.nm.stat.hmm
Class HMMRNG
- java.lang.Object
-
- dev.nm.stat.markovchain.SimpleMC
-
- dev.nm.stat.hmm.HMMRNG
-
- All Implemented Interfaces:
RandomNumberGenerator
,Seedable
- Direct Known Subclasses:
HiddenMarkovModel
,KnightSatchellTran1995
public class HMMRNG extends SimpleMC
In a (discrete) hidden Markov model, the state is not directly visible, but output, dependent on the state, is visible. Each state has a probability distribution over the possible output tokens (could be continuous). Therefore the sequence of tokens generated by an HMM gives some information about the sequence of states. Note that the adjective 'hidden' refers to the state sequence through which the model passes, not to the parameters of the model; even if the model parameters are known exactly, the model is still 'hidden'. In other words, a hidden Markov model is a Markov chain of (hidden) states and for each state a conditional random number generator (distribution).- See Also:
- Wikipedia: Hidden Markov model
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HmmInnovation
next()
Gets the next simulated innovation: state and observation.double
nextDouble()
Gets the next simulated observation.void
seed(long... seeds)
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
-
-
Constructor Detail
-
HMMRNG
public HMMRNG(Vector PI, Matrix A, RandomNumberGenerator[] B)
Constructs a hidden Markov model.- Parameters:
PI
- the initial state probabilitiesA
- the state transition probabilities of the homogeneous hidden Markov chainB
- the conditional observation random number generators (distributions)
-
HMMRNG
public HMMRNG(HMMRNG that)
Copy constructor.- Parameters:
that
- aHiddenMarkovModel
-
-
Method Detail
-
seed
public void seed(long... seeds)
Description copied from interface:Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
nextDouble
public double nextDouble()
Gets the next simulated observation.- Specified by:
nextDouble
in interfaceRandomNumberGenerator
- Overrides:
nextDouble
in classSimpleMC
- Returns:
- next observation
-
next
public HmmInnovation next()
Gets the next simulated innovation: state and observation.- Returns:
- the next HMM innovation
-
-