| | |
- backward(hmm, Obs, c=None)
- Calculate the probability of a partial observation sequence
from t+1 to T, given some state t.
Obs: observation sequence
hmm: model
c: the scaling coefficients from forward algorithm
returns: B_t(i)
- baum_welch(hmm, Obs_seqs, **args)
- EM algorithm to update Pi, A, and B for the HMM
:Parameters:
- `hmm` - hmm model to train
- `Obs_seqs` - list of observation sequences to train over
:Return:
a trained hmm
:Keywords:
- `epochs` - number of iterations to perform EM, default is 20
- `val_set` - validation data set, not required but recommended to prevent over-fitting
- `updatePi` - flag to update initial state probabilities
- `updateMean` - flag to update means of continuous observations, default is True
- `updateVar` - flag to update variance of continuous obervations, default is True
- `updateA` - flag to update transition probabilities, default is True
- `updateB` - flag to update observation emission probabilites for discrete types, default is True
- `scaling` - flag to scale probabilities (log scale), default is True
- `graph` - flag to plot log-likelihoods of the training epochs, default is False
- `normUpdate` - flag to use 1 / -(normed log-likelihood) contribution for each observation
sequence when updating model parameters, default if False
- `verbose` - flag to print training times and log likelihoods for each training epoch, default is false
- dishonest_casino_test(graph=True)
- forward(hmm, Obs, scaling=True)
- Calculate the probability of an observation sequence, Obs,
given the model, P(Obs|hmm).
Obs: observation sequence
hmm: model
returns: P(Obs|hmm)
- norm_df(X, mu=0, sigma=1.0)
- Returns the normal density function centered at mu
with width sigma for a value X. X is a N X D matrix
where N is the number of samples and D is the
dimensionality of the data.
- symbol_index(hmm, Obs)
- Converts an obeservation symbol sequence into a sequence
of indices for accessing distribution matrices.
- viterbi(hmm, Obs, scaling=True)
- Calculate P(Q|Obs, hmm) and yield the state sequence Q* that
maximizes this probability.
Obs: observation sequence
hmm: model
|