Data Structures | Functions

src/hmm.h File Reference

STATUS: work in progress Hidden Markov Models. More...

#include "mathadd.h"
#include "definitions.h"
#include "eeg.h"
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  CPHiddenMarkovModel

Functions

CPHiddenMarkovModelcphmm_alloc (int K, int n, int M, int Q, int J)
void cphmm_free (CPHiddenMarkovModel *m)
double cphmm_get_transition_prob (CPHiddenMarkovModel *m, int k, int i, int j)
void cphmm_init (CPHiddenMarkovModel *m, double **X)
CPHiddenMarkovModeleeg_cphmm_init (EEG *eeg, int channel, double **X)

Detailed Description

STATUS: work in progress Hidden Markov Models.

Warning:
For now this is only experimental but plans are to complete this file.

Implements the continuous profile model from:

Listgarten et al. Multiple alignment of continuous time series. Advances in Neural Information Processing Systems (2005) vol. 17 pp. 817–824

Definition in file hmm.h.


Function Documentation

CPHiddenMarkovModel* cphmm_alloc ( int  K,
int  n,
int  M,
int  Q,
int  J 
)

allocate memory for the CPM.

Parameters:
K number of trials
n number of samples per trial
M number of samples in latent trace
Q number of amplitude states
J maximum number of jumps in warping

Definition at line 55 of file hmm.c.

void cphmm_free ( CPHiddenMarkovModel m  ) 

deallocate the model's struct. RNG is dealloc'ed as well.

Definition at line 165 of file hmm.c.

double cphmm_get_transition_prob ( CPHiddenMarkovModel m,
int  k,
int  i,
int  j 
)

STATUS: work in progress return state transition probabilities from state i to state j in trace k:

\[ p^k(\pi_i|\pi_{i-1}) = p^k(\phi_i|\phi_{i-1})p^k(\tau_i|\tau_{i-1}) \]

where

\[ \pi_i = (\phi_i, \tau_i) \]

Details see Listgarten et al. 2005

Todo:
not implemented yes

Definition at line 36 of file hmm.c.

void cphmm_init ( CPHiddenMarkovModel m,
double **  X 
)

initializing the model according to the parameters from Listgarten et al. 2005:

  • sigma = 15% of max(X[0])-min(X[0])
  • z = first observed time-series + gaussian noise (0, sigma) upsampling to match M
  • u = (1,...,1)
  • d,s = uniform
  • q is filled with Q numbers evenly spaced in log-space [0,2]
    Parameters:
    m the model
    X the data, K x n

Definition at line 97 of file hmm.c.

CPHiddenMarkovModel* eeg_cphmm_init ( EEG eeg,
int  channel,
double **  X 
)

init the model from EEG-data. The data matrix X is a return value.

Parameters:
eeg 
channel - which channel is used?
X - the converted data. X should contain K empty pointers. These are set to the appropriate data in eeg (not copied).

Definition at line 140 of file hmm.c.