<?xml version="1.0" encoding="gb2312"?>

<!-- RSS generated by oioj.net on 4/16/2004 ; 感谢LeXRus提供 RSS 2.0 文档; 此文件可自由使用，但请保留此行信息 --> 
<!-- Source download URL: http://blogger.org.cn/blog/rss2.asp       -->
<rss version="2.0">

<channel>
<title>fysong161的博客</title>
<link>http://blogger.org.cn/blog/blog.asp?name=fysong161</link>
<description>fysong161的博客</description>
<copyright>blogger.org.cn</copyright>
<generator>W3CHINA Blog</generator>
<webMaster>webmaster@blogger.org.cn</webMaster>
<item>
<title><![CDATA[[机器学习][转]libsvm的介绍和使用]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=fysong161&amp;id=34303</link>
<author>fysong161</author>
<pubDate>2008/4/23 19:46:07</pubDate>
<description><![CDATA[<A><FONT size=4>　</FONT></A><A><FONT color=#716699 size=4>　</FONT></A><FONT size=4> </FONT>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#716699><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman">1. LIBSVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">软件包简介</SPAN></FONT></FONT><SPAN lang=EN-US><BR><BR><FONT face="Times New Roman" color=#716699 size=4>LIBSVM </FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是台湾大学林智仁</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">(Chih-Jen Lin)</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">博士等开发设计的一个操作简单、易于使用、快速有效的通用</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">软件包，可以解决分类问题（包括</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C- SVC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">n - SVC </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）、回归问题（包括</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">e - SVR</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">n - SVR </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）以及分布估计（</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">one-class-SVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）等问题，提供了线性、多项式、径向基和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">S</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">形函数四种常用的核函数供选择，可以有效地解决多类问题、交叉验证选择参数、对不平衡样本加权、多类问题的概率估计等。</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LIBSVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是一个开源的软件包，需要者都可以免费的从作者的个人主页</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">http://www.csie.ntu.edu.tw/~cjlin/ </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">处获得。他不仅提供了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LIBSVM</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C++</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">语言的算法源代码，还提供了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Python</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Java</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">R</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">MATLAB</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Perl</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Ruby</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LabVIEW</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">以及</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C#.net </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等各种语言的接口，可以方便的在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Windows </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">UNIX </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">平台下使用，也便于科研工作者根据自己的需要进行改进（譬如设计使用符合自己特定问题需要的核函数等）。另外还提供了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">WINDOWS </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">平台下的可视化操作工具</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SVM-toy</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，并且在进行模型参数选择时可以绘制出交叉验证精度的等高线图。</SPAN></FONT></FONT><SPAN lang=EN-US><BR><BR><FONT face="Times New Roman" color=#716699 size=4>2. LIBSVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>使用方法简介</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#716699><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman">LIBSVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在给出源代码的同时还提供了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Windows</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">操作系统下的可执行文件，包括：进行支持向量机训练的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">svmtrain.exe</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；根据已获得的支持向量机模型对数据集进行预测的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">svmpredict.exe</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；以及对训练数据与测试数据进行简单缩操作的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">svmscale.exe</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。它们都可以直接在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">DOS </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">环境中使用。如果下载的包中只有</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C++</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的源代码，则也可以自己在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等软件上编译生成可执行文件。</SPAN></FONT></FONT><SPAN lang=EN-US><BR><BR><FONT face="Times New Roman" color=#716699 size=4>LIBSVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>使用的一般步骤是：</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>1</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">按照</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LIBSVM</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">软件包所要求的格式准备数据集；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>2</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对数据进行简单的缩放操作；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>3</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">考虑选用</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">RBF </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">核函数</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">2 K(x,y) e x y = -g - </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>4</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">采用交叉验证选择最佳参数</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">与</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">g </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>5</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">采用最佳参数</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">与</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">g </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对整个训练集进行训练获取支持向量机模型；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>6</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">利用获取的模型进行测试与预测。</SPAN></FONT></FONT><SPAN lang=EN-US><BR><BR></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">. LIBSVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用的数据格式</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>LIBSVM</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>使用的训练数据和测试数据文件格式如下：</FONT></SPAN><SPAN lang=EN-US><BR></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN></FONT></FONT><FONT color=#716699><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman">&lt; 2&gt; …<BR></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其中</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是训练数据集的目标值，对于分类，它是标识某类的整数</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">(</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">支持多个类</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">)</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；对于回归，是任意实数。是以</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">1 </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">开始的整数，表示特征的序号；为实数，也就是我们常说的特征值或自变量。当特征值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">0 </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时，特征序号与特征值都可以同时省略，即</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">index</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以是不连续的自然数。与第一个特征序号、前一个特征值与后一个特征序号之间用空格隔开。测试数据文件中的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">label </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只用于计算准确度或误差，如果它是未知的，只需用任意一个数填写这一栏，也可以空着不填。例如：</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>+1 1:0.708 2:1 3:1 4:-0.320 5:-0.105 6:-1 8:1.21<BR><BR></FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">二</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">. svmscale </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的用法</SPAN></FONT></FONT><SPAN lang=EN-US><BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>对数据集进行缩放的目的在于：</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>）避免一些特征值范围过大而另一些特征值范围过小；</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>2</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）避免在训练时为了计算核函数而计算内积的时候引起数值计算的困难。因此，通常将数据缩放到</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">[ -1,1]</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或者是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">[0,1]</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">之间。</SPAN></FONT></FONT><SPAN lang=EN-US><BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>用法：</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman">svmscale [-l lower] [-u upper] [-y y_lower y_upper][-s save_filename] [-r restore_filename] filename<BR></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（缺省值：</SPAN><SPAN lang=EN-US><FONT face="Times New Roman"> lower = -1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">upper = 1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，没有对</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">y</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">进行缩放）</SPAN></FONT></FONT><SPAN lang=EN-US><BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>其中，</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-l</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：数据下限标记；</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">lower</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：缩放后数据下限；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-u</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：数据上限标记；</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">upper</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：缩放后数据上限；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-y</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：是否对目标值同时进行缩放；</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">y_lower</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为下限值，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">y_upper</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为上限值；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-s save_filename</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：表示将缩放的规则保存为文件</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">save_filename</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-r restore_filename</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：表示将缩放规则文件</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">restore_filename</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">载入后按此缩放；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>filename</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>：待缩放的数据文件（要求满足前面所述的格式）。</FONT></SPAN><SPAN lang=EN-US><BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>缩放规则文件可以用文本浏览器打开，看到其格式为：</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>lower upper<BR>lval1 uval1<BR>lval2 uval2<BR></FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其中的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">lower </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">与</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">upper </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">与使用时所设置的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">lower </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">与</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">upper </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">含义相同；</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">index </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表示特征序号；</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">lval </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为该特征对应转换后下限</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">lower </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的特征值；</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">uval </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为对应于转换后上限</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">upper </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的特征值。数据集的缩放结果在此情况下通过</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">DOS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">窗口输出，当然也可以通过</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">DOS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的文件重定向符号</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">“&gt;”</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将结果另存为指定的文件。</SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>使用实例：</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>1) svmscale –s train3.range train3&gt;train3.scale<BR></FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表示采用缺省值（即对属性值缩放到</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">[ -1,1]</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的范围，对目标值不进行缩放）</SPAN></FONT></FONT><SPAN lang=EN-US><BR></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对数据集</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">train3 </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">进行缩放操作，其结果缩放规则文件保存为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">train3.range</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，缩放集的缩放结果保存为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">train3.scale</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>2</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>）</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman"> svmscale –r train3.range test3&gt;test3.scale<BR></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表示载入缩放规则</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">train3.range </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">后按照其上下限对应的特征值和上下限值线性的地对数据集</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">test3 </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">进行缩放，结果保存为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">test3.scale</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN></FONT></FONT><SPAN lang=EN-US><BR><BR></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">三</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">. svmtrain </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的用法</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>svmtrain</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实现对训练数据集的训练，获得</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SVM</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模型。</SPAN></FONT></FONT><SPAN lang=EN-US><BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>用法：</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman"> svmtrain [options] training_set_file [model_file]<BR></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其中，</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>options</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>（操作参数）：可用的选项即表示的涵义如下所示</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-s svm</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类型：设置</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类型，默认值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">0</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，可选类型有：</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>0 -- C- SVC<BR>1 -- n - SVC<BR>2 -- one-class-SVM<BR>3 -- e - SVR<BR>4 -- n - SVR<BR>-t </FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">核函数类型：设置核函数类型，默认值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">2</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，可选类型有：</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>0 -- </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699 size=4>线性核：</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman">u'*v<BR>1 -- </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">多项式核：</SPAN></FONT></FONT><FONT color=#716699><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman"> (g*u'*v+ coef 0)deg ree<BR>2 -- RBF </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">核：</SPAN></FONT></FONT><FONT color=#716699><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman">e( u v 2) g -<BR>3 -- sigmoid </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">核：</SPAN></FONT></FONT><FONT color=#716699><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman">tanh(g*u'*v+ coef 0)<BR>-d degree</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：核函数中的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">degree</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">设置，默认值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">3</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN><SPAN lang=EN-US><FONT face="Times New Roman"> -g g </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：设置核函数中的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">g </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，默认值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">1/ k </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-r coef 0</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：设置核函数中的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">coef 0</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，默认值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">0</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-c cost</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：设置</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C- SVC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">e - SVR</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">n - SVR</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中从惩罚系数</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，默认值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-n n </FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：设置</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">n - SVC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">one-class-SVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">与</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">n - SVR </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中参数</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">n </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，默认值</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">0.5</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-p e </FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：设置</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">n - SVR</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的损失函数中的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">e </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，默认值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">0.1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-m cachesize</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：设置</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">cache</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">内存大小，以</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">MB</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为单位，默认值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">40</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-e e </FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：设置终止准则中的可容忍偏差，默认值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">0.001</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-h shrinking</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：是否使用启发式，可选值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">0 </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，默认值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-b </FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">概率估计：是否计算</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SVC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SVR</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的概率估计，可选值</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">0 </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，默认</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">0</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-wi weight</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：对各类样本的惩罚系数</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">C</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">加权，默认值为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#716699 size=4>-v n</FONT></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">n</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">折交叉验证模式。</SPAN></FONT></FONT><SPAN lang=EN-US><BR></SPAN><FONT color=#716699><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其中</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">-g</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选项中的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">k</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是指输入数据中的属性数。操作参数</SPAN><SPAN lang=EN-US><FONT face="Times New Roman"> -v </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">随机地将数据剖分为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">n </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">部分并计算交叉检验准确度和均方根误差。以上这些参数设置可以按照</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的类型和核函数所支持的参数进行任意组合，如果设置的参数在函数或</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SVM </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类型中没有也不会产生影响，程序不会接受该参数；如果应有的参数设置不正确，参数将采用默认值。</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">training_set_file</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是要进行训练的数据集；</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">model_file</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是训练结束后产生的模型文件，该参数如果不设置将采用默认的文件名，也可以设置成自己惯用的文件名。</SPAN></FONT></FONT><SPAN lang=EN-US><BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#716699><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#000000 size=4>使用实例：</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#000000 size=4>）</FONT></SPAN><FONT color=#000000><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman">svmtrain train3.scale train3.model<BR></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">训练</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">train3.scale</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，将模型保存于文件</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">train3.model</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，并在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">dos</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">窗口中输出如下结果：</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>optimization finished, #iter = 1756<BR>nu = 0.464223<BR>obj = -551.002342, rho = -0.337784<BR>nSV = 604, nBSV = 557<BR>Total nSV = 604<BR></FONT></SPAN><FONT color=#000000><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其中，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">#iter</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为迭代次数，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">nu </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">与前面的操作参数</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">-n n </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">相同，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">obj</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SVM</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件转换为的二次规划求解得到的最小值，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">rho </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为判决函数的常数项</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">b</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">nSV </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为支持向量个数，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">nBSV</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为边界上的支持向量个数，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Total nSV</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为支持向量总个数。训练后的模型保存为文件</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">train3.model</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，用记事本等文本浏览器打开可以看到其内容如下（其后</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">“%”</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">后内容为笔者所加注释）：</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>svm_type c_svc % </FONT></SPAN><FONT color=#000000><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">训练所采用的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">svm</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类型，此处为</SPAN></FONT></FONT><FONT color=#000000><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman">C- SVC<BR>kernel_type rbf % </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">训练采用的核函数类型，此处为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">RBF</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">核</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>gamma 0.047619 % </FONT></SPAN><FONT color=#000000><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">与操作参数设置中的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">g </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">含义相同</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>nr_class 2 % </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#000000 size=4>分类时的类别数，此处为两分类问题</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>total_sv 604 % </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#000000 size=4>总共的支持向量个数</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>rho -0.337784 % </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#000000 size=4>决策函数中的常数项</FONT></SPAN><FONT color=#000000><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman">b<BR>label 0 1 % </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类别标签</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>nr_sv 314 290 % </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#000000 size=4>各类别标签对应的支持向量个数</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>SV % </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#000000 size=4>以下为支持向量</FONT></SPAN><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>1 1:-0.963808 2:0.906788 ... 19:-0.197706 20:-0.928853 21:-1<BR>1 1:-0.885128 2:0.768219 ... 19:-0.452573 20:-0.980591 21:-1<BR>... ... ...<BR>1 1:-0.847359 2:0.485921 ... 19:-0.541457 20:-0.989077 21:-1<BR>% </FONT></SPAN><FONT color=#000000><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于分类问题，上面的支持向量的各列含义与训练数据集相同；对于回归问题，略有不同，与训练数据中的标签</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">label</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（即</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">y</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">值）所对应的位置在模型文件的支持向量中现在存放的是</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Lagrange </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">系数</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">a </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">值，即为下面决策函数公式中的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">a </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">值：</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>* *<BR>1<BR>() ( )( ( ) ( )) ( ) ( , )<BR>( , )<BR>k<BR>i i i i i i<BR>i i sv<BR>i i<BR>i sv<BR>fx a a x x b a a k x x b<BR>ak x x b<BR>= &nbsp; = - F F + = - +<BR>= + g<BR></FONT></SPAN><FONT color=#000000><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">四</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">. svmpredict </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的用法</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>svmpredict </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#000000 size=4>是根据训练获得的模型，对数据集合进行预测。</FONT></SPAN><SPAN lang=EN-US><BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT color=#000000 size=4>用法：</FONT></SPAN><FONT color=#000000><FONT size=4><SPAN lang=EN-US><FONT face="Times New Roman">svmpredict [options] test_file model_file output_file<BR>options</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（操作参数）：</SPAN></FONT></FONT><SPAN lang=EN-US><BR><FONT face="Times New Roman" color=#000000 size=4>-b probability_estimates</FONT></SPAN><FONT color=#000000><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：是否需要进行概率估计预测，可选值为</SPAN><SPAN l]]></description>
</item>
</channel>
</rss>