当前位置: 首页 > news >正文

应用了归一化的预测

应用了归一化的预测,在归一化的过程中使用了premnmx和postmnmx,并在最后给出了这两个函数的应用情况。

%应用了归一化的预测 clc; clear; originalData=rands(20,14); inputSampledata=originalData'; outputData=rands(20,1); outputSampledata=outputData'; % creating neural network and setting trainging parameters gwwnet=newff(minmax(inputSampledata),[4,1],{'tansig','purelin'},'traingdm'); gwwnet.trainParam.show = 50; gwwnet.trainParam.lr = 0.05; gwwnet.trainParam.epochs = 5000; gwwnet.trainParam.goal = 1e-3; [input,mininput,maxinput,output,minoutput,maxoutput] = premnmx(inputSampledata,outputSampledata); % Preprocess data so that minimum is -1 and maximum is 1 % % Examples % % Here is the code to normalize a given data set so that the inputs % and targets will fall in the range [-1,1]. % p = [-10 -7.5 -5 -2.5 0 2.5 5 7.5 10]; % t = [0 7.07 -10 -7.07 0 7.07 10 7.07 0]; % [pn,minp,maxp,tn,mint,maxt] = premnmx(p,t); % % If you just want to normalize the input, [pn,minp,maxp] = premnmx(p); % % Algorithm % pn = 2*(p-minp)/(maxp-minp) - 1; [gwwnet,tr]=train(gwwnet,input,output); y=sim(gwwnet,input); %data offset (converting the network output data to it original unit) nnoutput = postmnmx(y,minoutput,maxoutput); % % Postprocess data that has been preprocessed by premnmx % Syntax % % [P,T] = postmnmx(PN,minp,maxp,TN,mint,maxt) % [p] = postmnmx(PN,minp,maxp) % Description % % postmnmx postprocesses the network training set % that was preprocessed by premnmx. It converts the data % back into unnormalized units. % postmnmx takes these inputs, % PN -- R x Q matrix of normalized input vectors % minp -- R x 1 vector containing minimums for each P % maxp -- R x 1 vector containing maximums for each P % TN -- S x Q matrix of normalized target vectors % mint -- S x 1 vector containing minimums for each T % maxt -- S x 1 vector containing maximums for each T % and returns, % P -- R x Q matrix of input (column) vectors % T -- R x Q matrix of target vectors % Examples % % In this example we normalize a set of training data with premnmx, % create and train a network using the normalized data, simulate the network, % unnormalize the output of the network using postmnmx, % and perform a linear regression between % the network outputs (unnormalized) and the targets % to check the quality of the network training. % p = [-0.92 0.73 -0.47 0.74 0.29; -0.08 0.86 -0.67 -0.52 0.93]; % t = [-0.08 3.4 -0.82 0.69 3.1]; % [pn,minp,maxp,tn,mint,maxt] = premnmx(p,t); % net = newff(minmax(pn),[5 1],{'tansig' 'purelin'},'trainlm'); % net = train(net,pn,tn); % an = sim(net,pn); % [a] = postmnmx(an,mint,maxt); % [m,b,r] = postreg(a,t); % % Algorithm % p = 0.5(pn+1)*(maxp-minp) + minp; %plot time=1:1:20; plot(time,outputSampledata,'-v',time,nnoutput,'o'); legend('actual output','NN output'); xlabel('time');ylabel('Learning fitting curve'); %scenario1 forecasting process column=10; for i=1:column; SceInput(1,i)=inputSampledata(1,20)*(1.0464^i); SceInput(2,i)=inputSampledata(2,20)*(1.0631^i); SceInput(3,i)=inputSampledata(3,20)*(1.0872^i); SceInput(4,i)=inputSampledata(4,20)*(1.2044^i); SceInput(5,i)=inputSampledata(5,20)*(1.2326^i); SceInput(6,i)=inputSampledata(6,20)*(1.0605^i); SceInput(7,i)=2*(1.01^i); SceInput(8,i)=42*(1.02^i); SceInput(9,i)=inputSampledata(9,20)*(1.1426^i); SceInput(10,i)=inputSampledata(10,20)*(1.017^i); SceInput(11,i)=inputSampledata(11,20)*(1.0205^i); SceInput(12,i)=inputSampledata(12,20)*(1.1336^i); SceInput(13,i)=inputSampledata(13,20)*(1.1599^i); SceInput(14,i)=inputSampledata(14,20)*(1.1783^i); end for j=1:20; for i=1:14; recalldata(i,j)=inputSampledata(i,j); end end for j=21:30; for i=1:14; recalldata(i,j)=SceInput(i,j-20) end end [alterinput,mininput,maxinput] = premnmx(recalldata); %training fvalue=sim(gwwnet,alterinput); %data offset (converting the network output data to it original unit) forecastvalue = postmnmx(fvalue,minoutput,maxoutput); %plot % waitforbuttonpress; % % Wait for key or mouse button press % Syntax % k = waitforbuttonpress % % Description % % k = waitforbuttonpress blocks the caller's execution stream % until the function detects that the user has pressed a mouse button % or a key while the figure window is active. The function returns 0 % if it detects a mouse button press 1 if it detects a key press % % Example % % These statements display text in the Command Window % when the user either clicks a mouse button or % types a key in the figure window: % w = waitforbuttonpress; % if w == 0 % disp('Button press') % else % disp('Key press') % end % clf; figure; time1=1:1:30; time2=1:1:20; plot(time1,forecastvalue,'r-',time2,outputSampledata,'-'); legend('预测曲线','实际曲线'); title('曲线'); xlabel('时间');ylabel('量'); %%%%%%%premnmx及postmnmx使用说明 % clc; % clear; % p = [1 2 3 4; % 5 6 8 9 ]; % [p1 pmin pmax]=premnmx(p); % p2=postmnmx(p1,pmin,pmax); % p1 % pmin % pmax % p2 % % p1 = % % -1.0000 -0.3333 0.3333 1.0000 % -1.0000 -0.5000 0.5000 1.0000 % % % pmin = % % 1 % 5 % % % pmax = % % 4 % 9 % % % p2 = % % 1 2 3 4 % 5 6 8 9

