⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 faq.html

📁 目前准确度最好的支持向量机分类算法,用C++编写.
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><html>  <head>    <title>libsvm faq</title>  </head><body text="#000000" bgcolor="#FFEFD5" link="#FF0000" vlink="#0000FF">  <body>    <h1><a href=index.html>LIBSVM</a> FAQ</h1><!-- Created: Wed Apr 18 19:26:54 CST 2001 --><!-- hhmts start -->Last modified: Wed Jul 24 00:08:51 CST 2002<!-- hhmts end --><hr><h3>Some courses which have used libsvm as a tool</h3><ul><li><a href=http://lmb.informatik.uni-freiburg.de/lectures/svm_seminar/>Institute for Computer Science,           Faculty of Applied Science, University of Freiburg, Germany </a><li> <a href=http://www.cs.vu.nl/~elena/ml.html>Division of Mathematics and Computer Science. Faculteit der Exacte Wetenschappen Vrije Universiteit, The Netherlands. </a><li><a href=http://progwww.vub.ac.be/poolteaching/proj1lic/svm.htm>Department of (Applied) Computer Science (Faculty of Sciences), Vrije Universiteit Brussel,  Belgium</a><li><a href=http://www.cae.wisc.edu/~ece539/matlab/>Electrical and Computer Engineering Department, University of Wisconsin-Madison </a><li><a href=http://www.hpl.hp.com/personal/Carl_Staelin/cs236601/project.html>Technion (Israel Institute of Technology), Israel.<li><a href=http://www.cise.ufl.edu/~fu/learn.html>Computer and Information Sciences Dept., University of Florida</a><li><a href=http://www.uonbi.ac.ke/acad_depts/ics/course_material/machine_learning/ML_and_DM_Resources.html>The Institue of Computer Science,University of Nairobi, Kenya.</a></ul><hr><h3>Installation and and running the program</h3><ul><p><li> Where can I find documents of libsvm ? <br>In the package there is a README file which details all options, data format, and library calls.The paper <a href="http://www.csie.ntu.edu.tw/~cjlin/papers/libsvm.pdf">LIBSVM: a library for support vector machines</a> discusses the implementation oflibsvm in detail.<p><li> What are changes in previous versions? <br>See <a href="http://www.csie.ntu.edu.tw/~cjlin/libsvm/log">the change log</a>.<p><li> I have modified the source and would like to build the graphic interface "svm-toy"on MS windows. How should I do it ?<br>Build it as a project by chooising "Win32 Application."On the other hand, for "svm-train" and "svm-predict"you want to choose "Win32 Console Application."<p><li> I would like to cite libsvm. Which paper shouldI cite ?<br>Please cite the following document:<p>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<p>The bibformat is as follows<pre>@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}},}</pre></ul><hr><h3>Data preparation</h3><ul><p><li>Why sometimes not all attributes of a data appear in the training/model files ?<br>libsvm uses the so called "sparse" format where zerovalues do not need to be stored. Hence a data with attributes<pre>1 0 2 0</pre>is represented as<pre>1:1 3:2</pre><p><li>What if my data are non-numerical ?<br>Currently libsvm supports only numerical data.You may have to change non-numerical data to numerical. For example, you can use severalbinary attributes to represent a categoricalattribute.</ul><hr><h3>Training and prediction</h3><ul><p><li> Should I use float or double to store numbers in the cache ?<br>We have float as the default as you can store more numbersin the cache. In general this is good enough but for few difficultcases (e.g. C very very large) where solutions are hugenumbers, it might be possible that the numerical precision is notenough using only float.<p><li> Does libsvm have special treatmentsfor linear SVM ?<br>No, at this point libsvm solves linear/nonlinear SVMs by thesame way.Note that there are some possibletricks to save training/testing time if thelinear kernel is used.Hence libsvm is NOT particularly efficient for linear SVM,especially for problems whose number of data is much largerthan number of attributes.If you plan to solve this type of problems, you may want to check some software which are specially suitable for linear SVMs.<p><li>The number of free support vectors is large. What should I do ? <br>This usually happens when the data are overfitted.If attributes of your data are in large ranges,try to scale them. Then the regionof appropriate parameters may be larger.Note that there is a scale programin libsvm. <p><li>The prediction rate is low. How could I improve it ?<br>Try to use cross validation option -v and findout good parameters.<p><li>My data are unbalanced. Could libsvm handle such problems ?<br>Yes, there is a -wi options. For example, if you use<p> svm-train -s 0 -c 10 -w1 1 -w-1 5 data_file<p>the penalty for class "-1" is larger.<p><li>What is the difference between nu-SVC and C-SVC ?<br>Basically they are the same thing but with differentparameters. The range of C is from zero to infinitybut nu is always between [0,1]. A nice propertyof nu is that it is related to the ratio of support vectors and the ratio of the trainingerror.<p><li>The program keeps running without showingany output. What should I do ?<br>You may want to check your data. Each training/testingdata must be in one line. It cannot be separated.In addition, you have to remove empty lines.<p><li>The program keeps running (with output, i.e. many dots).What should I do ?<br>In theory libsvm guarantees to converge if the kernelmatrix is positive semidefinite. Hence, this may meanthat you are using the signomidal kernel wherefor some parameters the kernel matrix is not PSD.<p><li>The training time is too long. What should I do ?<br>This may happen for some difficult cases (e.g. -c is large).You can try to use a looser stopping tolerance with -e.If that still doesn't work, you may want to contact us. We can show you sometricks on improving the training time.<p><li>I want to know the value of the decision function. How do I get it ?<br>We print out decision values for regression. For classification,as we have to solve several binary SVMs for multi-class cases,we do not print out them. However, you can easily modify the program for printing them.Just add <pre>       printf("%f ", sum);</pre>after the line<pre>       sum -= model->rho[p++];</pre>of the file svm.cpp<p><li>For some problem sets if I use a large cache (i.e. large -m) on a linux machine, why sometimesI get "segmentation fault ?"<br>This may happen only  when the cache is large, but each cached row isnot large enough. <b>Note:</b> This problem is specific to gnu C library which is used in linux.The solution is as follows:<p>In our program we have malloc() which uses two methods to allocate memory from kernel. One issbrk() and another is mmap(). sbrk is faster, but mmap has a larger addressspace. So malloc uses mmap only if the wanted memory size is largerthan 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 tolower the threshold to force malloc to use mmapand increase the maximum number of chunks to allocatewith mmap.<p>Therefore, in the main program (i.e. svm-train.c) you wantto have<pre>      #include &lt;malloc.h&gt;</pre>and then in main():<pre>      mallopt(M_MMAP_THRESHOLD, 32768);      mallopt(M_MMAP_MAX,1000000);</pre>You can also set the environment variables insteadof writing thems in the program:<pre>$ M_MMAP_MAX=1000000 M_MMAP_THRESHOLD=32768 ./svm-train .....</pre>More information can be found by <pre>$ info libc "Malloc Tunable Parameters"</pre><p><li>Now for different classes I can assign weights. What if I want to give weights to different data ?<br>Please contact us so we can give you our preliminarycode.<p><li>How do I disable screen output of svm-train and svm-predict ?<br>Simply update svm.cpp:<pre>#if 1void info(char *fmt,...)</pre>to<pre>#if 0void info(char *fmt,...)</pre><p><li>I would like to use my own kernel but find out thatthere are two subtourines for kernel evaluations: k_function() and kernel_function(). Which oneshould I modify ?<br>The reason why we have two functions is as follows:For the RBF kernel exp(-g |xi - xj|^2), if we calculatexi - xj first and then the norm square, there are 3n operations.Thus we consider exp(-g (|xi|^2 - 2dot(xi,xj) +|xj|^2))and by calculating all |xi|^2 in the beginning, the number of operations is reduced to 2n.This is for the training.  For prediction we cannotdo this so a regular subrouting using that 3n operations isneeded.The easiest way to have your own kernel isto  put the same code in these twosubourines by replacing any kernel.<p><li>What method does libsvm use for mulsit-class SVM ?<br>It is one-against-one. We chose it after doing the followingcomparison:C.-W. Hsu and C.-J. Lin.<A HREF="http://www.csie.ntu.edu.tw/~cjlin/papers/multisvm.ps.gz">A comparison of methods for multi-class support vector machines</A>, <I>IEEE Transactions on Neural Networks</A></I>, 13(2002), 415-425.</ul><hr><h3>Graphic Interface</h3><ul><p><li>How can I save images drawn by svm-toy? <br>For Microsoft windows, first press the "print screen" key on the keyboard.Open "Microsoft Paint" (included in Windows) and press "ctrl-v." Then you can clipthe part of picture which you want.For X windows, you can use the program "xv" to grab the picture of the svm-toy window.<p><li>I press the "load" button to load data points but whysvm-toy does not draw them ?<br>The program svm-toy assumes both attributes (i.e. x-axis and y-axisvalues) are in (0,1). Hence you want to scale your data to between a small positive number and a number less than but very close to 1.</ul><hr><h3>Java version of libsvm</h3><ul><p><li>What is the difference between Java version and C++version of libsvm ?<br>They are the same thing. We just rewrote the C++ codein Java.<p><li>Is the Java version significantly slower than theC++ version?<br>This depends on the VM you used. We have seen goodVM which leads the Java version to be quite competitive withthe C++ code. (though still slower)<p><li> While training I get the following error message: java.lang.OutOfMemoryError. What is wrong ?<br>You should try to increase the maximum Java heap size.For example,<pre>java -Xmx256m svm_train.java ...</pre>sets the maximum heap size to 256M.</ul><hr><h3>Python Interface</h3><ul><p><li>Using python on MS windows, it fails to load the dll file.<br>It seems the dll file is version dependent. So far we haven'tfound out a good solution. Please email us if you have anygood suggestions.<!--There do exist work arounds, however. Inhttp://aspn.activestate.com/ASPN/Mail/Message/python-list/983252they presented a solution: 1) find the version of python in theregistry 2) perform LoadLibrary("pythonxx.dll") and 3) resolve thereference to functions through GetProcAddress. It is said that SWIGmay help on this.http://mailman.cs.uchicago.edu/pipermail/swig/2001-July/002744.htmlpresented a similar example.--><p><li>Except the python-C++ interface provided, could I use Jython to call libsvm ?<br> Yes, an example is <a href=http://www.csie.ntu.edu.tw/~cjlin/libsvm/jython>here</a></ul>  </body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -