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
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