MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / log_gaussian_pdf

Function log_gaussian_pdf

numpy_ml/utils/misc.py:16–24  ·  view source on GitHub ↗

Compute log N(x_i | mu, sigma)

(x_i, mu, sigma)

Source from the content-addressed store, hash-verified

14
15
16def log_gaussian_pdf(x_i, mu, sigma):
17 """Compute log N(x_i | mu, sigma)"""
18 n = len(mu)
19 a = n * np.log(2 * np.pi)
20 _, b = np.linalg.slogdet(sigma)
21
22 y = np.linalg.solve(sigma, x_i - mu)
23 c = np.dot(x_i - mu, y)
24 return -0.5 * (a + b + c)

Callers 3

predictMethod · 0.90
_E_stepMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected