MATLAB神经网络及其应用课件_第1页
MATLAB神经网络及其应用课件_第2页
MATLAB神经网络及其应用课件_第3页
MATLAB神经网络及其应用课件_第4页
MATLAB神经网络及其应用课件_第5页
已阅读5页,还剩19页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、MATLAB神经网络及其应用1MATLAB中的神经网络及其应用:以BP为例主讲:王茂芝 副教授MATLAB神经网络及其应用21 一个预测问题已知:一组标准输入和输出数据(见附件)求解:预测另外一组输入对应的输出背景:略MATLAB神经网络及其应用32 BP网络MATLAB神经网络及其应用43 MATLAB中的newff命令NEWFF Create a feed-forward backpropagation network.Syntaxnet = newffnet = newff(PR,S1 S2.SNl,TF1 TF2.TFNl,BTF,BLF,PF)MATLAB神经网络及其应用5命令new

2、ff中的参数说明 NET = NEWFF creates a new network with a dialog box.NEWFF(PR,S1 S2.SNl,TF1 TF2.TFNl,BTF,BLF,PF) takes,PR - Rx2 matrix of min and max values for R input elements.Si - Size of ith layer, for Nl layers.TFi - Transfer function of ith layer, default = tansig.BTF - Backprop network training funct

3、ion, default = trainlm.BLF - Backprop weight/bias learning function, default = learngdm.PF - Performance function, default = mse.and returns an N layer feed-forward backprop network.MATLAB神经网络及其应用6参数说明 The transfer functions TFi can be any differentiable transfer function such as TANSIG, LOGSIG, or

4、PURELIN.The training function BTF can be any of the backprop training functions such as TRAINLM, TRAINBFG, TRAINRP, TRAINGD, etc.MATLAB神经网络及其应用7参数说明*WARNING*: TRAINLM is the default training function because it is very fast, but it requires a lot of memory to run. If you get an out-of-memory error w

5、hen training try doing one of these:(1) Slow TRAINLM training, but reduce memory requirements, by setting NET.trainParam.mem_reduc to 2 or more. (See HELP TRAINLM.)(2) Use TRAINBFG, which is slower but more memory efficient than TRAINLM. (3) Use TRAINRP which is slower but more memory efficient than

6、 TRAINBFG.MATLAB神经网络及其应用8参数说明 The learning function BLF can be either of the backpropagation learning functions such as LEARNGD, or LEARNGDM.The performance function can be any of the differentiable performance functions such as MSE or MSEREG.MATLAB神经网络及其应用94 MATLAB中的train命令TRAIN Train a neural netw

7、ork.Syntaxnet,tr,Y,E,Pf,Af = train(NET,P,T,Pi,Ai,VV,TV)DescriptionTRAIN trains a network NET according to NET.trainFcn and NET.trainParam.MATLAB神经网络及其应用10输入参数说明 TRAIN(NET,P,T,Pi,Ai) takes,NET - Network.P - Network inputs.T - Network targets, default = zeros.Pi - Initial input delay conditions, defau

8、lt = zeros.Ai - Initial layer delay conditions, default = zeros.VV - Structure of validation vectors, default = .TV - Structure of test vectors, default = .MATLAB神经网络及其应用11输出参数说明and returns,NET - New network.TR - Training record (epoch and perf).Y - Network outputs.E - Network errors.Pf - Final inpu

9、t delay conditions.Af - Final layer delay conditions.MATLAB神经网络及其应用12说明 Note that T is optional and need only be used for networks that require targets. Pi and Pf are also optional and need only be used for networks that have input or layer delays.MATLAB神经网络及其应用13输入参数数据结构说明 The cell array format is

10、easiest to describe. It is most convenient for networks with multiple inputs and outputs, and allows sequences of inputs to be presented:P - NixTS cell array, each element Pi,ts is an RixQ matrix.T - NtxTS cell array, each element Pi,ts is an VixQ matrix.Pi - NixID cell array, each element Pii,k is

11、an RixQ matrix.Ai - NlxLD cell array, each element Aii,k is an SixQ matrix.Y - NOxTS cell array, each element Yi,ts is an UixQ matrix.E - NtxTS cell array, each element Pi,ts is an VixQ matrix.Pf - NixID cell array, each element Pfi,k is an RixQ matrix.Af - NlxLD cell array, each element Afi,k is an

12、 SixQ matrix.MATLAB神经网络及其应用14输入参数数据结构说明Where:Ni = net.numInputsNl = net.numLayersNt = net.numTargetsID = net.numInputDelaysLD = net.numLayerDelaysTS = number of time stepsQ = batch sizeRi = net.inputsi.sizeSi = net.layersi.sizeVi = net.targetsi.sizeMATLAB神经网络及其应用155 实现数据处理和准备把WORD数据转换成TXT文件格式利用dlmre

13、ad读取数据是否进行归一化处理?MATLAB神经网络及其应用16生成网络为调用newff命令做好各种准备 pr矩阵的形成网络结构确定:网络层数以及每层的神经元个数每一层的传输函数的确定注意参数的含义MATLAB神经网络及其应用17进行网络训练为调用train命令进行数据准备输入样本的确定标准输出的确定网络训练参数(次数)的确定 net. trainParam.epochs=100调用网络训练命令:net=train(net,p,t);MATLAB神经网络及其应用18进行输出模拟 调用y=sim(net,p)进行输出模拟画图进行对比MATLAB神经网络及其应用19查看网络参数及权值 net ne

14、t参数引用和查看MATLAB神经网络及其应用206 预测及分析 sim输出 重新训练并sim输出 画图对比MATLAB神经网络及其应用217 程序实现clcclear allclear netload data;load data_pre;c1=in(:,1);c2=in(:,2);c3=in(:,3);c4=in(:,4);c5=in(:,5);c6=in(:,6);c7=in(:,7);c8=in(:,8);c1_max=max(c1);c2_max=max(c2);c3_max=max(c3);c4_max=max(c4);c5_max=max(c5);c6_max=max(c6);c7

15、_max=max(c7);c8_max=max(c8);MATLAB神经网络及其应用22续% c1=c1/c1_max;% c2=c2/c2_max;% c3=c3/c3_max;% c4=c4/c4_max;% c5=c5/c5_max;% c6=c6/c6_max;% c7=c7/c7_max;% c8=c8/c8_max;% % in(:,1)=c1;% in(:,2)=c2;% in(:,3)=c3;% in(:,4)=c4;% in(:,5)=c5;% in(:,6)=c6;% in(:,7)=c7;% in(:,8)=c8;% MATLAB神经网络及其应用23续% c1_max=max(c1);c1_min=min(c1);% c2_max=max(c2); c2_min=min(c2);% c3_max=max(c3); c3_min=min(c3);% c4_max=max(c4); c4_min=min(c4);% c5_max=max(c5); c5_min=min(c5);% c6_max=max(c6); c6_min=min(c6);% c7_max=max(c7); c7_min=min(c7);% c8_max=max(c8); c8_min=min(c8);MATLAB神经网络及其应用24续pr=c

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论