我的数据集中,标记为负的样本数量是标记为正的样本数量的163倍,因此我有一个不平衡的数据集。我尝试了以下方法:
model = svmtrain(trainLabels, trainFeatures, '-h 0 -b 1 -s 0 -c 10 -w1 163 -w-1 1');[predicted_label, accuracy, prob_estimates] = svmpredict(testLabels, testFeatures, model, '-b 1');
准确率接近99%,我搜索后发现:http://agbs.kyb.tuebingen.mpg.de/km/bb/showthread.php?tid=376&page=1 在第7条帖子中提到
你是否尝试过使用较小的权重(即:<1)
于是我将其改为:
model = svmtrain(trainLabels, trainFeatures, '-h 0 -b 1 -s 0 -c 10 -w1 0.5 -w-1 0.003');[predicted_label, accuracy, prob_estimates] = svmpredict(testLabels, testFeatures, model, '-b 1');
但由于数据不平衡,每次的准确率仍然很高。有什么建议吗?
附注: 我正在尝试实现KDD Cup 2008的第一个挑战 – 乳腺癌。我希望按降序排列候选者。
回答:
可能是因为你的正负样本难以分离。我会通过对多数类进行下采样并使用所有少数类样本来准备不同的数据集,然后在所有数据集上学习SVM。之后使用投票方法。这对我来说是有效的。