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

Plus de réponses (1)

Nirmal
Nirmal le 4 Juin 2012

0 votes

12 commentaires

Walter Roberson
Walter Roberson le 4 Juin 2012
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 le 5 Juin 2012
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 le 5 Juin 2012
You are right, I did misread the code.
Ilya
Ilya le 5 Juin 2012
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 le 5 Juin 2012
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 le 5 Juin 2012
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 le 5 Juin 2012
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 le 5 Juin 2012
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 le 28 Nov 2012
Nirmal,thanks for the code.
LOKESH
LOKESH le 30 Nov 2015
Modifié(e) : LOKESH le 30 Nov 2015
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 le 30 Nov 2015
LOKESH, which MATLAB version are you using, and where is your svm from? (There are few different SVM around.)
REMYA K
REMYA K le 17 Nov 2020
This site is not available..what to do

Connectez-vous pour commenter.

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by