Chih-Chung Chang and Chih-Jen Lin, LIBSVM : a library for support vector machines, 2001. Software available at http://www.csie.ntu.edu.tw/~cjlin/libsvm
The bibformat is as follows
@Manual{CC01a, author = {Chih-Chung Chang and Chih-Jen Lin}, title = {{LIBSVM}: a library for support vector machines}, year = {2001}, note = {Software available at {\tt http://www.csie.ntu.edu.tw/\verb"~"cjlin/libsvm}}, }
1 0 2 0is represented as
1:1 3:2
svm-train -s 0 -c 10 -w1 1 -w-1 5 data_file
the penalty for class "-1" is larger.
printf("%f ", sum);after the line
sum -= model->rho[p++];of the file svm.cpp
In our program we have malloc() which uses two methods to allocate memory from kernel. One is sbrk() and another is mmap(). sbrk is faster, but mmap has a larger address space. So malloc uses mmap only if the wanted memory size is larger than some threshold (default 128k). In the case where each row is not large enough (#elements < 128k/sizeof(float)) but we need a large cache , the address space for sbrk can be exhausted. The solution is to lower the threshold to force malloc to use mmap and increase the maximum number of chunks to allocate with mmap.
Therefore, in the main program (i.e. svm-train.c) you want to have
#include <malloc.h>and then in main():
mallopt(M_MMAP_THRESHOLD, 32768); mallopt(M_MMAP_MAX,1000000);You can also set the environment variables instead of writing thems in the program:
$ M_MMAP_MAX=1000000 M_MMAP_THRESHOLD=32768 ./svm-train .....More information can be found by
$ info libc "Malloc Tunable Parameters"
#if 1 void info(char *fmt,...)to
#if 0 void info(char *fmt,...)
java -Xmx256m svm_train.java ...sets the maximum heap size to 256M.