|
Sleipnir
|
Extremely simple Hidden Markov Model (HMM) implementation allowing learning and generation from the model. More...
#include <hmm.h>
Public Member Functions | |
| void | Open (size_t iDegree, const std::string &strAlphabet) |
| Initializes an empty HMM of the requested degree over the given alphabet. | |
| void | Save (std::ostream &ostm) const |
| Outputs a simple textual representation of the HMM. | |
| bool | Add (const std::string &strData) |
| Updates the HMMs transition probabilities using the given string as training data. | |
| std::string | Get (size_t iLength) const |
| Randomly generates the requested number of characters from the HMM's alphabet using its current transition probabilities. | |
| void | SetUniform () |
| Sets all transition probabilities in the HMM to uniform probabilities. | |
Extremely simple Hidden Markov Model (HMM) implementation allowing learning and generation from the model.
Implements a simple HMM of arbitrary degree over a fixed alphabet of single characters. The HMM can be learned from input strings and, after training, can generate random sequences probabilistically from the model.
| bool Sleipnir::CHMM::Add | ( | const std::string & | strData | ) | [inline] |
Updates the HMMs transition probabilities using the given string as training data.
| strData | String of characters from which transition probabilities are updated. |
Definition at line 93 of file hmm.h.
References Sleipnir::CFullMatrix< tType >::Get().
| std::string Sleipnir::CHMM::Get | ( | size_t | iLength | ) | const [inline] |
Randomly generates the requested number of characters from the HMM's alphabet using its current transition probabilities.
| iLength | Number of characters to randomly generate. |
Definition at line 120 of file hmm.h.
References Sleipnir::CFullMatrix< tType >::Get(), Sleipnir::CFullMatrix< tType >::GetColumns(), and Sleipnir::CFullMatrix< tType >::GetRows().
| void Sleipnir::CHMM::Open | ( | size_t | iDegree, |
| const std::string & | strAlphabet | ||
| ) | [inline] |
Initializes an empty HMM of the requested degree over the given alphabet.
| iDegree | Degree of the HMM. |
| strAlphabet | Alphabet of characters encoded by the HMM. |
Definition at line 52 of file hmm.h.
References Sleipnir::CFullMatrix< tType >::Clear(), and Sleipnir::CFullMatrix< tType >::Initialize().
| void Sleipnir::CHMM::Save | ( | std::ostream & | ostm | ) | const [inline] |
Outputs a simple textual representation of the HMM.
| ostm | Stream to which the HMM is saved. |
Definition at line 66 of file hmm.h.
References Sleipnir::CFullMatrix< tType >::Get(), Sleipnir::CFullMatrix< tType >::GetColumns(), and Sleipnir::CFullMatrix< tType >::GetRows().
1.7.6.1