0
votes

I am trying to use LIBSVM for classifying handwritten characters. I have successfully executed 'svm-train.exe' for training and 'svm-predict.exe' for testing. For both, the input file format is-

0 1:1 2:0 3:1 4:0
1 1:0 2:1 3:0 4:1
0 1:1 2:0 3:1 4:1
1 1:0 2:1 3:0 4:1

Now, I want to classify unlabeled data with 'svm-predict.exe'. So, now the input file will be like this-

1:1 2:0 3:1 4:0
1:0 2:1 3:0 4:1
1:1 2:0 3:1 4:1
1:0 2:1 3:0 4:1

But, when I run 'svm-predict.exe' with above input, following error is shown-

Wrong input format at line 1

It means- I cannot give unlabeled data to 'svm-predict.exe'. Then how I suppose to use it in real-world application, where I want to label unlabeled data? I have googled and also asked others but got no helpful solution.

Remarks: An advice I got was- to label test data with any random value (as I did not need the accuracy). But that did not seem logical to me. Is there any straight forward method to do it?

2
svm-predict.exe is only for "playing" around and not for real-world application. Best way would be to use the library and write some own code. - rzo1
Really !?!?! But I saw people using it! @rzo - Minhas Kamal
'svm-predict.exe' is written for evaluation purpose (target: accuracy). If you just want to predict unlabeled data, you will need to rewrite the input parser... - rzo1
Does that mean I cannot use 'svm-predict.exe' without label? @rzo - Minhas Kamal
Yes. Or you use random labels... - rzo1

2 Answers

1
votes

Simply the answer is- No, 'svm-predict.exe' cannot be used without label. The 'executable' is not designed for real world use, as rzo commented-

svm-predict.exe is only for "playing" around and not for real-world application. Best way would be to use the library and write some own code.

But, if we want to simply use it for demonstration or avoid complexity of programming, then there is no other way but to use 'random labels'.

For using LIBSVM library in a project, you may visit here-

0
votes

You need to use "svm-predict.exe" with 'test','model' and 'out' files. Let's assume your train file -> abc.train and your test file -> abc.test. When you execute "svm-train.exe abc.train" in cmd, it will create "abc.train.model" file in the current directory. In order to predict, you need to execute "svm-predict.exe abc.test abc.train.model abc.out" in cmd. Don not worry about "abc.out",it will be generated automatically. PS:In test file, you need to describe classes for lines like you do in train file. It will print result classes on abc.out and give accuracy by comparing out and test files.