This article deals with on how to use LIBSVM and test the accuracy of the classifier. Libsvm is a tool to
30 rows Introduction. LIBSVM is an integrated software for support vector classification, (C-SVC, nu-SVC), regression (epsilon-SVR, nu-SVR) and distribution estimation (one-class SVM).It supports multi-class classification. Since version 2.8, it implements an SMO-type algorithm proposed in this paper: R.-E. Chen, and C.-J. Working set selection using second order information for.
LIBSVM is an integrated software for support vector classification, (C-SVC, nu-SVC), regression (epsilon-SVR, nu-SVR) and distribution estimation (one-class SVM).It supports multi-class classification. Since version 2.8, it implements an SMO-type algorithm proposed in this paper: R.-E. Chen, and C.-J. Working set selection using second order information for.
Libsvm free download. CUDA-JMI CUDA-JMI is a parallel tool to accelerate the feature selection process using Joint Mutual Informati.
incorporate the concept of SVM in your project. I'll be posting other tutorials/progarms using LibSVM here. SVM's are used for classifying data in 1 or multiple dimensions into 2 or more classes. All they do is try to clearly separate two classes from each other in clustering. labelled training data-------->SVM------->trained SVM unlabelled/labeled testing data--------->trained SVM--------->predicted labels They work on labelled data (for unlabelled data, you will need a ground truth to establish the accuracy of the SVM). I would actually recommend you to read LIBSVM documentation completely (as it is less than 16 pages). After reading that you can get some insight into what libsvm is about and how you can use it in your project. Basically a SVM takes in a set of feature vectors (value in multiple dimensions) while training and outputs the labels in testing phase (and given labelled test data, we can measure the accuracy on how to better differentiate the classes). If we were to differentiate a square from a rectangle. We have 2 dimension feature vector i.e. length, width. The following logic defines our feature vector and thus our SVM. If length = width its a square else its a rectangle. If this is the logic we want to cluster using the SVM, we would have to give the have data in following format: 1 1:2 2:2 1 1:3 2:3 1 1:4 2:4 1 1:5 2:5 -1 1:2 2:3 -1 1:1 2:2 -1 1:2 2:4 -1 1:3 2:1 ..... ..... .... I guess you must have figured out what 1 and -1 meant. In above data 1st column deals with the label (i.e square or rectangle. Square=1 and Rectangle=-1). The 2nd and 3rd column deals with length and width. 1: and 2: tell libsvm that they are 1st and 2nd dimension of data respectively. You can have the above data in different ways. If you were have series of images as input. Depending on size and colorspace, you will have different input feature vector for each image. If you have 640 x 480 length black and white image as input (grayscale colorspace). You will have data of 307200 dimensions (each dimension with a range 0 to 255 in grayscale). It would look something as follows: 1 1:255 2: 233 3:0 4:44 ........307719: 233 -1 1:55 2: 3 3:20 4:240 ........307719: 233 1 1:155 2: 123 3:50 4:42 ........307719: 233 Here 1 and -1 represents the class label (defined according to you). Each row represents an image. Now lets download libsvm and get started. I would also suggest you to install python.
If you are on Linux, click here to download the tar ball. Then give the command tar xvzf<libsvmsource.tar.gz> , where <libsvmsource.tar.gz> is the tar ball that you downloaded. It would be unzipped into a folder. Also install GNUPLOT ( $sudo apt-get install gnuplot ) on your system.
If you are on Windows, click here to download the zip file and unzip the folder. The svm-predict, svm-train executables will be in the root_folderwindows . Also install GNUPLOT
Now as we have downloaded and installed LIBSVM, lets try to do a simple classification in LIBSVM. Download the testing data and training data and put them in a folder. In the downloaded data, newtraining.txt represents the training data and newtesting.txt represents the testing data. Copy the svm-predict, svm-train, easy.py, grid.py from the folder where you installed libsvm to a folder where you have testing and training data saved. Now you can do this in 2 ways: 1) Manually: Go to command prompt / Shell Terminal and give the following command: $svm-train <training_data> where <training_data> is the text file which contains the training data Executing above command will output on how much accurate the training was. Then issue the following command: $svm-predict <testing_data> <training_data.model> outputlabels.txt where <testing_data> is the text file which contains the testing data, <training_data.model> is a text file that was generated from previous step (svm-train <training_data>), outputlabels.txt is a text file that stores the respective output labels for the input feature vectors in <testing_data> file.
Libsvm Free Download Windows
Executing above command will show the accuracy of the generated model (by libsvm).
If you observe the above procedure yeilds a accuracy of 51.85%. This is considered to be low for a SVM. This is so because we need to scale paramaters, select best SVM kernel type for the given input data. In order to do so, we use the automatic way of using LIBSVM. Jump to the next part. 2) Automatically: I assume that you have installed python and GNUPLOT. Edit the easy.py program using IDLE python editor or any other text editor by going to the line where it says the following:
Libsvm Download Windows 8
svmscale_exe = ..... svmtrain_exe = ..... svmpredict_exe = ....... grid_py = ...... gnuplot_exe = ..... Basically its the code which is pointing to svmtrain, svmpredict, etc executables. Edit the above to point to the svmtrain, svmpredict, etc executables. If the above part is done,you just issue the command: $python easy.py <training_data> <testing_data> Here <training_data> and <testing_data> refers to the training and testing files. The above command automatically scales the data (you should know what scaling is if you've read libsvm documentation). The above command automatically scales data, does cross-validation, selects optimal kernel for the SVM automatically without you having worry about the training and testing parameters to generate a reliable SVM.
Download Libsvm For Windows 7
The output on the terminal/command prompt shows the accuracy of the SVM. Also in the present folder are the files which have output labels of predicted data. Using the automatic way, we get an accuracy of 74%. The automatic way is the best way to use LIBSVM as it does cross validation, selects best svm kernel type, scales the test and training data.