I tested on different data size and record the time spent (in second).Ĭomputer: Processor: 2×2.66G, memory: 12G, OS: Windows XP installed in VMWare in Mac OS 10. = svmpredict(zeros(size(dd,1),1), dd, model) LibSVM MATLAB and Octave interfaces Here you can find MATLAB and Octave interfaces of the LibSVM library written by Chih-Jen Li. If you have new data, you may use this model to classify the new data. After finding the optimal parameter values, use all data to train your model with your optimal parameter values.For example, you might want to start from a bigger range with coarse resolution then fine tune to smaller regions with higher resolution. You may have to run the above code several times with different range of parameter values to find the optimal values.A piece of code from libsvm website is:Ĭmd = Ĭv = svmtrain(heart_scale_label, heart_scale_inst, cmd) īestcv = cv bestc = 2^log2c bestg = 2^log2g įprintf('%g %g %g (best c=%g, g=%g, rate=%g)\n', log2c, log2g, cv, bestc, bestg, bestcv) The option -c, -g, and -v controls parameter C, gamma and n-fold cross validation. For example, a 5-fold cross validation is to use 4/5 of the data to train the svm model and the rest 1/5 to test. To avoid over fitting, you use n-fold cross validation. Different parameter values will yield different accuracy rate. For commonly used radial kernel, you have two parameters (C and gamma). For linear kernel, you have 1 parameter C (penalize parameter). You can use the following code to normalize (from libsvm webpage): This including normalization (make all values between 0 and 1) and transform non-numeric values to numeric. Nonlinear example (radial basis) Nonlinear, circle Nonlinear, two circles Nonlinear, quadrant Linear kernel example (support vectors are in circles): Linear load heartscale Result: Error using load Number of columns on line 3 of ASCII file heartscale must be the same as previous lines. 312 heartbeat segmentation, 312, 313 LIBSVM library, 313314 Matlab SVM. I am learning svm lately and tried libsvm. digital Basic Uses of Libsvm in Matlab System: Ubuntu with gcc installed Libsvm Installation 1 2 3 cd libsvm-3.2/matlab mex -setup make Just for Test Load data 1 2 cd. 80 Medium access control (MAC) layer, 137138 Membership function (MF). Xu Cui Follow SVM (support vector machine) with libsvm
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |