Assuming your code is missing an error code (or NaiveBayes code from mathworks), and again it is assumed that your training_data data is in NxD form, where there are N observations and D functions, then columns 2, 5 and 6 are completely zero, by at least for one class. This can happen if you have relatively small training data and a large number of classes in which one class can be represented by several observations. Since NaiveBayes, by default, considers all functions as part of a regular distribution, it cannot work with a column that has zero variance for all functions associated with one class. In other words, NaiveBayes cannot find the probability distribution parameters by fitting the normal distribution to the functions of this particular class (note: the default value for the distribution is normal ).
Take a look at the nature of your possibilities. If they do not seem to correspond to the normal distribution within each class, then normal is not the option you want to use. Perhaps your data is closer to the multi-dimensional mn model:
nb = NaiveBayes.fit(training_data, target_class, 'Distribution', 'mn');
Bee
source share