这是我在上模式识别课程时的内容,也有参考这里。
线性判别函数的基本概念
判别函数为线性的情况的一般表达式 式中x是d 维特征向量,又称样本向量, 称为权向量, 分别表示为 是个常数,称为阈值权。
设样本d维特征空间中描述,则两类别问题中线性判别函数的一般形式可表示成
(3-1)
其中
而ω0是一个常数,称为阈值权。相应的决策规则可表示成,
g(X)=0就是相应的决策面方程,在线性判别函数条件下它对应d维空间的一个超平面,
(3-3)
为了说明向量W的意义,我们假设在该决策平面上有两个特征向量X1与X2,则应有
(3-4)
其中(X1-X2)也是一个向量,(3-4)式表明向量W与该平面上任两点组成的向量(X1-X2)正交,因此W就是该超平面的法线向量。这就是向量W的几何意义。而g(X)也就是d维空间中任一点X到该决策面距离的代数度量,该决策平面将这两类样本按其到该面距离的正负号确定其类别。至于w0则体现该决策面在特征空间中的位置,当w0=0时,该决策面过特征空间坐标系原点,而时,则表示了坐标原点到该决策面的距离。
有的同学可能对(3-1)公式表示线性判别函数不太理解,这可从线性方程的表示法说起,设二维空间一直线方程表示为:
w2X2+w1X1+w0=0
其中w1和w2分别是X1和X2的系数。w0是直线方程的参数项,由于X1和X2是一个向量的两个分量W=( w1, w2)T.则w2X2+ w1X1就是这两个向量的点积,表示成(3-3)式。另外我们也知道一个线性方程在二维空间唯一确定了一条直线,但一条直线却可以对应无穷多个直线方程。w2、w1和w0是该直线的方程参数,kw2、kw1和kw0也是这条直线方程的参数。如果我们定义,则
也是该直线的方程,但却是模为1的向量,而W'TX就是直线上任一点到W'向量的投影,它的数值等于,因此则表示了这条直线到坐标原点的法向距离。线性函数及线性方程的向量表示形式是今后常用的形式。
应用统计方法解决模式识别问题时,一再碰到的问题之一是维数问题。在低维空间里解析上或计算上行的通的方法,在高维空间里往往行不通。因此降低维数有时就成为处理实际问题的关键。
我们可以考虑把d维空间的样本投影到一条直线上,形成一维空间,即把维数压缩到一维。这在数学上总是容易办到的。然而,即使样本在d维空间里形成若干紧凑的相互分得开的集群,若把它们投影到一条任意的直线上,也可能使几类样本混在一起而变的无法识别。但在一般情况下,总可以找到某个方向,使在这个方向的直线上,样本的投影能分开的最好。
在使用线性分类器时,样本的分类由其判别函数值决定,而每个样本的判别函数值是其各分量的线性加权和再加上一阈值w0。如果我们只考虑各分量的线性加权和,则它是各样本向量与向量W的向量点积。如果向量W的幅度为单位长度,则线性加权和又可看作各样本向量在向量W上的投影。显然样本集中向量投影的分布情况与所选择的W向量有关,
如何根据实际情况找到这条最好的、最易于分类的投影线。这就是Fisher法要解决的基本问题。
显然对向量w1的投影能使这两类有明显可分开的区域,而对向量w2的投影,则使两类数据部分交迭在一起,无法找到一个能将它们截然分开的界面。Fisher准则的基本原理,就是要找到一个最合适的投影轴,使两类样本在该轴上投影的交迭部分最少,从而使分类效果为最佳。
分析w1方向之所以比w2方向优越,可以归纳出这样一个准则,即向量W的方向选择应能使两类样本投影的均值之差尽可能大些,而使类内样本的离散程度尽可能小。这就是Fisher准则函数的基本思路。为了将这个思路变为可计算的函数值,我们先对一些基本参量下定义。
1 样本在d维特征空间的一些描述量。
(1) 各类样本均值向量mi
(3-15)
(2) 样本类内离散度矩阵Si与总类内离散度矩阵Sw
(3-16)
(3-17)
(3) 样本类间离散度矩阵Sb
(3-18)
类内离散矩阵Si在形式上与协方差矩阵很相似,但协方差矩阵是一种期望值,而类内离散矩阵只是表示有限个样本在空间分布的离散程度。对我们来说不一定要在这一方面细究。
2 在一维Y空间
(1) 各类样本均值
(3-19)
(2) 样本类内离散度和总类内离散度
(3-20)
(3-21)
在这里定义一维空间两类数据的分布是为了描述空间样本点到一向量投影的分散情况的,因此也就是对某向量W的投影在W上的分布。的定义与随机变量方差相类似。
在定义了上述一系列描述量后,可以用这些量给出Fisher准则的函数形式。根据Fisher选择投影方向W的原则,即使原样本向量在该方向上的投影能兼顾类间分布尽可能分开,类内样本投影尽可能密集的要求,用以评价投影方向W的函数为:
(3-22)
这个函数称为Fisher准则函数。但是(3-22)并不是W的显函数,需进一步化为W的显函数。为此需对 等项进一步演化:
(3-23)
因而(3-23)分子项又可写成
(3-24)
同样也可推出与W的关系
因此 (3-25)
则可表示成
(3-26)
这一数学推导的思路是,由于一个样本到一向量上的投影是一维实数空间,因此先定义在一维空间分布的表示方法(从(3-19)到(3-21))然后将Fisher的思想用到(3-22)式定义的准则上。接着将投影运算代入(3-22)式中各个量,经过(3-23)至(3-25)式最后得到(3-26),(3-26)式是一个相对重要的结论,有了它才能解出所需的W。
最佳W值的确定实际上就是对(3-26)求取其达极大值时的。对于这个问题可以采用拉格朗日乘子算法解决,譬如保持(3-26)式分母为一非零常数c的条件下,求其分子项的极大值。
为此可设计一拉格朗日函数
(3-27)
拉格朗日乘子法是用来求带约束条件的极值问题的,这是把作为要求极值的目标函数,而保持为一常数c,因此按拉格朗日乘子标准方法构造拉格朗日函数得(3-27)。然后通过对拉格朗日函数分别对W及乘子λ求导并置为0来求W的解。
这里对向量的求导(或偏导)的定义是:
如
则
其中λ为拉格朗日乘子,按拉格朗日算法对(3-27)式求对W的偏导数,且令其在时为零,得
则有
(3-28)
由于Sw非奇异,将(3-28)两边乘以Sw-1得
(3-29)
矩阵非奇异即该矩阵可逆,(3-29)是个典型的特征值问题。如不明白要复习一下为好。
这是一个求矩阵的特征值问题,但在此可利用(3-18)式对的定义,而得到
(3-30)
其中是一个数量,可用数值R表示,则(3-30)式可写成
代入(3-29)式可得
(3-31)
实际上我们关心的只是向量的方向,其数值大小对分类器没有影响。因此在忽略了数值因子后,可得
(3-32)
(3-32)是使用Fisher准则求最佳法线向量的解,该式比较重要。另外,(3-32)式这种形式的运算,我们称为线性变换,其中(m1-m2)式一个向量,Sw-1是Sw的逆矩阵,如(m1-m2)是d维,Sw和Sw-1都是d×d维,得到的也是一个d维的向量。
向量就是使Fisher准则函数达极大值的解,也就是按Fisher准则将d维X空间投影到一维Y空间的最佳投影方向,该向量的各分量值是对原d维特征向量求加权和的权值。
以上讨论了线性判别函数加权向量W的确定方法,并讨论了使Fisher准则函数极大的d维向量 的计算方法,但是判别函数中的另一项w0尚未确定,一般可采用以下几种方法确定w0如
(3-33)
或 (3-34)
或当与已知时可用
(3-35)
式中 和 分别为ω1类和 ω2 类样本的先验概率。
为了确定具体的分界面,还要指定线性方程的常数项。在实际工作中还可以对W0进行逐次修正的方式,选择不同的W0值,计算其对训练样本集的错误率,找到错误率较小的W0值。
当W0确定之后,则可按以下规则分类,
(3-36)
使用Fisher准则方法确定最佳线性分界面的方法是一个著名的方法,尽管提出该方法的时间比较早,仍见有人使用。
下面是一个程序示例:
给定3维样本195个,存放在文件“3dim195sample.txt”中,其中前80个是属于第一类的样本,接着100个是属于第二类的样本。 最后是15个未知类别样本。先验概率为P=0.7,
P2=0.3 ,根据已知类别的180个样本寻找最好的投影方向,使在该方向上对这180个样本的分类效果最好。然后利用合适的决策规则判断给定的15个未知样本分别属于什么类别。
1 #include<iostream> 2 #include<fstream> 3 using namespace std; 4 //高斯法求逆矩阵 5 bool Gauss(double A[], double B[], int n) 6 { 7 int i, j, k; 8 double max, temp; 9 double* t=new double[n*n]; //临时矩阵 10 //将A矩阵存放在临时矩阵t[n][n]中 11 for (i = 0; i < n*n; i++) 12 { 13 t[i] = A[i]; 14 } 15 //初始化B矩阵为单位阵 16 for (i = 0; i < n; i++) 17 { 18 for (j = 0; j < n; j++) 19 { 20 B[n*i+j] = (i == j) ? (double)1 : 0; 21 } 22 } 23 for (i = 0; i < n; i++) 24 { 25 //寻找主元 26 max = t[n*i+i]; 27 k = i; 28 for (j = i + 1; j < n; j++) 29 { 30 if (fabs(t[n*j+i]) > fabs(max)) 31 { 32 max = t[n*j+i]; 33 k = j; 34 } 35 } 36 //如果主元所在行不是第i行,进行行交换 37 if (k != i) 38 { 39 for (j = 0; j < n; j++) 40 { 41 temp = t[i*n+j]; 42 t[i*n+j] = t[k*n+j]; 43 t[k*n+j] = temp; 44 //B伴随交换 45 temp = B[i*n+j]; 46 B[i*n+j] = B[k*n+j]; 47 B[k*n+j] = temp; 48 } 49 } 50 //判断主元是否为0, 若是, 则矩阵A不是满秩矩阵,不存在逆矩阵 51 if (t[i*n+i] == 0) 52 { 53 cout << "There is no inverse matrix!"; 54 return false; 55 } 56 //消去A的第i列除去i行以外的各行元素 57 temp = t[i*+i]; 58 for (j = 0; j < n; j++) 59 { 60 t[i*n+j] = t[i*n+j] / temp; //主对角线上的元素变为1 61 B[i*n+j] = B[i*n+j] / temp; //伴随计算 62 } 63 for (j = 0; j < n; j++) //第0行->第n行 64 { 65 if (j != i) //不是第i行 66 { 67 temp = t[j*n+i]; 68 for (k = 0; k < n; k++) //第j行元素 - i行元素*j列i行元素 69 { 70 t[j*n+k] = t[j*n+k] - t[i*n+k] * temp; 71 B[j*n+k] = B[j*n+k] - B[i*n+k] * temp; 72 } 73 } 74 } 75 } 76 return true; 77 } 78 int main(){ 79 ifstream fin; 80 fin.open("3dim195sample.txt"); 81 82 ofstream fout; 83 fout.open("result.txt"); 84 double** data = new double*[3]; 85 for (int i = 0; i < 3; i++){ 86 data[i] = new double[195]; 87 } 88 double avg1[3] = { 0, 0, 0 }, avg2[3] = {0,0,0}; 89 double *s1=new double[9],*s2=new double[9],*sw = new double[9],*swinv=new double[9]; 90 for (int i = 0; i < 195; i++){ 91 for (int j = 0; j < 3; j++){ 92 fin >> data[j][i]; 93 if (i < 80){ 94 avg1[j] += data[j][i]; 95 } 96 else if (i < 180){ 97 avg2[j] += data[j][i]; 98 } 99 } 100 } 101 for (int i = 0; i < 3; i++){ 102 avg1[i] /= 80; 103 avg2[i] /= 100; 104 } 105 for (int j = 0; j < 3; j++) 106 for (int k = 0; k < 3; k++){ 107 s1[3 * j + k] = 0; 108 s2[3 * j + k] = 0; 109 } 110 for (int i = 0; i < 180; i++){ 111 for (int j = 0; j < 3; j++){ 112 for (int k = 0; k < 3; k++){ 113 if (i < 80){ 114 s1[3 * j + k] += (data[j][i]-avg1[j]) * (data[k][i]-avg1[k]); 115 } 116 else{ 117 s2[3 * j + k] += (data[j][i]-avg2[j]) * (data[k][i]-avg2[k]); 118 } 119 } 120 121 } 122 } 123 for (int i = 0; i < 9; i++) 124 sw[i] = s1[i] + s2[i]; 125 Gauss(sw, swinv,3); 126 double w[3] = { 0, 0, 0 }; 127 fout << "决策向量是: "; 128 for (int i = 0; i < 3; i++){ 129 for (int j = 0; j < 3; j++){ 130 w[i] += swinv[i * 3 + j] * (avg1[j] - avg2[j]); 131 } 132 fout << w[i] << " "; 133 } 134 fout << " "; 135 double m1 = 0, m2 = 0; 136 for (int j = 0; j < 180; j++){ 137 double temp = 0; 138 for (int i = 0; i < 3; i++){ 139 temp += w[i] * data[i][j]; 140 } 141 if (j < 80){ 142 m1 += temp; 143 } 144 else{ 145 m2 += temp; 146 } 147 } 148 m1 /= 80; 149 m2 /= 100; 150 151 double result = 0,y0=0; 152 y0 += (m1 + m2) / 2; 153 y0 += log(0.7 / 0.3) / 178; 154 for (int i = 0; i < 15; i++){ 155 for (int j = 0; j < 3; j++){ 156 result += w[j] * data[j][i + 100]; 157 } 158 if (result > y0) 159 fout << "属于第一类 "; 160 else 161 fout << "属于第二类 "; 162 result = 0; 163 } 164 165 fout.flush(); 166 fout.close(); 167 fin.close(); 168 return 0; 169 }
附3dim195sample.txt数据
3.92639075035090E+0000 1.82448704288431E+0000 1.93046658579950E+0000 3.23255693526531E+0000 4.94053017625487E-0001 2.01603737281494E+0000 2.87631054414386E+0000 1.62314568037663E+0000 0.34038163365586E+0000 1.46628238268383E+0000 3.38876586374638E+0000 1.07546814479666E+0000 2.84019885397303E+0000 1.79367037883761E+0000 1.14627640826449E+0000 2.23691065641028E+0000 1.54501423942050E+0000 1.15920266822012E+0000 1.36947469571179E+0000 2.34116905476633E+0000 2.70327205847147E+0000 2.81946571482398E+0000 1.43720953648825E+0000 1.05596001297777E+0000 1.37793386471010E+0000 1.93540635079336E+0000 1.24962193141687E+0000 1.13874985040130E+0000 1.06371976532240E+0000 3.82806441871563E+0000 1.14618909741205E+0000 3.65000742304533E+0000 1.59702830170865E+0000 1.68256340389115E+0000 1.54089520151824E+0000 2.09152586660903E+0000 2.10084578826006E+0000 2.35782906437151E+0000 1.36521908436162E+0000 1.95840457658842E+0000 1.29625032697371E+0000 1.67196053690080E+0000 2.11807059540741E+0000 4.31937513889551E+0000 2.83763934391113E-0001 2.00614017967599E+0000 2.15840353047432E+0000 2.19987870533146E+0000 1.16112252517493E+0000 2.19320725473051E+0000 1.29914949595101E+0000 2.30155298349749E+0000 1.75223946746288E+0000 0.46982364925400E+0000 1.45591159540224E+0000 1.93124566145320E+0000 2.49618303258712E+0000 0.10937576699786E+0000 4.32413433874350E+0000 2.51375467096766E+0000 1.60900363931491E+0000 2.00177695061460E+0000 1.91311870043626E+0000 1.91383696561002E+0000 1.76241785438151E+0000 1.03726122574826E+0000 1.41088313268521E+0000 3.36840157214669E+0000 2.01877976524700E+0000 3.09393485393118E+0000 3.81198733112825E+0000 1.37856824582633E+0000 1.57073838455743E+0000 1.61817260706041E+0000 2.29621063838494E+0000 2.88656507490042E+0000 1.28130696483342E+0000 4.62041490934102E-0001 2.74487721808334E+0000 1.89532809812671E+0000 2.95727918405506E+0000 2.04808526408904E+0000 2.15611606615004E+0000 2.41609135063546E+0000 1.48506456640775E+0000 1.70175717054492E+0000 3.72821422034038E-0001 0.71300794830304E+0000 2.82241990048644E+0000 4.81781127621628E-0001 1.29274320928460E+0000 2.01981843451861E+0000 1.25228212874691E+0000 3.32632855125955E+0000 2.51299031082647E+0000 2.08404522136737E+0000 1.30540514382439E+0000 7.89003756234355E-0001 2.43962409677540E+0000 2.33878897669958E+0000 1.33425658389534E+0000 1.74098524618555E+0000 1.35769207573272E+0000 2.23696579935684E+0000 3.20612818377322E-0001 4.52302215580604E-0001 2.46145339241304E+0000 1.25953837610801E+0000 3.26763603982585E-0001 1.55208766065199E+0000 1.39576715497598E+0000 1.05432421515345E+0000 1.90228058168703E+0000 1.82857502949814E+0000 4.24494347196662E+0000 2.83077228030042E+0000 4.36815196086521E-0001 1.75467354412516E+0000 1.22356589905946E+0000 2.24043696233022E+0000 3.12816482841996E+0000 4.43614195558365E+0001 3.92317291787739E+0000 2.99208968713082E-0001 3.19323128914436E+0000 2.59714384786540E+0000 4.96022657611384E-0001 2.28706489387597E+0000 3.64284460295409E+0000 1.97644176133158E+0000 1.70816406035638E+0000 5.00177551183635E+0000 1.48974823413035E+0000 5.30231929264248E+0000 3.46673439770931E-0001 5.63603479772249E+0000 2.45314198273842E+0000 1.72674753006131E-0001 1.99985301416004E+0000 5.10649467592307E-0001 2.22993744243781E+0000 7.20003875641544E-0001 3.38800468936058E-0001 6.62619171815975E-0001 2.36415320510546E+0000 3.63260621431921E+0000 2.22037937382564E+0000 1.52705148444565E+0000 2.79954032924126E+0000 3.83104660119467E-0001 2.55287565465462E+0000 1.46059220092853E+0000 3.80513713907026E+0000 2.68583332117568E-0001 2.49449698177962E+0000 5.15590937213044E-0001 4.76432102260530E-0002 1.41640798673259E+0000 2.37711212372470E-0001 3.79232289935252E-0001 7.79457500130597E+0000 3.91719344575244E+0000 3.88278140616418E+0000 1.38306589826125E+0000 7.66311288650664E+0000 1.04534266486458E+0000 9.28180206133902E+0000 5.11132039363855E-0001 8.59543339356020E-0001 5.21460623436688E-0001 6.90320260492511E-0001 1.16855759053134E+0000 3.15946604825722E+0000 7.68134411102749E-0001 1.04562349050333E+0000 9.11326114513255E-0002 8.79940560112278E-0001 3.26035861150703E-0003 2.82297412209984E+0000 7.82633475283364E-0001 2.43685331879810E+0000 4.90936758862685E+0000 5.16708087312644E-0001 1.40527164327954E+0000 2.51843555119457E-0001 1.34682127100948E+0000 1.11261329743008E+0000 9.58757523858860E-0002 7.57158235362711E-0001 2.16521531358859E+0000 9.75723607016423E+0000 6.98120307223392E-0001 2.22488711372438E-0002 5.12250236483036E-0001 5.76504032254660E-0001 3.24193622169717E+0000 3.88079144339231E+0000 1.80728128286275E-0001 4.86193712532191E-0001 1.05770496359901E+0000 2.90724211557835E-0001 7.43950644261657E-0001 2.49074808329562E+0000 4.73651564143733E+0000 9.27501938015665E-0001 2.54574998790440E+0000 2.62075509261668E-0001 3.64979371544404E+0000 2.59518793915241E+0000 1.21876893023182E+0000 7.99941711821277E-0002 3.49322031110247E+0000 3.70213353699779E+0000 2.63263096975182E+0000 3.45805038290714E+0000 1.10053506528473E+0000 1.39368475905651E+0000 2.50920102303142E+0000 3.71650708358141E+0000 9.89362867107196E-0001 6.03048306710591E-0001 5.84967909301756E-0001 5.04268694336214E+0000 5.14546823735935E+0000 5.63410618525423E+0000 4.47861627258973E+0000 4.57531692954711E-0001 4.31618080201665E-0001 1.92675762576054E+0000 9.81950778240900E-0001 1.65640875109170E+0000 5.99976473198664E-0001 1.41075256694583E+0000 2.15004063752850E+0000 3.99642083331932E-0001 4.04152416216555E-0001 3.91238842562813E+0000 4.73973282344893E+0000 5.40116765044535E+0000 5.61709450967923E+0000 3.28064539874756E+0000 7.92143754025827E-0001 2.96138658962270E+0000 1.12298968478300E+0000 2.73704113602403E+0000 2.01079159570182E+0000 3.55653242387947E-0001 2.31306400828265E+0000 2.31109487583131E+0000 8.41889765054497E-0001 7.35572882026931E-0001 2.04082933507278E-0001 2.28738218962125E+0000 1.47345519179233E+0000 2.43157927608447E+0000 5.31208942082795E-0001 6.00801896928709E-0001 1.18852469046738E+0000 6.47056981129457E-0001 1.77512762982321E+0000 1.22476763919783E+0000 1.03563623152734E+0000 2.54473665414730E-0001 8.04134467838979E-0001 4.37147139295074E+0000 1.50269367458519E+0000 1.81438388963452E+0000 4.32983236608045E+0000 5.84195501982525E+0000 1.20072347864054E+0000 7.90783227463629E-0001 5.03325116743280E+0000 1.62971270614573E-0001 3.51793682177423E-0001 7.67162265855446E-0001 1.51586944596683E-0001 2.56554838950774E+0000 7.10834811631252E-0001 6.17161036820321E-0001 1.38629744286866E+0000 8.19606336584127E-0001 3.68751519397536E+0000 2.93923961783303E+0000 1.09923395470467E-0001 2.01613585636455E+0000 4.13171899207060E+0000 2.63471339521772E-0002 2.36663472447579E+0000 5.82017998058065E+0000 2.86152273277142E-0001 1.17959122776814E+0000 7.21486142469763E-0001 4.59149111238796E+0000 8.04358493324814E-0001 8.20254145678023E+0000 2.34334819933842E+0000 2.01189266931226E-0001 1.25018569871886E+0000 2.23538004279171E+0000 1.63096240776363E+0000 2.09312180685073E-0001 2.11582544456134E+0000 2.07817694472141E+0000 1.43569254420612E+0000 5.27433753625690E+0000 3.23153843770371E-0001 5.48056393682058E-0001 3.42541036508150E+0000 1.60588423170679E-0001 1.41221165593890E+0000 4.11811280691723E+0000 2.27732436153195E-0001 1.81641134282522E+0000 3.14483373188061E+0000 4.28552288223711E-0001 1.06409787487564E+0000 4.41794525078884E+0000 9.45710629035829E-0001 1.50156552667085E-0001 1.23025851775324E+0000 2.24092493521020E+0000 1.60451503976057E+0000 2.96743997070783E+0000 3.37834038704217E+0000 7.40755698995601E-0001 7.90753768940503E-0003 9.24884251469387E-0001 7.37414969730594E-0001 1.22966865193417E+0000 4.66174064431136E+0000 5.82866040994724E-0001 3.81156164843177E+0000 2.91403098353862E+0000 6.74362562354593E-0001 1.64725133755535E+0000 3.97927234598808E-0002 3.73569144283980E+0000 6.46894178135239E+0000 3.38135403155212E+0000 9.27188766157904E+0000 1.94130950899265E+0000 1.85808204708131E+0000 2.02211724217378E+0000 4.99481070781770E+0000 1.58004465688418E+0000 1.36757512527742E+0000 1.55063071359511E+0000 7.84821802193957E-0001 4.02811421157510E-0001 1.13519830288545E+0000 2.74567267078777E+0000 1.97567983186446E+0000 1.08047432479322E+0000 2.68453679637031E-0001 9.95178758810409E-0001 2.71620558743375E+0000 7.22101701808840E-0001 1.16784389876354E+0000 2.58608907516145E-0001 2.03840847063576E+0000 2.02149826021544E+0000 9.50619060847745E-0001 4.96868587327268E-0001 1.56614021521724E+0000 3.16605477728300E+0000 7.18458068498954E-0001 3.55308641994520E-0001 5.70558848284669E-0001 2.06658678636206E-0001 3.35907654831589E+0000 5.08428858438795E-0001 2.63751390186717E+0000 2.43846065681005E+0000 7.05280562914444E-0001 1.56643300665043E+0000 7.27138656227272E-0002 3.33739435122191E+0000 8.80074256447752E+0000 2.98766430018982E+0000 2.12699340424897E-0001 2.26143400030698E+0000 2.94817948619377E-0001 5.40706310788740E-0001 6.78575028675681E-0002 2.58683396564214E+0000 1.85246986422308E+0000 3.57913271700867E-0001 7.74527333778441E+0000 2.79678836237623E+0000 5.88401413639901E+0000 1.35580557328616E+0000 1.72200762327397E+0000 1.60080715289432E+0001 3.79262818772644E+0000 6.86967331071086E-0001 2.32649742300330E+0000 1.85583096774633E+0000 1.20411888777666E+0000 2.68656975818867E+0000 3.77976039384772E+0000 2.45519305050964E+0000 5.13013765674269E+0000 6.97411368140856E-0001 2.21543566251281E+0000 4.73454387070066E-0001 8.45784396179441E-0001 1.13801353034053E+0000 2.18990568634026E-0001 7.65665879058671E+0000 2.72526547490732E+0000 2.44349098378507E-0001 7.57984358436674E-0001 6.86438334158289E+0000 3.69028915069918E+0000 3.72151756512192E+0000 1.76868016906848E+0000 1.74040523392652E+0000 3.88044229377863E+0000 1.11671444326301E+0001 1.27105144425786E+0000 5.42851062138390E-0001 1.12302046480587E+0000 1.09917363804356E+0000 2.93265059140725E+0000 2.96059580449941E-0001 5.56392975562674E+0000 1.44644164715543E+0000 5.17845128499624E+0000 2.00432247336664E+0000 8.18508042990699E-0001 3.16063780828083E+0000 4.36981035385562E-0001 1.30286998872516E+0000 1.74142879146997E+0000 6.47643532224358E+0000 1.59100359713837E-0002 3.65879434013371E+0000 6.13731555885891E+0000 5.66393174770173E+0000 4.57877910766378E+0000 4.37705045581533E-0001 9.32411700729573E-0002 4.32366940874986E+0000 3.08945015595959E+0000 5.39526245907397E-0001 4.00356168670601E-0002 1.39689290976711E+0000 6.87397117978849E+0000 1.04302814797831E+0000 4.40731226032990E-0001 1.61691759292476E-0001 1.34232539508511E+0000 8.30874822947283E-0001 8.92692137687444E-0004 5.25229559460316E-0001 6.68633108009345E-0001 2.23832559614452E-0001 1.09917363804356E+0000 6.21967282690183E-0001 4.92964638048909E-0001 8.18202531722586E+0000 2.01009068725973E+0000 2.28045911141405E+0000 5.18809063127486E+0000 4.87481911335009E-0001 2.69320586974900E+0000 3.13223691213865E-0001 1.71042021864129E-0001 6.05370488659549E+0000 2.23395135289285E-0001 1.57642945918709E-0001 1.43358615347416E+0000 7.44873118217288E-0001 1.94528511361611E+0000 1.72524596410253E+0000 5.84376737965849E-0001 7.24596151493347E-0001 2.15127713191555E+0000 9.25916991089390E-0001 1.34670408166624E+0000 6.32477990079326E-0002 4.58440154894648E+0000 1.96730089716332E-0002 7.45106561961921E+0000 9.67540419757839E-0001 2.06499047107422E+0000 1.34462286269701E+0000 8.72927665046634E-0001 4.20857013620674E-0001 9.05241883430136E-0001 9.90163554346153E-0002 1.39231964146016E+0000 1.44564791158896E+0000 7.97640438607037E-0003 2.86118885184994E+0000 3.23067962657073E+0000 1.65262644922092E+0000 7.43999692646138E-0001 5.51345066760825E-0001 6.87289684828467E+0000 9.79710209643401E-0001 4.45408612999795E-0001 1.53431980358434E+0000 3.56361133193550E+0000 9.09688513033986E-0001 5.18721591712513E+0000 7.67998722851573E-0002 4.78093026315429E-0001 2.78165493369960E-0001 1.09917363804356E+0000 1.68645393745144E+0000 1.03259247567702E+0001 3.01241774451925E+0000 2.49805749859971E-0001 5.67392041870173E+0000 1.49209805129707E+0000 1.42004602895889E-0001 2.78647313642422E-0001 3.02498012642930E-0001 6.53287148727697E-0001 4.05329856691045E-0001 3.78714497456952E-0002 3.09642275535152E+0000 3.73918428154335E+0000 8.26928250745561E-0001 3.84304415362350E-0001 3.32419344529598E+0000 8.11718598660223E+0000 1.15706870611275E+0000 1.51464021390812E+0000 1.64570687037344E+0000 3.80973536616047E+0000 4.46519085135727E-0001 2.71936761595137E-0001 4.69403770444884E+0000 1.02735264799751E+0000 4.47621636978624E-0001 3.05405117007413E+0000 1.49063160883734E+0000 1.81337914799157E+0000 1.37834867162105E+0000 7.02427933371906E-0001 4.94518171499198E-0001 2.30570044393389E+0000 6.69624748353440E+0000 1.00595462622856E+0000 2.46241389298098E+0000 5.67177605656177E+0000 1.52806654525570E+0000 3.03162090123738E+0000 4.94670447174042E+0000 8.44355132959553E-0001 3.11568355059434E-0001 2.14057774780226E+0000 2.37224414106394E+0000 1.50506021953923E+0000 1.74656577927689E-0001 6.47486055888735E-0001 1.78177733866545E+0000 4.95313397419997E+0000 4.25125937053398E-0001 2.75647919510100E+0000 6.62786658089090E+0000 2.11121702705033E+0000 0.44732227529213E-0001 2.99850471732474E-0001 1.65251796664838E+0000 2.76680340710005E+0000 1.72795169089879E+0000 1.99538334819442E+0000 8.59735070779624E-0001 1.68825510541549E+0000 9.05461169372613E-0001 5.53674273601596E-0001 4.14423020318644E-0001 1.57098059442875E+0000 1.24180541039054E+0000 9.69051477433209E-0001 2.35677360663251E+0000 2.85291340623941E+0000 1.79165131645059E+0000 6.44872235757868E-0001 8.44405804512696E-0001 3.43521598496803E+0000 8.06553450165728E-0002
result.txt结果
决策向量是: -4.58178 54.6366 -0.0318441 属于第二类 属于第一类 属于第一类 属于第一类 属于第一类 属于第一类 属于第二类 属于第一类 属于第二类 属于第二类 属于第一类 属于第二类 属于第一类 属于第二类 属于第一类