File format for classification using SVM light

I am trying to create a classifier using SVM light that classifies a document in one of two classes. I have already trained and tested the classifier, and the model file is saved on disk. Now I want to use this model file to classify completely new documents. What should be the input file format for this? Maybe it is a simple text file (I don’t think it will work), or it can just be a list of functions present in the text file, without any class labels and function weights (in this case I need to track the function indices in the vector -functions during training) or is it some other format?

+7
machine-learning svm svmlight
source share
2 answers

Training and test files should be of the same format, each instance has a line of the following form:

<line> .=. <target> <feature>:<value> ... <feature>:<value> # <info> <target> .=. +1 | -1 | 0 | <float> <feature> .=. <integer> | "qid" <value> .=. <float> <info> .=. <string> 

For example (copy the pasta from the SVM ^ light website):

 -1 1:0.43 3:0.12 9284:0.2 # abcdef 

For more information, you can contact

+6
source share

The file format for forecasting is the same as for testing and training, i.e.

 <line> .=. <target> <feature>:<value> ... <feature>:<value> # <info> <target> .=. +1 | -1 | 0 | <float> <feature> .=. <integer> | "qid" <value> .=. <float> <info> .=. <string> 

But for the prediction, the target is unknown, so you need to use the value 0 as the target. That is the only difference. I hope this helps someone

0
source share

All Articles