lingyunzhi 发表于 2008-9-24 15:41

最优分类函数f(x)怎么求

以SVM二类分类方法为基础,以一对其余分类方法,对m类故障分类构造m个二值分类器。具体方法是:在构造m个分类器中的第k个分类器时,将第k类训练样本作为一类,类别号为+1,其余k-1类作为一类,类别号为-1,训练二值分类器(3)。
在构造分类器后,对数据进行测试时,判断器属于哪个分类器是根据 f(x) =sign[∑αiyiK(xi,x)+b]的值+1或者-1,来判断的,但是如何在进行分类,计算出 支持向量,来计算f(x)呢,
注明:我使用的是使用的是SVM-steven的工具箱,SVC.m
比如一个例子运行如下
clc
clear
%设置第一个分类器,此分类器分辨是否正常
x1=load('C:\Documents and Settings\xielr\桌面\实验\1\d\B4401.TXT');
x11=mean(abs(x1));x12=max(abs(x1))/x11;
i = 1;   
while i <= 8192,   
x1(i) = x1(i)^2;   
i = i+1;   
end   
x13=sqrt(mean(x1));
x1=;
x2=load('C:\Documents and Settings\xielr\桌面\实验\1\d\B4403.TXT');
x21=mean(abs(x2));x22=max(abs(x2))/x21;
i = 1;   
while i <= 8192,   
x2(i) = x2(i)^2;   
i = i+1;   
end   
x23=sqrt(mean(x2));
x2=;
x3=load('C:\Documents and Settings\xielr\桌面\实验\1\a\B2701.TXT');
x31=mean(abs(x3));x32=max(abs(x3))/x31;
i = 1;   
while i <= 8192,   
x3(i) = x3(i)^2;   
i = i+1;   
end   
x33=sqrt(mean(x3));
x3=;
x4=load('C:\Documents and Settings\xielr\桌面\实验\1\a\B2703.TXT');
x41=mean(abs(x4));x42=max(abs(x4))/x41;
i = 1;   
while i <= 8192,   
x4(i) = x4(i)^2;   
i = i+1;   
end   
x43=sqrt(mean(x4));
x4=;
x5=load('C:\Documents and Settings\xielr\桌面\实验\1\b\B3001.TXT');
x51=mean(abs(x5));x52=max(abs(x5))/x51;
i = 1;   
while i <= 8192,   
x5(i) = x5(i)^2;   
i = i+1;   
end   
x53=sqrt(mean(x5));
x5=;
x6=load('C:\Documents and Settings\xielr\桌面\实验\1\b\B3003.TXT');
x61=mean(abs(x6));x62=max(abs(x6))/x61;
i = 1;   
while i <= 8192,   
x6(i) = x6(i)^2;   
i = i+1;   
end   
x63=sqrt(mean(x6));
x6=;
x7=load('C:\Documents and Settings\xielr\桌面\实验\1\c\B3501.TXT');
x71=mean(abs(x7));x72=max(abs(x7))/x71;
i = 1;   
while i <= 8192,   
x7(i) = x7(i)^2;   
i = i+1;   
end   
x73=sqrt(mean(x7));
x7=;
x8=load('C:\Documents and Settings\xielr\桌面\实验\1\c\B3503.TXT');
x81=mean(abs(x8));x82=max(abs(x8))/x81;
i = 1;   
while i <= 8192,   
x8(i) = x8(i)^2;   
i = i+1;   
end   
x83=sqrt(mean(x8));
x8=;
%导入数据
x9=load('C:\Documents and Settings\xielr\桌面\实验\1\a\B2707.TXT');
x91=mean(abs(x9));x92=max(abs(x9))/x91;
i = 1;   
while i <= 8192,   
x9(i) = x9(i)^2;   
i = i+1;   
end   
x93=sqrt(mean(x9));
x9=;
x10=load('C:\Documents and Settings\xielr\桌面\实验\1\d\B4405.TXT');
x101=mean(abs(x10));x102=max(abs(x10))/x101;
i = 1;   
while i <= 8192,   
x10(i) = x10(i)^2;   
i = i+1;   
end   
x103=sqrt(mean(x10));
x10=;

%x1=reshape(x1,1,2048);
%x2=reshape(x2,1,2048);
%x3=reshape(x3,1,2048);
%x4=reshape(x4,1,2048);
%x5=reshape(x5,1,2048);
%x6=reshape(x6,1,2048);
%x7=reshape(x7,1,2048);
%x8=reshape(x8,1,2048);
X=;
Y=;
C=Inf;
    ker='linear';
    global p1 p2
    p1=3;
    p2=1;
    = svc(X,Y,ker,C)
    predictedY = svcoutput(X,Y,X,ker,alpha,bias)
    svcplot(X,Y,ker,alpha,bias)
   

Support Vector Classification
_____________________________
Constructing ...
Optimising ...
Execution time:0.0 seconds
Status : OPTIMAL_SOLUTION
|w0|^2    : 0.091150
Margin    : 6.624482
Sum alpha : 0.091150
Support Vectors : 2 (20.0%)
nsv =
   2

alpha =
    0.0000
    0.0000
    0.0000
    0.0000
    0.0000
    0.0000
    0.0456
    0.0000
    0.0000
    0.0456

bias =
    5.5296

predictedY =
   1
   1
    -1
    -1
    -1
    -1
    -1
    -1
    -1
   1

ans =
170.0164169.0164
ans 是什么结果呢,如何根据以上结果计算f(x)

[ 本帖最后由 lingyunzhi 于 2008-9-24 16:13 编辑 ]
页: [1]
查看完整版本: 最优分类函数f(x)怎么求