I get this error:
Warning: TRAINING can only contain
non-negative integers when
'Distribution' is set to 'mn'. Rows of
TRAINING with invalid values will be
removed.
> In NaiveBayes.fit at 317
??? Error using ==>
??? Error using ==>
NaiveBayes.fit>mnfit at 647
At least one valid observation in each
class is required.
Error in ==> NaiveBayes.fit at 496
obj = mnfit(obj,training,
gindex);
This is what I have:
training_data = Testdata;
target_class = TestDataLabels;
%# train model
nb = NaiveBayes.fit(training_data, target_class, 'Distribution', 'mn');
%# prediction
class1 = nb.predict(UnseenTestdata);
%# performance
cmat1 = confusionmat(UnseenTestDataLabels, class1);
acc1 = 100*sum(diag(cmat1))./sum(cmat1(:));
fprintf('Classifier1:\naccuracy = %.2f%%\n', acc1);
fprintf('Confusion Matrix:\n'), disp(cmat1)
The dataset is 4940201x42 if anyone is wondering.