MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / loglikelihood

Function loglikelihood

bayesian_ml/2/em.py:25–32  ·  view source on GitHub ↗
(X, Z, W)

Source from the content-addressed store, hash-verified

23 X[i] = np.random.multivariate_normal(mean=W0.dot(Z[i]), cov=sigmaI)
24
25def loglikelihood(X, Z, W):
26 ZW = Z.dot(W.T)
27 LL = 0
28 for i in xrange(N):
29 ll = mvn.logpdf(X[i], mean=ZW[i], cov=sigmaI)
30 LL += ll
31 LL += norm.logpdf(W.flatten(), scale=1/lam).sum()
32 return LL
33
34# do EM
35W = np.random.randn(D, K) / np.sqrt(D + K)

Callers 1

em.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected