core functions for hmm, construction and decoding
More...
#include <hmm.h>
|
double | logE (double val) |
| adds small constant before taking the logarithm, to avoid log(0) error More...
|
|
int * | viterbi (HMMv const &hmm, std::vector< int > observed, const int n) |
| Uses the viterbi algorithm to estimate the most-likely state sequence. More...
|
|
void | setWarning (char *strin) |
| Simple macro to print to cout. More...
|
|
core functions for hmm, construction and decoding
Constructs HMM object as well as performs viterbi decoding
- Author
- Adam Willats. based on viterbi.cpp by Feder1co 5oave: https://gist.github.com/Feder1co5oave/2347228
- Date
- 2019-2021
◆ logE()
double logE |
( |
double |
val | ) |
|
adds small constant before taking the logarithm, to avoid log(0) error
- Parameters
-
- Returns
- log(val + small epsilon)
◆ setWarning()
void setWarning |
( |
char * |
strin | ) |
|
Simple macro to print to cout.
- Parameters
-
strin | string to be printed |
- Note
- mostly for debugging, could be removed
◆ viterbi()
int* viterbi |
( |
HMMv const & |
hmm, |
|
|
std::vector< int > |
observed, |
|
|
const int |
n |
|
) |
| |
Uses the viterbi algorithm to estimate the most-likely state sequence.
- Parameters
-
hmm | object containing parameters of the HMM |
observed | vector of ints representing the obeserved signal |
n | time-length of the input signal |
- Returns
- vector of most-likely states