0

I am using Gaussian HMM with hmmlearn library in python. I have multiple sequences and I am modeling a left-right HMM topology:

num_states = 15
remodel = hmm.GaussianHMM(n_components=num_states,
                          n_iter=500,
                          verbose=True,
                          init_params="cm", params="cmt")

transmat = np.zeros((num_states, num_states))
# Left-to-right: each state is connected to itself and its
# direct successor.
for i in range(num_states):
    if i == num_states - 1:
        transmat[i, i] = 1.0
    else:
        transmat[i, i] = transmat[i, i + 1] = 0.5

# Always start in first state
startprob = np.zeros(num_states)
startprob[0] = 1.0

remodel.startprob_ = startprob
remodel.transmat_ = transmat
remodel = remodel.fit(df_hmm, lengths)

The state distribution should start with the initial state of 0, however, it starts with the last state of the sequence, is there something that I am missing?

first sequence second sequence third sequence

Thank you

0 Answers0