I want to use BIC for HMM model selection:
BIC = -2*logLike + num_of_params * log(num_of_data)
So how do I count the number of parameters in the HMM model. Consider a simple 2-state HMM, where we have the following data:
data = [1 2 1 1 2 2 2 1 2 3 3 2 3 2 1 2 2 3 4 5 5 3 3 2 6 6 5 6 4 3 4 4 4 4 4 4 3 3 2 2];
model = hmmFit(data, 2, 'discrete');
model.pi = 0.6661 0.3339;
model.A =
0.8849 0.1151
0.1201 0.8799
model.emission.T =
0.2355 0.5232 0.2259 0.0052 0.0049 0.0053
0.0053 0.0449 0.2204 0.4135 0.1582 0.1578
logLike = hmmLogprob(model,data);
logLike = -55.8382
So I think:
Nparams = size(model.A,2)*(size(model.A,2)-1) +
size(model.pi,2)-1) +
size(model.emission.T,1)*(size(model.emission.T,2)-1)
Nparams = 13
So at the end we have:
BIC = -2*logLike + num_of_params*log(length(x))
BIC = 159.6319
I've found a solution where the formula for num_of_params
(for simple Markov model) looks like:
Nparams = Num_of_states*(Num_of_States-1) - Nbzeros_in_transition_matrix
So what's the right solution? Do I have to take into account some zero probabilities in transition or emission matrices?
====Updated since 07.15.2011====
I think I can provide some clarification on the impact of data dimension (using “Gaussian mixture distribution” example)
X is an n-by-d matrix where (n-rows correspond to observations; d-columns correspond to variables (Ndimensions).
X=[3,17 3,43
1,69 2,94
3,92 5,04
1,65 1,79
1,59 3,92
2,53 3,73
2,26 3,60
3,87 5,01
3,71 4,83
1,89 3,30 ];
[n d] = size(X);
n = 10; d =2;
The model will have the following number of parameters for GMM:
nParam = (k_mixtures – 1) + (k_mixtures * NDimensions ) + k_mixtures * Ndimensions %for daigonal covariance matrices
nParam = (k_mixtures – 1) + (k_mixtures * NDimensions ) + k_mixtures * NDimensions * (NDimensions+1)/2; %for full covariance matrices
If we treat X as 1-dimensional data, than we have num_of_data = (n*d)
,
so for the 2-dimensional data we have num_of_data = n
.
2-dimensional data: nParam = 11 ; logLike = -11.8197; BIC = 1.689
1-dimensional data: nParam = 5 ; logLike = -24.8753; BIC = -34.7720
I have a very little practice with HMM. Is it normal to have HMM with (5000, 6000 and more parameters)?