Cheshie
Cheshie

Reputation: 2837

LIBSVM in MATLAB/Octave - what's the output of libsvmread?

The second output of the libsvmread command is a set of features for each given training example.

For example, in the following MATLAB command:

[heart_scale_label, heart_scale_inst] = libsvmread('../heart_scale');

This second variable (heart_scale_inst) holds content in a form that I don't understand, for example:

<1, 1> -> 0.70833

What is the meaning of it? How is it to be used (I can't plot it, the way it is)?

PS. If anyone could please recommend a good LIBSVM tutorial, I'd appreciate it. I haven't found anything useful and the README file isn't very clear... Thanks.

Upvotes: 4

Views: 4534

Answers (2)

carlosdc
carlosdc

Reputation: 12152

The definitive tutorial for LIBSVM for beginners is called: A Practical Guide to SVM Classification it is available from the site of the authors of LIBSVM.

The second parameter returned is called the instance matrix. It is a matrix, let call it M, M(1,:) are the features of data point 1 and so on. The matrix is sparse that is why it prints out weirdly. If you want to see it fully print full(M).

[heart_scale_label, heart_scale_inst] = libsvmread('../heart_scale');

with heart_scale_label and heart_scale_inst you should be able to train an SVM by issuing:

mod = svmtrain(heart_scale_label,heart_scale_inst,'-c 1 -t 0');

I strong suggest you read the above linked guide to learn how to set the c parameter (and possibly, in case of RBF kernel the gamma parameter), but the above line is how you would train with that data.

Upvotes: 8

Mohit Jain
Mohit Jain

Reputation: 863

I think it is the probability with which test case has been predicted to heart_scale label category

Upvotes: -1

Related Questions