大家看看我这么仿真支持向量机回归对不对
我首先从网上下了个svm工具箱,然后我建了个.m文件,敲入以下代码:clc
clear
close all
x_train=0:pi/10:2*pi; %训练样本
y_train=sin(x_train); %训练目标
x_test=0:pi/5:4*pi; %测试样本
y_test=sin(x_test); %测试目标
plot(x_train,y_train,'b');
axis();
%--------------------------------------------------------
%训练支持向量机
ker='rbf';
C=5;
e=0.01;
loss='einsensitive';
= svr(x_train,y_train,ker,C,loss,e);
%后面的还没有写,因为到这里程序就有问题了
是不是有什么错误呢?为什么我的程序有以下这个问题:
??? Error using ==> /
Matrix dimensions must agree.
Error in ==> D:\Matlab6.5\toolbox\svm\svkernel.m
On line 35==> k = exp(-(u-v)*(u-v)'/(2*p1^2));
Error in ==> D:\Matlab6.5\toolbox\svm\svr.m
On line 40==> H(i,j) = svkernel(ker,X(i,:),X(j,:));
Error in ==> D:\Matlab6.5\work\MySVM\SVM_Regression.m
On line 19==> = svr(x_train,y_train,ker,C,loss,e); 把x_train和y_train改成列向量就OK了,x_test和y_test同样 回复的太晚啦,呵呵,还是要谢谢你
页:
[1]