Grid Search SVM

The Grid Search SVM is a Java-based application that allows to perform the grid search of an SVM classifier. According to the section 3.2 of (Hsu, Chang and Lin: A Practical Guide to Support Vector Classication) [1], the grid search consists in identifying the best (C, γ) values that allow to classify accurately the unknown data ( new instances as the test data).
In the same work they suggest a practical method to perform the grid search that consists in the exponentially growing of C and γ. They also gives the range the values for those parameters. For example C = [2-5, …, 215] and γ = [2-15, …, 23] (see also here).
The software here presented uses the LIBSVM to implement an SVM classifier and Weka classes as interface to classifiers and dataset. This software as it is said before, will take a particular classifier and will try to train and test on different values of C and γ. All the performances obtained will be stored inside a text file given as output file.

Project description

Github repository: https://github.com/angelosalatino/GridSearchSVM
Platform: every platform that has a JVM installed
License: LGPL
Current version: 1.0
Issue tracker: Here

Key features

  • Performs a Grid Search witk SVM
  • Tuning of the SVM classifier parameters
  • Iterative reduction of the features number
  • Cross-Validation

Dependencies to build the project

Java Virtual Machine – here
libsvm.jar – here
weka.jar – here

Ready to use builds

Inside the GitHub repository associated to this project, there is a folder named “dist”, in which there are the builds, ready to be launched with the following command on terminal.

java -jar "GridSearchSVM.jar"

However it is important, for the correct execution of the software, that at the same path of GridSearchSVM.jar there is a folder named “lib” containing libsvm.jar and weka.jar. Otherwise it will not work.

Graphical User Interfaces

When the application is launched, a GUI like the below one will pop up. This GUI is formed mainly of some setting to perform the grid search.

On the top of the GUI there is a input file options. When the file has been located, some information like number of instances and the number of attributes will be showed. At the end will be asked which attribute number is the class attribute (the last one as setted as default).

In the middle section there are plenty options to tune the SVM classifier like SVM Type, degree, eps, nu and so on. The values shown on the image below, are the default values. The most crucial values are the cost step and the gamma step because they are the key of grid search. What do these things in Grid Search mean? These two numbers determine the step of the exponent to use during the iterative process of the grid search. As an example if gammaStep is equal to 2. The grid search will start with gamma equal to 2^-15 and at the next step it will take the value of 2^-13, 2^-11 and so on. The question marks close to these two value are help window activator.

Close to the bottom there are two sections, the first one is useful to choose the number of folds of the cross validation process. There is, also a features reduction to test the grid search recursively reducing the number of the attributes. This operation makes sense when the dataset is ordered after a ranking operation and it could be useful to find the best value of Cost and Gamma for the classifier at a certain value of features number.

In the bottom there is a run button that execute the grid search and a progress bar that shows the status of the running process.

 

GUI of the application
GUI of the application
 

Technical information

In this version, the application can read .arff format file as input file, just because it uses a Weka wrapper. It also uses another weka wrapper to call the SVM library implementing the classifier.

The output file collects all the performances as shown below.

Sample of the output file
Sample of the output file

Thanks

I want to thank with whoever wants to use this application, give suggestions, make it bigger and better.

Bibliography

[1] Chih-Wei Hsu, Chih-Chung Chang, and Chih-Jen Lin, “A Practical Guide to Support Vector Classi cation” 2010.

Link to the paper: http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf