我收到此错误:
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);
这就是我所拥有的:
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)
如果有人想知道,数据集是 4940201x42。