Matlab中libsvm回归怎么做时间序列的单步和多步预测
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/04/29 11:42:41
Matlab中libsvm回归怎么做时间序列的单步和多步预测
很高兴为您解答.
a(1)=0;
for i=2:220
a(i)=0.6*a(i-1)+randn;
end
train_t = 1:200;
train = a(train_t);
train_t = train_t';
train = train';
test_t = 1:203;
test=a(test_t);
test_t = test_t';
test = test';
[bestmse,bestc,bestg] = SVMcgForRegress(train,train_t,-3,11,-7,1,3,0.5,0.5,0.1);
cmd = ['-c ',num2str(bestc),' -g ',num2str(bestg),' -p 0.01 -s 3'];
model = svmtrain(train,train_t,cmd);
[trainpre,trainmse] = svmpredict(train,train_t,model);
figure;
hold on;
plot(train);
plot(trainpre,'r');
title('原来的训练数据的拟合1-200');
legend('原来的训练数据','训练数据预测拟合数据');
hold off
[testpre,testmse] = svmpredict(test,test_t,model);
figure;
hold on;
plot(test);
plot(testpre,'r');
title('测试数据的预测1-203');
legend('测试数据','测试数据预测拟合数据');
hold off
如若满意,请点击右侧【采纳答案】,如若还有问题,请点击【追问】
希望我的回答对您有所帮助,
a(1)=0;
for i=2:220
a(i)=0.6*a(i-1)+randn;
end
train_t = 1:200;
train = a(train_t);
train_t = train_t';
train = train';
test_t = 1:203;
test=a(test_t);
test_t = test_t';
test = test';
[bestmse,bestc,bestg] = SVMcgForRegress(train,train_t,-3,11,-7,1,3,0.5,0.5,0.1);
cmd = ['-c ',num2str(bestc),' -g ',num2str(bestg),' -p 0.01 -s 3'];
model = svmtrain(train,train_t,cmd);
[trainpre,trainmse] = svmpredict(train,train_t,model);
figure;
hold on;
plot(train);
plot(trainpre,'r');
title('原来的训练数据的拟合1-200');
legend('原来的训练数据','训练数据预测拟合数据');
hold off
[testpre,testmse] = svmpredict(test,test_t,model);
figure;
hold on;
plot(test);
plot(testpre,'r');
title('测试数据的预测1-203');
legend('测试数据','测试数据预测拟合数据');
hold off
如若满意,请点击右侧【采纳答案】,如若还有问题,请点击【追问】
希望我的回答对您有所帮助,
Matlab中libsvm回归怎么做时间序列的单步和多步预测
erdas或ARCGIS中如何做NDVI序列和时间序列的一元线性回归?
观测数据分析中几种方法的探讨(一) 回归-时间序列模型和贝叶斯预测模型
matlab时间序列预测中lpc函数输出的值是什么含义
基于时间序列matlab的BP神经网络预测
什么是回归分析法、时间序列法、投入产出法、数学归纳法和马尔科夫链预测法?
五十步笑百步中五十步和百步的比喻意义
时间序列预测时,数据具有周期性怎么办(用MATLAB做)
13题,第二步,怎么做的,
英语翻译经典时间序列之加法模型:因经典时间序列中加法模型(1-4步与乘法模型一样所以从第五步开始写)第五步:趋势变化因为
excel中做图表,横坐标为有日期和时间的序列,要怎么设置
PLC的单步控制梯形图怎么写