Problem with the naive bayes classifier from the stats toolbox.

2 views (last 30 days)
I have a problem using the Naive Bayes classifier from the statistiques toolbox. I'm having the following error :
??? Error using ==> NaiveBayes.fit>gaussianFit at 528 For Gaussian distribution, each class must have at least two non-missing values.
Error in ==> NaiveBayes.fit at 498 obj = gaussianFit(obj, training, gindex);
Error in ==> nBayes at 53 O = NaiveBayes.fit(Xl,Cl,'dist','normal','Prior','empirical'); % build the model
Xl and Cl have the right dimensions, so I don't see from where the problem comes.

Answers (1)

the cyclist
the cyclist on 25 Feb 2013
Well, the error message is telling you that one of your classes does not have at least two non-missing values.
I suggest you type
>> dbstop if error
before running your code. Then, when you run your code, it will stop execution when it hits the error. You can then look at the values of your variables to get a hint at the problem.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!