hmm_generate | R Documentation |
A utility to generate random sequences from a pre-trained Hidden Markov Model (HMM). The length of the desired sequence can be specified, and a random sequence of observations is returned.
hmm_generate(
length,
model,
seed = NA,
start_state = NA,
verbose = getOption("mlpack.verbose", FALSE)
)
length |
Length of sequence to generate (integer). |
model |
Trained HMM to generate sequences with (HMMModel). |
seed |
Random seed. If 0, 'std::time(NULL)' is used. Default value "0" (integer). |
start_state |
Starting state of sequence. Default value "0" (integer). |
verbose |
Display informational messages and the full list of parameters and timers at the end of execution. Default value "getOption("mlpack.verbose", FALSE)" (logical). |
This utility takes an already-trained HMM, specified as the "model" parameter, and generates a random observation sequence and hidden state sequence based on its parameters. The observation sequence may be saved with the "output" output parameter, and the internal state sequence may be saved with the "state" output parameter.
The state to start the sequence in may be specified with the "start_state" parameter.
A list with several components:
output |
Matrix to save observation sequence to (numeric matrix). |
state |
Matrix to save hidden state sequence to (integer matrix). |
mlpack developers
# For example, to generate a sequence of length 150 from the HMM "hmm" and
# save the observation sequence to "observations" and the hidden state
# sequence to "states", the following command may be used:
## Not run:
output <- hmm_generate(model=hmm, length=150)
observations <- output$output
states <- output$state
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.