24小时热门版块排行榜    

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

gohomeba

新虫 (初入文坛)

[求助] 如何人工神经网络来预测下一个数值???已有1人参与

大家好,求助!

手头有一个大致以天为周期的小时数据,共4000个数据。
我想做一个实验,用前面的2400个数据建立一个网络,在这个网络内第1~12个数据预测出第13个数据,
第2~13个数据预测出第14个数据。。。
最后希望基于这个网络,利用第2389~2400个数据来预测第2401个数据。
然后如此循环建立网络,预测2402, 2403, 。。。的过程。

但是现在得到的结果总是没有体现出预测来,如附图所示,蓝线是原始值,红线是这样的网络预测值,绿线是将这个预测值的线向左移动一下得到的。
求大侠指点应该如何修改?

源程序如下
%%%%%  load the data and forecast
%%%%%  it's not working.....
warning('off'); %#ok<WNOFF>
close all
clear
clc

load ttt

strip=12;
lenth=strip*200;
times=20;

err=zeros(times,strip);
rec_t=zeros(times,strip);
rec_tf=zeros(times,strip);
for time=1:times
    msg = sprintf('forecasting iteration %g/%g...\n',time,times);
    fprintf('%s',msg);
    signal=ttt(time:time+lenth-1); %%% lenth
   
    %%%%  strip data to predict 'strip+1' point
    in=zeros(strip,lenth-strip);
    for i=1:  (lenth-strip)
        in(:,i)=signal(i:i+strip-1);
    end
    tgt=signal(strip+1:lenth);
   
    in_f=signal(lenth-strip+1:lenth);
    in_f=reshape(in_f,strip,1);
   
    %%%%%%%%%%%%%% network %%%%%%%%%%%%%%%%
    net=newff(minmax(in),[strip*4,1],{'purelin','purelin'},'trainlm');
    net.trainParam.epochs=1000; %
    nettrainParam.goal=0.001; %
    [net,tr,Y,E]=train(net,in,tgt);
   
% %     %%%%%%%%%%%  chek the network %%%%%%%%%%%%%%%%
% %     out=sim(net,in);
% %     figure
% %     plot(reshape(tgt,1,strip*(cnt_strip-1)),'r-*');
% %     hold on
% %     plot(reshape(out,1,strip*(cnt_strip-1)),'b-d');
% %     legend('orignal','net(in)');
   
%     %%%%%%%%%%%%% prediction %%%%%%%%%%%%%%%
    out_f=sim(net,in_f);
   
    %%%%%%  record the series
    rec_t(time,1)=ttt(time+lenth);
    rec_tf(time,1)=out_f;
    err(time,1)=rec_tf(time,1)-rec_t(time,1);
end


figure;
plot(lenth+1:lenth+times,rec_t(:,1),'b-*');
hold on
plot(lenth+1:lenth+times,rec_tf(:,1),'r');
hold on
plot(lenth:lenth+times-1,rec_tf(:,1),'g-o');
legend('orignal','prediction','left-shifted');
title(strcat('pred == ',num2str(1,'%2.2d')));
如何人工神经网络来预测下一个数值???
untitled.jpg如何人工神经网络来预测下一个数值???-1
untitled.jpg



[ Last edited by gohomeba on 2014-3-6 at 10:04 ]
回复此楼

» 本帖附件资源列表

  • 欢迎监督和反馈:小木虫仅提供交流平台,不对该内容负责。
    本内容由用户自主发布,如果其内容涉及到知识产权问题,其责任在于用户本人,如对版权有异议,请联系邮箱:xiaomuchong@tal.com
  • 附件 1 : ttt.mat
  • 2014-03-06 10:04:01, 8.26 K

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

gohomeba

新虫 (初入文坛)

引用回帖:
2楼: Originally posted by gohomeba at 2014-03-10 11:23:11
顶顶

顶顶!

[ 发自小木虫客户端 ]
3楼2014-03-11 23:52:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 9 个回答

gohomeba

新虫 (初入文坛)

引用回帖:
4楼: Originally posted by gohomeba at 2014-03-12 20:48:40
顶顶

继续顶!

[ 发自小木虫客户端 ]
5楼2014-03-24 12:16:24
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

gohomeba

新虫 (初入文坛)

引用回帖:
5楼: Originally posted by gohomeba at 2014-03-24 12:16:24
继续顶!
...

继续顶!

[ 发自小木虫客户端 ]
6楼2014-03-28 12:22:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

alexwolf001

新虫 (初入文坛)

楼主。。。什么叫没有体现出预测来~你是觉着预测没效果?还是别的?
7楼2014-10-03 13:43:56
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见