|
libcrn
3.9.5
A document image processing library
|
Discrete HMM class. More...
#include <CRNDiscreteHMM.h>
Inheritance diagram for crn::DiscreteHMM:
Collaboration diagram for crn::DiscreteHMM:Public Member Functions | |
| DiscreteHMM () | |
| Default constructor. More... | |
| DiscreteHMM (int nstates, int nsymbs) | |
| Constructor. More... | |
| DiscreteHMM (const DiscreteHMM &h) | |
| Copy constructor. More... | |
| DiscreteHMM & | operator= (const DiscreteHMM &)=delete |
| DiscreteHMM (DiscreteHMM &&) noexcept | |
| DiscreteHMM & | operator= (DiscreteHMM &&) noexcept |
| virtual | ~DiscreteHMM () override |
| Destructor. More... | |
| bool | operator== (const DiscreteHMM &other) const |
| Tests the equality of two models. More... | |
| size_t | GetNbStates () const noexcept |
| Returns the number of states. More... | |
| size_t | GetNbSymbols () const noexcept |
| Returns the number of symbols. More... | |
| SCSquareMatrixDouble | GetStateTransitionProbability () const |
| Returns a reference to the state transition probability matrix. More... | |
| SCMatrixDouble | GetStateGivenSymbolProbability () const |
| Returns a reference to the state given symbol probability matrix. More... | |
| SCMatrixDouble | GetFirstStateProbability () const |
| Returns a reference to the first state probability matrix. More... | |
| void | SetStateTransitionProbability (const SquareMatrixDouble &a) |
| Sets the state transition probability matrix. More... | |
| void | SetStateGivenSymbolProbability (const MatrixDouble &b) |
| Sets the state given symbol probability matrix. More... | |
| void | SetFirstStateProbability (const MatrixDouble &p) |
| Sets the first state probability matrix. More... | |
| bool | IsValid () const |
| Checks if the model is valid. More... | |
| String | ToString () const |
| Dumps a summary to a string. More... | |
| double | SequenceProbability (const MatrixInt &observed) const |
| Returns the a priori probability of an observed sequence. More... | |
| UMatrixInt | MakeViterbi (const MatrixInt &observed) const |
| Returns the most likely state state sequence corresponding to an observed sequence. More... | |
| void | BaumWelchSingle (const MatrixInt &observed, size_t maxIter) |
| Learning from one observed sequence. More... | |
| void | BaumWelchMultiple (const MatrixInt &observationSet, size_t maxIter) |
| Learning from multiple observed sequences. More... | |
Public Member Functions inherited from crn::Object | |
| virtual | ~Object ()=default |
Discrete HMM class.
Discrete Hidden Markov Model
Definition at line 41 of file CRNDiscreteHMM.h.
|
inline |
Default constructor.
Definition at line 46 of file CRNDiscreteHMM.h.
| DiscreteHMM::DiscreteHMM | ( | int | nstates, |
| int | nsymbs | ||
| ) |
Constructor.
Constructor
| [in] | nstates | number of states for HMM |
| [in] | nsymbs | number of symbols for HMM |
Definition at line 56 of file CRNDiscreteHMM.cpp.
| DiscreteHMM::DiscreteHMM | ( | const DiscreteHMM & | h | ) |
Copy constructor.
Copy constructor
| [in] | h | another HMM |
Definition at line 40 of file CRNDiscreteHMM.cpp.
|
defaultnoexcept |
|
overridevirtual |
| void DiscreteHMM::BaumWelchMultiple | ( | const MatrixInt & | observationSet, |
| size_t | maxIter | ||
| ) |
Learning from multiple observed sequences.
HMM model training with Baum-Welch procedure. Training with many observation sequences.
| [in] | observationSet | the observed sequences. Each sequence is a line of the matrix. |
| [in] | maxIter | maximal number of iterations |
Definition at line 507 of file CRNDiscreteHMM.cpp.
| void DiscreteHMM::BaumWelchSingle | ( | const MatrixInt & | observed, |
| size_t | maxIter | ||
| ) |
Learning from one observed sequence.
HMM model training with Baum-Welch procedure. Training with one observation sequence.
| [in] | observed | the observed sequence as a line matrix |
| [in] | maxIter | the maximum number of iterations |
Definition at line 350 of file CRNDiscreteHMM.cpp.
|
inline |
Returns a reference to the first state probability matrix.
Definition at line 73 of file CRNDiscreteHMM.h.
|
inlinenoexcept |
Returns the number of states.
Definition at line 63 of file CRNDiscreteHMM.h.
|
inlinenoexcept |
Returns the number of symbols.
Definition at line 66 of file CRNDiscreteHMM.h.
|
inline |
Returns a reference to the state given symbol probability matrix.
Definition at line 71 of file CRNDiscreteHMM.h.
|
inline |
Returns a reference to the state transition probability matrix.
Definition at line 69 of file CRNDiscreteHMM.h.
| bool DiscreteHMM::IsValid | ( | ) | const |
Checks if the model is valid.
Check if model is valid
Definition at line 114 of file CRNDiscreteHMM.cpp.
| UMatrixInt DiscreteHMM::MakeViterbi | ( | const MatrixInt & | observed | ) | const |
Returns the most likely state state sequence corresponding to an observed sequence.
Viterbi procedure to estimate the best state chain given an observation chain
| [in] | observed | the observed sequence |
Definition at line 270 of file CRNDiscreteHMM.cpp.
|
delete |
|
defaultnoexcept |
| bool DiscreteHMM::operator== | ( | const DiscreteHMM & | other | ) | const |
Tests the equality of two models.
Check if two models are equal
| [in] | other | the other HMM |
Definition at line 141 of file CRNDiscreteHMM.cpp.
| double DiscreteHMM::SequenceProbability | ( | const MatrixInt & | observed | ) | const |
Returns the a priori probability of an observed sequence.
Probability estimation for a given observation sequence
| [in] | observed | the observed sequence |
Definition at line 247 of file CRNDiscreteHMM.cpp.
| void DiscreteHMM::SetFirstStateProbability | ( | const MatrixDouble & | p | ) |
Sets the first state probability matrix.
Set the first state probability matrix. A copy of the matrix is made.
| [in] | p | the new first state probability matrix |
Definition at line 103 of file CRNDiscreteHMM.cpp.
| void DiscreteHMM::SetStateGivenSymbolProbability | ( | const MatrixDouble & | b | ) |
Sets the state given symbol probability matrix.
Set the state given symbol probability matrix. A copy of the matrix is made.
| [in] | b | the new state given symbol probability matrix |
Definition at line 91 of file CRNDiscreteHMM.cpp.
| void DiscreteHMM::SetStateTransitionProbability | ( | const SquareMatrixDouble & | a | ) |
Sets the state transition probability matrix.
Set the state transition probability matrix. A copy of the matrix is made.
| [in] | a | the new state transition probability matrix |
Definition at line 80 of file CRNDiscreteHMM.cpp.
| String DiscreteHMM::ToString | ( | ) | const |
Dumps a summary to a string.
Dump a summary to a string
Definition at line 766 of file CRNDiscreteHMM.cpp.
1.8.6