Username Remember Me?
Password   forgot password?
   
   
Index out of bounds in sdsvc
Posted: 31 January 2012 10:25 PM   [ Ignore ]  
Newbie
Rank
Total Posts:  8
Joined  2012-01-13

Hi,
training sdsvc with default settings on a particular dataset I obtain as follows:

??? Error using ==> ind2code at 8
Index out of bounds
.

Error in ==> ..\perClass_Demo\perclass\@sddata\subset.p>subset at 73


Error in 
==> ..\perClass_Demo\perclass\@sddata\subsref.p>subsref at 31


Error in 
==> ..\perClass_Demo\perclass\sdsvc.p>sdsvc at 210


Error in 
==> ..\perClass_Demo\perclass\@sdppl\apply_untrained.p>apply_untrained at 150


Error in 
==> ..\perClass_Demo\perclass\@sdppl\mtimes.p>mtimes at 72


Error in 
==> par_classify_BR at 20
    trainedSvc
=trainngData*untrainedSvc;

Could you please help with the problem?

Thanks in advance.
Tomasz

Profile
 
 
Posted: 01 February 2012 09:02 AM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  240
Joined  2008-04-26

Dear Tomasz,

could you, please, check that your training data set contains two classes? The error is related to extracting second class from the set.

With Kind Regards,

Pavel

Profile
 
 
Posted: 02 February 2012 06:05 PM   [ Ignore ]   [ # 2 ]  
Newbie
Rank
Total Posts:  8
Joined  2012-01-13

The problem appears in multiclass classification.

The histogram of classes:
1 78
2 123
3 81
4 2
5 95
6 6
7 6

one-against-all
['1' ....................sigma=141.13526 C=0.001 err=0.500 SVs=157] 
[
'2' ....................sigma=169.04664 C=0.695 err=0.140 SVs=230] 
[
'3' ....................sigma=45.64488 C=12.7 err=0.129 SVs=217] 
[
'4' ??? Error using ==> ind2code at 8

Therefore it might be caused by to small number of instances with class 4.
What is the minimal number of instances required in sdsvc?

Profile
 
 
Posted: 02 February 2012 07:28 PM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  240
Joined  2008-04-26

Hi Tomasz,

by default, sdsvc splits the provided data and uses 75% for training and 25% for the validation set. So, you can use as little as 4 samples per class:

>> b
'Fruit set' 200 by 2 sddata2 classes'apple'(100'banana'(100

>> 
c=randsubset(b,4)
'Fruit set' 8 by 2 sddata2 classes'apple'(4'banana'(4
>> 
p=sdsvc(c)
....................
sigma=1.65694 C=2.98 err=0.000 SVs=5
sequential pipeline     2x1 
'standardization+Support Vector Machine (RBF)'
 
1  standardization         2x2  (sdp_affine)
 
2  Support Vector Machine (RBF)    2x1  (sdp_svc)

but not less:

>> c=randsubset(b,3)
'Fruit set' 6 by 2 sddata2 classes'apple'(3'banana'(3
>> 
p=sdsvc(c)
{??? Index exceeds matrix dimensions.

You may, of course use the training set also for error estimation (no splitting is done inside). But then you fit nicely training data and may not generalize well to unseen data. However, if this data is all what you have you may probably not estimate generalization performance well anyway (two samples per class is really little :-)

>> c=randsubset(b,1)
'Fruit set' 2 by 2 sddata2 classes'apple'(1'banana'(1
>> 
p=sdsvc(c,'test',c)
....................
sigma=0.21053 C=0.001 err=0.000 SVs=2
sequential pipeline     2x1 
'standardization+Support Vector Machine (RBF)'
 
1  standardization         2x2  (sdp_affine)
 
2  Support Vector Machine (RBF)    2x1  (sdp_svc)

I’d suggest to also test some very simple classifier such as nearest mean (sdnmean) to see if your SVM is not overtrained.
Check if you really need to handle the small classes together with others - maybe they are separable. If so, you could extract them with a simple classifier and build multi-class SVM only for the rest of the problem. You can put together a cascaded classifier with sdcascade.

Hope it helps,

Pavel

Profile
 
 
Posted: 02 February 2012 07:31 PM   [ Ignore ]   [ # 4 ]  
Newbie
Rank
Total Posts:  8
Joined  2012-01-13

Thank you Pavel for help.

Cheers,
Tomasz

Profile
 
 
   
 
 
‹‹ bug in fixedcc.m      error using getfeatlab ››