2
votes

So I'm trying to implement a multi-class SVM.

Matlab didn't like having more than two classes to classify data into, so I'm using a Binary Decision Tree to classify data.

I have three classes and am splitting the data into two and one, I'll then classify the first results using a SVM and then classify the results of this to the one unclassified class.

However, when using LIBSVM, I'm getting an error when using svmpredict:

td= a{1,1}; 
tc = b{1,1}; 

td1 = a{1,2}; %data to test svm
testdatatest = td1(1:30,1:4); %data to test svm

data = td(1:80, 1:4); %split data
target = tc(1:80);  %split data

model = svmtrain(data, target); %train

[predicted_label, accuracy, decision_values]=svmpredict(testdatatest,target, model); 

The error I get is:

Undefined function 'svmpredict' for input arguments of type 'struct'.

Any suggestions would be great, thanks.

1
svmpredict is in your path? fix your naming to make your code readable. this will help you avoiding errors e.g. mixing up training and test data. also do good comments or none but avoid meaningless repetition of what the code says.stefan

1 Answers

0
votes

you must download and make libsvm, open the zip file and select your langauges like Matlab etc. then make it! it would give you two files, now you are using Matlab SVM not libsvm.

good luck