相关文章:

  • 【原创】《时代》周刊杂志2006年度人物“颁奖词”节译
  • 最简单的径向基网络
  • [导入]MsAjax Lib- Array.indexOf 函数
  • RBF预测模型
  • 软件架构训练之层次及使用
  • 解析phpwind团购模块实现
  • ASP.NET生成静态HTML页面
  • C#自定义结构的强制转换
  • 换上你的右脑袋(zz)
  • 动态添加页面的BODY OnLoad事件
  • 男人眼泪中的Ruby(二)
  • oracle序列生成器(sequence)使用的一点小注意
  • javax.servlet.ServletResponse接口(协议无关版本)
  • [导入]ListBox绑定数据,从左边移到右边的ListBox
  • ASP与数据库应用(给初学者)
  • 2019.2.20 c++ 知识梳理
  • Druid 在有赞的实践
  • laravel5.5 视图共享数据
  • leetcode378. Kth Smallest Element in a Sorted Matrix
  • LeetCode刷题——29. Divide Two Integers(Part 1靠自己)
  • python_bomb----数据类型总结
  • SSH 免密登录
  • 三栏布局总结
  • 思维导图—你不知道的JavaScript中卷
  • 译有关态射的一切
  • 新年再起“裁员潮”,“钢铁侠”马斯克要一举裁掉SpaceX 600余名员工 ...
  • 移动端高清、多屏适配方案
  • ​sqlite3 --- SQLite 数据库 DB-API 2.0 接口模块​
  • ​Z时代时尚SUV新宠:起亚赛图斯值不值得年轻人买?
  • !$boo在php中什么意思,php前戏
  • (0)Nginx 功能特性
  • (2)MFC+openGL单文档框架glFrame
  • (solr系列:一)使用tomcat部署solr服务
  • (二)换源+apt-get基础配置+搜狗拼音
  • (附源码)springboot青少年公共卫生教育平台 毕业设计 643214
  • ..回顾17,展望18
  • .NET HttpWebRequest、WebClient、HttpClient
  • .NET版Word处理控件Aspose.words功能演示:在ASP.NET MVC中创建MS Word编辑器
  • .Net的DataSet直接与SQL2005交互
  • .NET企业级应用架构设计系列之开场白
  • .NET中GET与SET的用法
  • .project文件
  • @test注解_Spring 自定义注解你了解过吗?
  • [《百万宝贝》观后]To be or not to be?
  • [C#基础]说说lock到底锁谁?
  • [C#小技巧]如何捕捉上升沿和下降沿
  • [CISCN 2023 初赛]go_session
  • [ffmpeg] 定制滤波器
  • [flask] flask的基本介绍、flask快速搭建项目并运行
  • [FTP]pureftp部署和优化
  • [Godot] 3D拾取
  • [JS] node.js 入门
  • [Loadrunner参数化]一个文件输两列参数的取值
  • [Node.js]连接mongodb
  • [one_demo_1]php中的文件锁