Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to estimate covariance in logs? #2

Open
anilmullapudi opened this issue Mar 23, 2017 · 2 comments
Open

How to estimate covariance in logs? #2

anilmullapudi opened this issue Mar 23, 2017 · 2 comments

Comments

@anilmullapudi
Copy link

Hi,

while calculating covariance matrix in logs, i have modified the _reestimateMixtures() method in the file _ContinuousHMM.py as follows.

` numer = numpy.matrix(numpy.zeros( (self.d,self.d), dtype=self.precision))
denom = numpy.matrix(numpy.zeros( (self.d,self.d), dtype=self.precision))
for t in xrange(len(observations)):

vector_as_mat = numpy.matrix( (observations[t]-self.means[j][m]), dtype=self.precision )
 numer += (self._eta(t,len(observations)-1)*numpy.exp(gamma_mix[t][j][m])*numpy.dot( vector_as_mat.T, vector_as_mat))
 denom += (self._eta(t,len(observations)-1)*numpy.exp(gamma_mix[t][j][m]))

covars_new[j][m] = numer/denom
covars_new[j][m] = covars_new[j][m] + cov_prior[j][m]`

Problem is while training, some times the numer and denom in the above method are becoming zero's. and as a result, my covariance matrix contains all the Nan values.

Can anyone please help me, how to avoid covariance matrix not to contain nan values.

@jitesharora
Copy link

Hi anil,
I was trying to use this codebase for continuous HMM and I am facing the same issue.
Did you get it fixed or were you able to find a library online where a good implementation of this model is done. I have been stuck for many days. It would be great if you could help me out.

Thanks in Advance
:)

@ashu3194
Copy link

ashu3194 commented Feb 5, 2022

Pandas will ignore the pairwise correlation if it has a nan value in one of the observations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants