mattjj / pyhsmm

MIT License
547 stars 173 forks source link

a <= 0 is < 0 in np.random.beta #6

Closed inti closed 11 years ago

inti commented 11 years ago

Hi, while working on issue #5 i came across this error.


### resample p
self.p = np.random.beta(self.alpha_0 + data.sum(), self.beta_0 + N*self.r)

/usr/lib/python2.7/dist-packages/numpy/random/mtrand.so in mtrand.RandomState.beta (numpy/random/mtrand/mtrand.c:7462)()

ValueError: a <= 0

I am not sure how to get around this one, help is welcome. BW, Inti

mattjj commented 11 years ago

What are the hyperparameters alpha_0 and beta_0? Both should be positive, and in that case 0 shouldn't be passed into np.random.beta.

mattjj commented 11 years ago

Or maybe r is getting set to a negative value? Can you tell me how to reproduce the error?

inti commented 11 years ago

this seesm to be due some inf values in my data which were converted to some negative value by python int casting.

mattjj commented 11 years ago

Oh interesting! Maybe there should be an assert in there somewhere.