24小时热门版块排行榜    

查看: 2932  |  回复: 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的回帖
9楼2019-12-27 11:35:56
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 9 个回答

gohomeba

新虫 (初入文坛)

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

顶顶!

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

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的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 基金啊基金 +3 longfie172 2026-08-20 3/150 2026-08-21 00:04 by wuchongjun
[基金申请] 科研孤儿太难了 +14 我4大白菜 2026-08-20 15/750 2026-08-20 22:33 by 袁向阳007
[基金申请] 让我中一个面上吧! +8 大萍1987 2026-08-20 10/500 2026-08-20 21:48 by 大萍1987
[基金申请] 言之凿凿,明天官网会通知放榜? +15 医学老男孩 2026-08-20 17/850 2026-08-20 20:35 by CaoLG
[基金申请] 时间戳又变了 +12 wuchongjun 2026-08-20 17/850 2026-08-20 20:05 by spzhao
[基金申请] 今天系统多次维护,明天很可能放榜! +10 zju2000 2026-08-16 11/550 2026-08-20 20:02 by cl479861084
[基金申请] 时间戳变了,能看出什么问题? +18 基诺咪客 2026-08-17 23/1150 2026-08-20 17:19 by Godzela
[基金申请] 放榜前的不淡定 40+3 snowwithsea 2026-08-19 12/600 2026-08-20 15:56 by lfy8008
[基金申请] 重要消息,中午系统在维护 +11 yuleib84 2026-08-18 12/600 2026-08-20 11:09 by xskun
[基金申请] 今天基金会出结果吗?20260819 +14 kkkl_v 2026-08-19 15/750 2026-08-20 08:21 by sunzitan
[基金申请] filecode,4个jtjc了 +11 ziyangfang 2026-08-19 13/650 2026-08-19 21:28 by aasahr
[教师之家] 为什么余额宝的年化利率越来越低?主要原因有哪些? +5 瞬息宇宙 2026-08-15 5/250 2026-08-19 20:23 by super2002521
[基金申请] 2027广东省杰青 +4 奶牛小黑 2026-08-15 10/500 2026-08-19 11:02 by wanfengnew
[基金申请] 朋友圈看到的 +6 wangzilk 2026-08-18 8/400 2026-08-19 10:55 by Haru815
[论文投稿] 投稿咨询 +4 wwm09 2026-08-17 6/300 2026-08-18 15:36 by wwm09
[基金申请] 时间戳又变了8-15 +14 archvillain 2026-08-15 26/1300 2026-08-18 13:37 by phantomgost
[基金申请] 93BebMhtakh前后11位开头都是大写 +4 且听虎啸 2026-08-17 5/250 2026-08-18 00:49 by 蔡棒棒菂
[基金申请] 感觉是下周放榜了 +6 angus9576 2026-08-17 11/550 2026-08-17 23:57 by angus9576
[精细化工] 招聘 金属平磨液,抛光液研发工程师 +3 小天0311 2026-08-14 3/150 2026-08-16 07:31 by H9PLUS
[基金申请] 各位道友,我要去昆明玩几天,回来见。 +7 Tide man 2026-08-14 8/400 2026-08-15 01:11 by arzu_hma
信息提示
请填处理意见