Closed ckwastra closed 6 months ago
Describe the mistake In the provided text (emphasis mine):
[...] This is also evidenced by the log-likelihood values, which increased from 28.3 (initialization) to 14.4 after one complete update cycle.
The correct values for these two numbers are -28.3 and -14.4, respectively.
Location
Proposed solution Correct the values by changing 28.3 to -28.3 and 14.4 to -14.4.
Additional context To obtain the accurate values, run the following Python script:
from statistics import NormalDist from math import log, sqrt class Theta: def __init__(self, K, pi, mu, sigma): self.K = K self.pi = pi self.mu = mu self.sigma = sigma def p(x, theta): v = 0 for k in range(0, theta.K): v += theta.pi[k] * NormalDist(theta.mu[k], sqrt(theta.sigma[k])).pdf(x) return v def logp(X, theta): v = 0 for n in range(0, len(X)): v += log(p(X[n], theta)) return v X = [-3, -2.5, -1, 0, 2, 4, 5] theta = Theta(3, [1 / 3] * 3, [-4, 0, 8], [1, 0.2, 3]) print("%.1f" % logp(X, theta)) # -28.3 theta = Theta(3, [0.29, 0.29, 0.42], [-2.7, -0.4, 3.7], [0.14, 0.44, 1.53]) print("%.1f" % logp(X, theta)) # -14.4
you are correct. thanks for pointing this out
Describe the mistake In the provided text (emphasis mine):
The correct values for these two numbers are -28.3 and -14.4, respectively.
Location
Proposed solution Correct the values by changing 28.3 to -28.3 and 14.4 to -14.4.
Additional context To obtain the accurate values, run the following Python script: