'Getting ValueError when expanding my GMMHMM from 2 to three states

I am trying to expand my GMMHMM model from two to three states but get the error below

 "ValueError: startprob_ must sum to 1 (got nan)"

. It looks like it states that my initial state distribution does not sum up to one but it does (see Pi). Furthermore

I get the following warning, might have something to do with it:

"UserWarning: KMeans is known to have a memory leak on Windows with MKL, when there are less chunks than available threads. You can avoid it by setting the environment variable OMP_NUM_THREADS=1." 

Furthermore, If I look into it I can see that my state transition matrix returns nan values.

import numpy as np
from hmmlearn.hmm import GMMHMM
import pandas as pd

Pi = np.array([0.24, 0.37, 0.39])
A = np.array([[0.74, 0.20, 0.06],
             [0.20, 0.53, 0.27 ],
             [0.05, 0.40, 0.54]])

model = GMMHMM(n_components=3, n_mix=1, startprob_prior=Pi,  transmat_prior=A,
           min_covar=0.001, tol=0.0001, n_iter=10000)
Obs = df[['gdp','un','inf','inx','itr']].to_numpy()    
print(Obs)  
model.fit(Obs)

print(model.transmat_) 

seq = model.decode(Obs)
print(seq)

I am not a really experienced Python programmer, so might be an easy solve but unfortunately I do not see how. Any help would be highly appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source