accord-net / framework

Machine learning, computer vision, statistics and general scientific computing for .NET
http://accord-framework.net
GNU Lesser General Public License v2.1
4.49k stars 1.99k forks source link

A question for the specific hidden states in HMM models. #507

Closed scofield7419 closed 7 years ago

scofield7419 commented 7 years ago

Hi sir, when I use the HMM model to classify my sequences by using your codes I just specify the number of hidden states in this codes below: new HiddenMarkovClassifier<MultivariateNormalDistribution>(classes.Count, new Forward(states), new MultivariateNormalDistribution(Num_features), classes.ToArray()); And I guess the HMM model choose the states automatically which is invisible to me. So I got a question that how can I know the specific states inside that HMM models.

cesarsouza commented 7 years ago

Hello,

The state probabilities are defined by the topology class passed to it. In this example, the code is using a Forward topology (where states cannot go back in time) as it can be seen by the "new Forward(states)" being passed to the classifier's constructor.

You can specify other state architectures by using the Ergodic (every state is connected to all other states) or Custom (you can pass the transition matrices as you would like). You can also initialize it with Forward and manually customize the transition matrices by adjusting

classifier.Models[index_of_the_class].LogTransitions[index_state_from][index_state_to] = log_probability;

Hope it helps!

Regards, Cesar

cesarsouza commented 7 years ago

More examples have been added to the hidden Markov model documentation page.