www.pudn.com > SVM.rar > zhijie.m, change:2013-11-14,size:366b


 
ker='rbf'; 
C=200; 
global p1; 
p1=1.0; 
t1=clock; 
[nsv, alpha, b0] = svc(X1,Y1,ker,C);%关键 
t2=clock; 
t=t2-t1; 
fprintf('运行时间为%f秒.\n',t(6)+t(5)*60+t(4)*3600); 
 
 n = size(X1,1); 
 m = length(ty1); 
 H = zeros(m,n);   
 for i=1:m 
     for j=1:n 
       H(i,j) = Y1(j)*svkernel(ker,tx1(i,:),X1(j,:)); 
     end 
 end 
 predictedY = sign(H*alpha + b0);