SVM Model
SVM Model
28
International Journal of Computer Applications (0975 – 8887)
Volume 128 – No.3, October 2015
where, n n n
1
max ∑ αi − ∑ ∑ α α y y k x ,x (6 )
X i = (x i , . .. ,x id ) i= 1 2 i=1 j= 1 i j i j ( i j )
k (xi ,x j )= ⟨∅ (x i ), ∅ (x j )⟩ (4 )
∅ χ
where is an explicit mapping from input space to
Η Figure 1. Library organization in LibSVM
features of dot product of space [4]. To applied the
Kernel into SVM, generally, the equation (2) were solved by Classification Accuracy
the following equation: After training and testing phase, the accuracy is measured
n n n using the following equation:
1
max ∑ αi − ∑ ∑ α α y y x ⋅ x (5)
i= 1 2 i=1 j= 1 i j i j i j Accuracy= # correctly predicted data x 100 (7)
# total testing data
x⋅ x Short Example of LibSVM
where i j is inner product of the two samples is implicit
x LibSVM's technical tutorial can be read at README file
kernel in the equation similarity measure between i and and a paper written by [8]. This example is taken from [2],
xj they used default LibSVM dataset (heart_scale) that contain
inner product can be replaced with another kernel 270 records is divided into 170 records for training
function so that the equation (5) will be as the following (heart_scale.tr) and 100 records for testing (heart_scale.te).
equation: There are two executable files i.e svm_train to conduct
training and svm_predict to classify. In Figure 2 and 3 shows
the results of the execution of each applications.
29
International Journal of Computer Applications (0975 – 8887)
Volume 128 – No.3, October 2015
$ ./svm_train heart_scale.tr
***
optimization finished, #iter = 87
nu = 0.471645
obj = -67, 299458, rho = 0.203495
nSV = 88, nBSV = 72
Total nSV = 88
Figure 4. Relationship the third of files
Figure 2. Result of svm_train
In Figure 4, svm_train and svm_predict will call svm which
contains routines of SVM algorithm. svm_train produce a
Figure 2. Result of svm_train model that will be the input for svm_predict. In svm_train
svm_train automatically created heart_scale.tr.model file. there are several routines are analyzed and has computed i.e:
The file will used as input by svm_predict. parse_command_line
$./svm_predict heart_scale.tr heart_scale.tr.model output read_problem, svm_train (call)
Accuracy = 83% (83/100) (classification)
Figure 3. Result of svm_predict svm_check_parameter (call)
svm_save_model (call)
Figure 3. Result of svm_predict
In svm_predict i.e:
LibSVM Code Organization
svm_load_model (call)
All of SVM's (LibSVM) algorithm for training and testing
implemented by svm file (svm.cpp/svm.java). Both of svm_predict (call)
svm_train and svm_predict that has discussed earlier is an
example of user interface application. These application will Predict
call methods in svm file to perform classification task. svm_check_probability_model (call)
Therefore, this paper will discuss the complexity of codes in
the svm file. svm_predict_ probability (call)
2.4 Experimental Tools
In this experiment we used two of LibSVM's libraries i.e
C++ and Java. Both libraries were tested using a computer
with the following specifications: Intel (R) Core (TM) i5-
3230M - 2.60 GHz (4 CPU), RAM - 4 GiB, LINUX
operating system with Linux Mint KDE distro (Ubuntu Core
- 14:04 LTS - 32 bit), NetBeans 8.0.2, 1.8.0 JDK for Java
IDE and Code :: Block 13:12, GNU GCC compiler for C++.
30
International Journal of Computer Applications (0975 – 8887)
Volume 128 – No.3, October 2015
31
International Journal of Computer Applications (0975 – 8887)
Volume 128 – No.3, October 2015
n− 1
∑ (n− 1 )− i (8)
i= 0
32
International Journal of Computer Applications (0975 – 8887)
Volume 128 – No.3, October 2015
Table 6. Running Time Of Train.3 Using Java There are two scenarios of experiment that aimed to see how
the results of running-time. The first scenario uses three
Datasets Training Time (sec.) Testing Time (Sec.) datasets are: heart scale, train.3 and iris.train, where the
results of the experiment showed that the C++ is faster than
train.3 (400) 0.255 0.182
Java because it C++ is native. Testing's time is smaller than
train.3 (800) 0.428 0.339 training's time and a large data will increasing computation
time. In second scenario, experiments focus on the data
train.3 (1200) 0.657 0.485 train.3 were divided into five subsets, it is aims to look at the
train.3 (1600) 0.928 0.689 effect of running-time where the data is growing up to be
bigger.
train.3 (2000) 1.557 1.185
5. CONCLUSION
Support Vector Machines is one of machines learning using
supervised learning as knowledge training. In the
classification task, SVM is more favored than the other
methods because SVM provides a global solution for data
classification. To facilitate researchers using SVM algorithm,
Lin et al. develop LibSVM that has been widely used by
researchers and has been integrated into WEKA. This paper
contains analysis of LibSVM by doing such experiments:
compute the complexity of algorithm and implementing
using two programming language C ++ and Java.
Experimental has obtained results that the running-time using
C ++ is faster than Java because C++ is native. The results
also showed that the running-time for training and testing
with dataset train.3 is rise quadratic. Broadly speaking, the
Figure 12. Running-time graphics using C++ experimental results may indicate that the running-time of
testing is smaller than training.
33
International Journal of Computer Applications (0975 – 8887)
Volume 128 – No.3, October 2015
[7] Lee, Y, Lin, Y, G. Wahba. (2001). Multicategory [17] Zhang, D., & Lee, W. S. (2003). Question classification
support vector machines. Comput. Sci. Stat. 33, pp. using support vector machines. In Proceedings of the
498–512. 26th annual international ACM SIGIR conference on
Research and development in informaion retrieval (pp.
[8] Lin, C. J., Hsu, C. W., & Chang, C. C. (2003 – Last 26-32). ACM.
updated: April 15, 2010). A practical guide to support
vector classification. National Taiwan U., www. csie. [18] Zhu, G., Huang, D., Zhang, P., & Ban, W. (2015). ε-
ntu. edu. tw/cjlin/papers/guide/guide. Pdf. Proximal support vector machine for binary
classification and its application in vehicle recognition.
[9] Nemmour, H, Chibani, Y. (2006). Multi-class SVMs Neurocomputing, 161, 260-266.
based on fuzzy integral mixture for handwritten digit
IJCATM : www.ijcaonline.org 34