probml / pmtk3

Probabilistic Modeling Toolkit for Matlab/Octave.
MIT License
1.55k stars 797 forks source link

A bug in naiveBayesBayesianDemo #106

Open mamintoosi opened 8 years ago

mamintoosi commented 8 years ago

Dear Kevin; At line 38 of naiveBayesBayesianDemo.m the numbers of items in each class is computed as: 38: post.nu(c) = n; but 'n' is not the number of items in each class, it is the total number of data, because in lines 35-37 we have: 35: ndx = Ytrain==c; 36: X = Xtrain(ndx, :); 37: n = length(ndx); for debugging it is sufficient to change line number 35 with the following code: ndx = find(Ytrain==c); Yours: Mahmood