I'm using the hmmlearn library to fit a Hidden Markov Model (HMM) to a dataset I've generated, but I'm encountering an issue where the model does not converge. Below is my code:
a = np.array([
[0.7, 0.2, 0.1],
[0.3, 0.5, 0.2],
[0.3, 0.3, 0.4]
])
b = np.array(
[[0.6, 0.2, 0.1, 0.1],
[0.2, 0.4, 0.2, 0.2],
[0.1, 0.1, 0.6, 0.2]]
)
pi = np.array([0.3, 0.4, 0.3])
model = MarkovModel(transition_probabilities=a, emission_probabilities=b, initial_state_distribution=pi)
observations = np.array([model.generate_observation_sequence(sequence_length=10) for _ in range(1_000)])
MarkovModel
is my class (https://github.com/SuperrMurlocc/hmm.git) but all it does is it generates set of sequences of observations, here is an example (not exactly 1000 sequences due to stackoverflow's character limit):
[[2, 0, 1, 0, 0, 3, 0, 0, 2, 0],
[0, 1, 2, 3, 3, 2, 0, 1, 1, 2],
[0, 1, 0, 0, 3, 2, 1, 0, 0, 0],
[2, 2, 3, 1, 2, 1, 1, 0, 3, 3],
[0, 1, 0, 0, 0, 2, 3, 0, 0, 1],
[3, 1, 2, 2, 1, 2, 0, 0, 3, 1],
[0, 0, 2, 1, 0, 3, 0, 2, 0, 1],
[1, 0, 0, 0, 3, 1, 1, 1, 0, 0],
[2, 0, 2, 1, 2, 1, 0, 1, 1, 1],
[0, 1, 0, 0, 3, 2, 2, 0, 3, 3],
[0, 0, 2, 2, 0, 1, 1, 0, 3, 1],
[0, 0, 3, 2, 0, 2, 0, 1, 0, 0],
[0, 0, 0, 1, 2, 1, 1, 3, 0, 0],
[3, 1, 0, 1, 2, 0, 2, 1, 2, 1],
[3, 0, 3, 0, 0, 0, 0, 1, 1, 0],
[2, 2, 3, 2, 2, 1, 2, 1, 1, 1],
[1, 3, 1, 0, 0, 1, 1, 0, 1, 2],
[1, 3, 1, 3, 0, 0, 1, 1, 2, 2],
[2, 3, 0, 3, 2, 1, 2, 2, 2, 2],
[2, 0, 1, 1, 0, 0, 0, 0, 3, 1],
[2, 0, 0, 0, 0, 0, 3, 2,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 1, 1, 0, 2, 0],
[0, 1, 2, 0, 0, 0, 0, 2, 2, 3],
[0, 2, 2, 0, 0, 0, 1, 0, 1, 2],
[1, 0, 2, 1, 0, 0, 2, 0, 0, 0],
[0, 0, 0, 3, 0, 0, 0, 3, 3, 0],
[0, 0, 1, 1, 0, 0, 2, 2, 3, 0],
[0, 3, 0, 3, 0, 0, 2, 0, 2, 2],
[0, 0, 2, 1, 0, 1, 0, 2, 2, 0],
[2, 2, 2, 0, 0, 0, 0, 0, 1, 0],
[3, 0, 0, 0, 3, 3, 0, 0, 0, 1],
[3, 0, 3, 3, 0, 0, 0, 2, 3, 1],
[0, 0, 1, 1, 2, 0, 1, 1, 1, 1],
[2, 0, 2, 3, 2, 1, 1, 2, 3, 0],
[0, 0, 1, 1, 0, 2, 2, 1, 3, 1],
[1, 2, 3, 3, 0, 1, 2, 3, 2, 2],
[1, 1, 3, 1, 0, 0, 0, 0, 0, 2],
[2, 0, 1, 2, 2, 1, 0, 0, 2, 0],
[1, 0, 0, 0, 0, 2, 2, 0, 3, 0],
[1, 0, 1, 0, 0, 0, 0, 0, 0, 0],
[2, 2, 2, 0, 1, 2, 2, 3, 2, 2],
[1, 0, 2, 2, 3, 1, 0, 3, 2, 0],
[0, 0, 3, 1, 3, 0, 0, 0, 3, 0],
[2, 0, 0, 3, 1, 0, 3, 2, 2, 0],
[1, 2, 0, 0, 1, 0, 0, 2, 2, 3],
[1, 2, 2, 2, 0, 1, 1, 2, 3, 1],
[0, 2, 3, 0, 1, 0, 0, 0, 2, 1],
[1, 0, 1, 3, 2, 0, 0, 0, 0, 1],
[0, 0, 0, 2, 1, 0, 0, 3, 2, 1],
[0, 0, 3, 2, 1, 3, 0, 1, 0, 2],
[1, 1, 1, 0, 1, 0, 0, 1, 0, 0],
[2, 3, 0, 2, 1, 0, 1, 0, 0, 1],
[3, 3, 2, 2, 2, 0, 0, 3, 1, 2],
and the rest of the code, so trying to remodel:
concatenated = np.concatenate(observations.reshape(10, 1_000))
remodel = hmm.CategoricalHMM(n_components=3, n_iter=100, verbose=True)
remodel.fit(concatenated.reshape(-1, 1), lengths=[10 for _ in range(1_000)])
No matter what i try i get shitty remodel.emissionprob_
and remodel.transmat_
very close to
[[.33 .33. 33],
[.33 .33. 33],
[.33 .33. 33]]
Also the following warning occurs very often:
Model is not converging.
I've already tried:
CategoricalHMM
;transmat_
, emissionprob_
and start_prob
by hand by adding init_params
parameter;MultinomialHMM
and remodel.fit(observations)
.I don't know wether it's my machine or not, but what solved the problem for me was changing numpy
package version to 1.26.4
.