【发布时间】:2012-11-01 08:35:14
【问题描述】:
在 matlab 中使用贝叶斯分类器时,避免过度拟合和不准确的最佳方法是什么?
我目前使用 1000 个样本作为训练数据,其中 750 个是“正常”,250 个是“异常”(一种特定类型)。
有没有人发现其中很大一部分可以训练分类器,或者每个问题都需要特定数量的训练数据。我会假设后者,但我正在努力弄清楚如何提高准确性,我可以使用什么方法。任何例子将不胜感激。
以下是我目前使用的示例:
training_data = data;
target_class = Book2(indX,:)
class = classify(test_data,training_data, target_class, 'diaglinear')
confusionmat(target_class,class)
% Display Results of Naive Bayes Classification
input = target_class;
% find the unique elements in the input
uniqueNames=unique(input)';
% use string comparison ignoring the case
occurrences=strcmpi(input(:,ones(1,length(uniqueNames))),uniqueNames(ones(length(input),1),:));
% count the occurences
counts=sum(occurrences,1);
%pretty printing
for i=1:length(counts)
disp([uniqueNames{i} ': ' num2str(counts(i))])
end
% output matching data
dataSample = fulldata(indX, :)
【问题讨论】:
-
嗯,BC 过拟合?我建议考虑选择正确的先验,BCs 的优势在于它们对过度拟合的抵抗力
-
我对您的建议是在您增加用于训练的样本百分比时绘制您的验证错误。该函数的最小值应该根据经验为您提供对开始拟合噪声点的合理准确估计
-
当您说“绘制验证错误”时,我不确定您如何在 matlab 中使用标准分类器选择先验,具体是如何完成的?
-
嗯,我现在不在我的 MATLAB 机器附近,但看看这是否有帮助 - “重载”之一允许您指定先验:mathworks.com/help/stats/classify.html
标签: matlab classification bayesian