mattjj / pyhsmm

MIT License
547 stars 173 forks source link

Assertion error when number of dimensions is 1 #15

Closed nipunbatra closed 11 years ago

nipunbatra commented 11 years ago

While fiddling with hmm-EM.py example, put obs_dim = 1 instead of 2. Following is the traceback. Is 1d logically wrong?

Traceback (most recent call last):
File "hmm-EM.py", line 27, in <module>
true_obs_distns = [pyhsmm.distributions.Gaussian(**obs_hypparams) for state in     xrange(N)]
File "/usr/local/lib/python2.7/dist-packages/pyhsmm/basic/pybasicbayes/distributions.py", line 101, in __init__
assert sigma_0.shape == (self.D,self.D) and self.D >= 2
AssertionError
mattjj commented 11 years ago

There are special 1d Gaussian observation distributions to use for the 1d case (see basic/pybasicbayes/distributions.py, the classes start with ScalarGaussian). They may not have max_likelihood implemented.

It's probably possible to make the Gaussian methods do the right bookkeeping for 1d, but it's a pain and it might be inefficient (matrix solves would need to map to simple division, etc).

Sent from my phone

mattjj commented 11 years ago

Going to leave this how it is unless more issues come up.