Skip to content

How to estimate covariance in logs? #2

@anilmullapudi

Description

@anilmullapudi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions