Description Usage Arguments Details Value Examples

The `learnModel`

function, learns a HMM-A from the supplied data file.
The function first creates a random model: the initial and transition
distributions are initialized using a Dirichlet
https://en.wikipedia.org/wiki/Dirichlet_distribution distribution.
Thereafter the model is maximised for the datafile that is supplied.

1 2 3 4 5 6 7 8 | ```
learnModel(
data,
amountOfStates = 2,
maxit = 50,
seed,
iss = 1e-04,
debug = FALSE
)
``` |

`data` |
The datafile. The datafile should be a list containing a dataframe with the data as its $x component and contain the lengths of the observations a the $N component (see details). |

`amountOfStates` |
The amount of states. |

`maxit` |
The maximum amount of iterations. |

`seed` |
Seed (optional). |

`iss` |
The Imaginary Sample Size (iss), also called priors, to add data. |

`debug` |
Debugmode. |

The `learnModel`

makes use of the `mhsmm`

`hmmfit`

function. An example of the structure of the
datafile can be found in `hmmaExampleData`

.

The output of the function is an asymmetric hidden Markov model. This model contains the amount of states, the initial distribution, the transition distribution and the emission distribution (Bayesian networks in the different states).

The model can quicly be visualised with the `visualise`

method.
The `visualise`

method does not show the Bayesian networks
within the states as this would result in unreadable graphs. Instead, the
`bnlearn`

`graphviz.plot`

method can be used (see
the examples below).

1 2 3 4 5 6 | ```
fit <- learnModel(data = hmmaExampleData, amountOfStates = 3, seed = 1234)
visualise(fit)
# See bn in first state
library(bnlearn)
graphviz.plot(fit$parms.emission[[1]])
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.