PRML / PRMLT

Matlab code of machine learning algorithms in book PRML
http://prml.github.io/
MIT License
6.03k stars 2.16k forks source link

Chapter02: LogGauss error #34

Closed tndoan closed 8 years ago

tndoan commented 8 years ago

There are some errors in logGauss.m

 X = [1 2 4.0]; mu = 1; sigma=2
logGauss(X, mu, sigma)

The result is

   -1.2655   -1.5155   -3.5155

while using the build-in function normpdf provides a different result

normpdf(X, mu, sigma)

ans =

    0.1760    0.1995    0.1210
sth4nth commented 8 years ago

logGauss requires variance, where normpdf requies standard deviation. Therefore you should compare exp(logGauss(X,mu,sigma^2)) with normpdf(X,mu,sigma)