10000 Rename nobs --> n_obs · seckcoder/scikit-learn@898ab69 · GitHub
[go: up one dir, main page]

Skip to content

Commit 898ab69

Browse files
author
Fabian Pedregosa
committed
Rename nobs --> n_obs
1 parent 5ea578a commit 898ab69

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

scikits/learn/mixture.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,10 @@ def _do_mstep(self, X, posteriors, params, min_covar=0):
526526

527527

528528
def _lmvnpdfdiag(obs, means=0.0, covars=1.0):
529-
nobs, n_dim = obs.shape
529+
n_obs, n_dim = obs.shape
530530
# (x-y).T A (x-y) = x.T A x - 2x.T A y + y.T A y
531531
#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))
533533
lpr = -0.5 * (n_dim * np.log(2 * np.pi) + np.sum(np.log(covars), 1)
534534
+ np.sum((means ** 2) / covars, 1)
535535
- 2 * np.dot(obs, (means / covars).T)
@@ -546,7 +546,7 @@ def _lmvnpdfspherical(obs, means=0.0, covars=1.0):
546546

547547
def _lmvnpdftied(obs, means, covars):
548548
from scipy import linalg
549-
nobs, n_dim = obs.shape
549+
n_obs, n_dim = obs.shape
550550
# (x-y).T A (x-y) = x.T A x - 2x.T A y + y.T A y
551551
icv = linalg.pinv(covars)
552552
lpr = -0.5 * (n_dim * np.log(2 * np.pi) + np.log(linalg.det(covars))
@@ -568,9 +568,9 @@ def _lmvnpdffull(obs, means, covars):
568568
else:
569569
# slower, but works
570570
solve_triangular = linalg.solve
571-
nobs, n_dim = obs.shape
571+
n_obs, n_dim = obs.shape
572572
nmix = len(means)
573-
log_prob = np.empty((nobs,nmix))
573+
log_prob = np.empty((n_obs,nmix))
574574
for c, (mu, cv) in enumerate(itertools.izip(means, covars)):
575575
cv_chol = linalg.cholesky(cv, lower=True)
576576
cv_log_det = 2*np.sum(np.log(np.diagonal(cv_chol)))

0 commit comments

Comments
 (0)
0