HMM
Toolbox for hidden Markov models
hmm_vec.cpp File Reference

core functions for hmm, construction and decoding More...

#include <hmm.h>

Functions

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...
 

Detailed Description

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

Function Documentation

◆ logE()

double logE ( double  val)

adds small constant before taking the logarithm, to avoid log(0) error

Parameters
valinput value
Returns
log(val + small epsilon)

◆ setWarning()

void setWarning ( char *  strin)

Simple macro to print to cout.

Parameters
strinstring 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
hmmobject containing parameters of the HMM
observedvector of ints representing the obeserved signal
ntime-length of the input signal
Returns
vector of most-likely states