@@ -526,10 +526,10 @@ def _do_mstep(self, X, posteriors, params, min_covar=0):
526
526
527
527
528
528
def _lmvnpdfdiag (obs , means = 0.0 , covars = 1.0 ):
529
- nobs , n_dim = obs .shape
529
+ n_obs , n_dim = obs .shape
530
530
# (x-y).T A (x-y) = x.T A x - 2x.T A y + y.T A y
531
531
#lpr = -0.5 * (np.tile((np.sum((means**2) / covars, 1)
532
- # + np.sum(np.log(covars), 1))[np.newaxis,:], (nobs ,1))
532
+ # + np.sum(np.log(covars), 1))[np.newaxis,:], (n_obs ,1))
533
533
lpr = - 0.5 * (n_dim * np .log (2 * np .pi ) + np .sum (np .log (covars ), 1 )
534
534
+ np .sum ((means ** 2 ) / covars , 1 )
535
535
- 2 * np .dot (obs , (means / covars ).T )
@@ -546,7 +546,7 @@ def _lmvnpdfspherical(obs, means=0.0, covars=1.0):
546
546
547
547
def _lmvnpdftied (obs , means , covars ):
548
548
from scipy import linalg
549
- nobs , n_dim = obs .shape
549
+ n_obs , n_dim = obs .shape
550
550
# (x-y).T A (x-y) = x.T A x - 2x.T A y + y.T A y
551
551
icv = linalg .pinv (covars )
552
552
lpr = - 0.5 * (n_dim * np .log (2 * np .pi ) + np .log (linalg .det (covars ))
@@ -568,9 +568,9 @@ def _lmvnpdffull(obs, means, covars):
568
568
else :
569
569
# slower, but works
570
570
solve_triangular = linalg .solve
571
- nobs , n_dim = obs .shape
571
+ n_obs , n_dim = obs .shape
572
572
nmix = len (means )
573
- log_prob = np .empty ((nobs ,nmix ))
573
+ log_prob = np .empty ((n_obs ,nmix ))
574
574
for c , (mu , cv ) in enumerate (itertools .izip (means , covars )):
575
575
cv_chol = linalg .cholesky (cv , lower = True )
576
576
cv_log_det = 2 * np .sum (np .log (np .diagonal (cv_chol )))
0 commit comments