24小时热门版块排行榜    

CyRhmU.jpeg
查看: 1015  |  回复: 3
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

SimpleGirl

金虫 (正式写手)

[求助] LS-SVM参数辨识小测试,欢迎各位大神入贴交流

本人近期在用ls-SVM对线性系统做参数辨识,因为是线性系统所以采用线性核函数,然后根据得到的model.alpha与输入数据相乘得到辨识参数。但结果与实际的误差过大,不明白什么原因?还请各位大神给些意见。
matlab版本为:R2014b,
ls-svm的版本为:Matlab R2009b - R2013a: LS-SVMlab1.8 - Linux and Windows (32 and 64 bit)
电脑系统:windows 8.1
为测试ls-svm,写了如下代码:

%%%%%%%%%
%% 辨识 y(k+1) = Ay(k) + Bx(k)的系数A和B
%% 为测试lssvm的参数辨识功能,在假定A=B=1的情况下进行以下测试试验

clc
clear all
close all


y = randperm(101);
input1 = y(1:100);
output = y(2:101);
x = output - input1;
input2 = x;
input = zeros(length(input1),2);
input(:,1) = input2';
input(:,2) = input1';
output = output';

%%%%%%%%%%%%%%
type = 'function estimation';
kernel= 'lin_kernel';

gam = 100;
% Regularization parameter
sig= [];

%% =====================optimizate parameters======================
costfun = 'crossvalidatelssvm';
costfun_args = {10,'mse'};
optfun = 'gridsearch';

model = initlssvm(input,output,type,gam,sig,kernel);                 % 模型初始化
model = tunelssvm(model,optfun,costfun,costfun_args);   % 模型参数优化
%% ======================test data=======================
model = trainlssvm(model);  % 训练
outputPre = simlssvm(model,input);

%%%error%%%%
error = zeros(size(outputPre));
error = output - outputPre;

% figure(3);
subplot(2,1,1);
plot(1:length(output),output,'r+:',1:length(outputPre),outputPre,'bo:');

legend('test','predict');
subplot(2,1,2);
plot(1:length(error),error);

sumc=zeros(1,2);
for i = 1:1:length(input)
    sumc(1,1) = sumc(1,1) + model.alpha(i)*input(i,1);
    sumc(1,2) = sumc(1,2) + model.alpha(i)*input(i,2);
end


sumc是用来计算辨识系数的,出来的结果达到了十位数了,但原始值才为1.
还请给位大神赐教!!!拜托拜托了。
回复此楼
进取求实,自信自律。
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

钧哥叼爆了

新虫 (初入文坛)

求教学姐这方向现在好做么?好迷茫,不知道还能干啥

发自小木虫Android客户端
3楼2018-01-10 21:46:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 4 个回答

钧哥叼爆了

新虫 (初入文坛)

2楼2018-01-10 21:39:15
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ccycjl

新虫 (初入文坛)

你解决这个问题?
4楼2018-08-21 09:17:07
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见