Can anyone give me an example of how I can start with support vector machine in MATLAB?

추가 답변 (1개)

Nirmal
Nirmal 2012년 6월 4일

0 개 추천

댓글 수: 12

Walter Roberson
Walter Roberson 2012년 6월 4일
Nirmal, in your example, your line
if Group(i,1)==1
should probably be
if Group1(i,1)==1
otherwise you are testing Group(i,1) which you set to all 0 just a few lines above.
Nirmal
Nirmal 2012년 6월 5일
GroupF=zeros(90,1);
I am setting GroupF to zero not Group. (I know, my naming convention is not the greatest) but it does work.
Walter Roberson
Walter Roberson 2012년 6월 5일
You are right, I did misread the code.
Ilya
Ilya 2012년 6월 5일
There seems to be an error in your code.
if Group1(i,1)==2
GroupF(i,1)=2;
else
GroupF(i,1)=3;
end
should be
if Group1(i,1)==1
GroupF(i,1)=2;
else
GroupF(i,1)=3;
end
Even if there is no error, there is a problem with this approach. You treat the classes asymmetrically. You separate 1 from 2 and 3 and then separate 3 from 1 and 2. Then you assign a new observation to class 2 if it is neither class 1 nor class 3. There are two problems here:
1. The lack of symmetry implies that the classification scheme is sensitive to the order of the classes. In your case, class 2 can work as a sink for all observations that are neither clearly class 1 nor class 3.
2. It is not clear how this extends to more than 3 classes.
Nirmal
Nirmal 2012년 6월 5일
1. IRIS dataset has only three classes, so I dont see problem with the code with class 2 acting as a sink. ( I am not sure why I need to be worried about the symmetry though.)
2. If I need to extend it to lets say 4 classes, I need to separate first 1 then 2 followed by 3 and finally 4. It would require me to use SVM 3 times. Again I could also do it by starting with 4,3,2 and finally 1 acting as a sink. It just the matter of separating 2 classes each time, where one of the class is the class we are trying to separate and another classes contains the rest of it. (Is that not right?)
Ilya
Ilya 2012년 6월 5일
In this scheme, you can end up assigning all uncertain observations to the sink class. The confusion matrix can be heavily skewed in favor of that class. The choice of the sink class is determined by an arbitrary order of the classes in the data (because there is no symmetry). I would be reluctant to use any classifier in which one class gets a heavy load of predictions for no reason other than being arbitrarily chosen as a sink. It is a problem no matter how many classes you have - 3, 4 etc.
Nirmal
Nirmal 2012년 6월 5일
I understand what you are saying but there is no uncertain items in IRIS data set. Out of 150 Items, 1-50 are setosa, 51-100 are versicolor and 101-150 are virginica.
Ilya
Ilya 2012년 6월 5일
Fisher iris is one of the easiest datasets around. Pretty much any classifier can separate the groups. It would be easy to come up with a multiclass example in which your scheme fails miserably but a standard approach such as, for instance, one-vs-one succeeds.
Mythili Sukumaran
Mythili Sukumaran 2012년 11월 28일
Nirmal,thanks for the code.
LOKESH
LOKESH 2015년 11월 30일
편집: LOKESH 2015년 11월 30일
Error: ??? Reference to non-existent field 'GroupNames'.
Error in ==> svmclassify at 90 groupnames = svmStruct.GroupNames;
Error in ==> svm at 16 Group = svmclassify(SVMStruct,testset);
Walter Roberson
Walter Roberson 2015년 11월 30일
LOKESH, which MATLAB version are you using, and where is your svm from? (There are few different SVM around.)
REMYA K
REMYA K 2020년 11월 17일
This site is not available..what to do

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

질문:

2012년 6월 4일

댓글:

2020년 11월 17일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by