I am currently working with Scikit Learn and have been running into the following issue while trying to train a Gaussian HMM:
File "/Library/Python/2.7/site-packages/sklearn/hmm.py", line 443, in fit
self._do_mstep(stats, self.params)
File "/Library/Python/2.7/site-packages/sklearn/hmm.py", line 798, in _do_mstep
super(GaussianHMM, self)._do_mstep(stats, params)
File "/Library/Python/2.7/site-packages/sklearn/hmm.py", line 580, in _do_mstep
np.maximum(self.startprob_prior - 1.0 + stats['start'], 1e-20))
File "/Library/Python/2.7/site-packages/sklearn/hmm.py", line 476, in _set_startprob
raise ValueError('startprob must sum to 1.0')
ValueError: startprob must sum to 1.0
If I eliminate some of the features (fewer than 13 features per observation), it still works. I have checked that all of the input is valid and consists of only 2d-arrays of numpy.float64s for each training example. Any ideas on what is going wrong? Thanks!
I fixed the issue by setting the params attribute to a set of all unique values in my training set.
param=set(train.ravel())
model=hmm.GaussianHMM(n_components=6, covariance_type="full", n_iter=100,params=param)
train is my list of numpy arrays used to fit the model.
The initial parameters are set to a string of all ascii characters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With