SVM分类-每个类别的最小输入集数 [英] SVM Classification - minimum number of input sets for each class
问题描述
我正在尝试构建一个应用程序来检测图像,这些图像是来自网页的广告.一旦检测到这些内容,我将不允许它们在客户端显示.
I'm trying to build an app to detect images which are advertisements from the webpages. Once I detect those I`ll not be allowing those to be displayed on the client side.
在我对这个Stackoverflow问题的帮助下,我认为支持向量机是实现我目标的最佳方法.
From the help that I got on this Stackoverflow question, I thought SVM is the best approach to my aim.
因此,我已经为SVM和SMO编写了代码.我从UCI数据存储库中获得的数据集具有3280个实例(链接到数据集),其中大约有400种来自代表广告图像的类,其余代表非广告图像.
So, I have coded SVM and an SMO myself. The dataset which I have got from UCI data repository has 3280 instances ( Link to Dataset ) where around 400 of them are from class representing Advertisement images and rest of them representing non-advertisement images.
现在,我正在使用第一个2800个输入集并训练SVM.但是,在查看了准确率之后,我意识到这2800个输入集中的大多数来自非广告图像类.因此,我对该课程有很好的准确性.
Right now I'm taking the first 2800 input sets and training the SVM. But after looking at the accuracy rate I realised that most of those 2800 input sets are from non-advertisement image class. So I`m getting very good accuracy for that class.
那我该怎么办?我应该给SVM训练多少输入集,每个班级有多少输入集?
So what can I do here? About how many input set shall I give to SVM to train and how many of them for each class?
谢谢.干杯. (基本上提出了一个新问题,因为上下文与我之前的问题有所不同.神经网络的优化输入数据)
Thanks. Cheers. ( Basically made a new question because the context was different from my previous question. Optimization of Neural Network input data )
感谢您的回复. 我想检查是否正确推导广告类和非广告类的C值. 请给我反馈.
Thanks for the reply. I want to check whether I`m deriving the C values for ad and non-ad class correctly or not. Please give me feedback on this.
或者您可以在此处看到文档版本.
Or you u can see the doc version here.
您可以在此处看到y1等于y2的图表
You can see graph of y1 eqaul to y2 here
,此处的y1不等于y2
and y1 not equal to y2 here
推荐答案
有两种解决方法.一种方法是平衡训练数据,使其包含相等数量的广告和非广告图像.这可以通过对400个广告图像进行过采样或对数千个非广告图像进行欠采样来完成.由于训练时间会随着使用的数据点数量而急剧增加,因此您可能应该首先尝试对非广告图像进行欠采样,然后使用400个广告图像和400个随机选择的非广告创建训练集.
There are two ways of going about this. One would be to balance the training data so it includes an equal number of advertisement and non-advertisement images. This could be done by either oversampling the 400 advertisement images or undersampling the thousands of non-advertisement images. Since training time can increase dramatically with the number of data points used, you should probably first try undersampling the non-advertisement images and create a training set with the 400 ad images and 400 randomly selected non-advertisements.
另一种解决方案是使用加权SVM ,以使广告图像的边距误差比非广告的边距误差具有更大的权重,对于libSVM软件包,这是通过
The other solution would be to use a weighted SVM so that margin errors for the ad images are weighted more heavily than those for non-ads, for the package libSVM this is done with the -wi
flag. From your description of the data, you could try weighing the ad images about 7 times more heavily than the non-ads.
这篇关于SVM分类-每个类别的最小输入集数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!