[小学教育]在Matlab6x中构建BP课件.ppt

上传人(卖家):晟晟文业 文档编号:4066889 上传时间:2022-11-08 格式:PPT 页数:31 大小:89.71KB
下载 相关 举报
[小学教育]在Matlab6x中构建BP课件.ppt_第1页
第1页 / 共31页
[小学教育]在Matlab6x中构建BP课件.ppt_第2页
第2页 / 共31页
[小学教育]在Matlab6x中构建BP课件.ppt_第3页
第3页 / 共31页
[小学教育]在Matlab6x中构建BP课件.ppt_第4页
第4页 / 共31页
[小学教育]在Matlab6x中构建BP课件.ppt_第5页
第5页 / 共31页
点击查看更多>>
资源描述

1、lBP网络建立lBP训练算法选取l训练数据的前期处理l提高BP网络泛化能力l检验BP网络的方法l1.网络的输入输出数据结构(m维输入n维输出)l a.只有一个样本时l Input=P1,P2,Pm l m by 1列向量l Output=O1,O2,Onl n by 1列向量 lb.有s个样本的时候l 输入 Input 是 m by s矩阵 每个列向量为一个输入向量.l 输出 Output 是 n by s矩阵每个列向量为一个输出.l2.网络结构(一般3层网络够用)l 输入层单元数:ml 输出层单元数:nl 隐层单元数h确定原则:在满足训练精度的情况下越少越好,以防止过拟合情况.l3.网络权值

2、(weight)与阈值(bias)数据结构l 输入层与隐层之间连接权矩阵W1是 m by h 矩阵其中W1第i行表示第i个输入单元与隐层单元间的连接权l 隐层与输出层之间连接权矩阵W2是ln by h 矩阵其中第j行表示第j个输出单元与隐层单元间连接权.l4.各层传递函数选择:l 输入层 隐层 输出层l a.输入层:起着将输入传递到各隐层单元因此没有传递函数l b.隐层:能够拟合非线性函数的关键,应该 是个单调非减函数,Matlab中提供三种传递函数 longsig(0,1),tansig(-1,1)和purelinl c.输出层:可以采用logsig 与 tansig,或者purelin.(

3、最好purelin:1.小样本 2.无需归一划)l5.最简便的构建方法 newff(三层为例)lnet=newff(PR,S1 S2 S3,TF2 TF3,BTF,BLF,PF)l PR:m by 2 矩阵第i行表示第i维输入的取值范围.l Si:第i层单元个数l TFi:i层传递函数 default=tansig BTF:网络训练函数default=trainlml BLF:权值/阈值学习函数 default=learngdml 此时网络权值以及偏置项已经采用Nguyen-Widrow layer initialization method初始化完毕.lPF:性能函数 default=mse

4、 均方误差和l为什么BTF与BLF不同:l BTF:得到dWi,dBil BLF:更新 Wi,Bil6.关于得到的网络 net 的问题l a.是个object,所含内容l .iw,net.lw,net.b是cell型数据l c.训练算法及参数:net.trainParam.1.LM算法的一些注意事项:TRAINLM 由于速度很快所以是默认的算法,但是很消耗内存.l 原因:储存一个 s by m的Jacobi 矩阵,当样本数目s很大的时候导致耗费内存过多.l解决方案:lBogdan M.Wilamowski 的l An Algorithm for Fast Convergence in Trai

5、ning Neural Networksl l Levenberg Marquadt算法主要解决非线性最小二乘问题.l 使用trainlm时如果有“out-of-memory”错误提示的时候应采用如下步骤:l(1)通过设置 net.trainParam.mem_reduc 来减少对内存的需求.设置mem_reduc 为 2,再重新训练一次.如果仍然出现内存不足的情况增加 mem_reduc的值,由于 a significant computational overhead is associated with computing the Jacobian in sub-matrices但是运行

6、时间也会随之增加.l参数意义如下:l If mem_reduc is set to 1,then the full Jacobian is omputed,and no memory reduction is achieved.If mem_reduc is set to 2,then only half of the Jacobian will be computed at one time.This saves half of the memory used by the calculation of the full Jacobian.l (2)Use TRAINBFG,which is

7、 slower but more memory efficient than TRAINLM.l (3)Use TRAINRP which is slower but more memory efficient than TRAINBFG.Acronym AlgorithmtrainlmLevenberg-MarquardttrainbfgBFGS Quasi-NewtontrainrpResilient BackpropagationtrainscgScaled Conjugate GradienttraincgbConjugate Gradient with Powell/BealeRes

8、tartstraincgfFletcher-Powell Conjugate GradienttraincgpPolak-Ribire Conjugate GradienttrainossOne-Step SecanttraingdxVariable learning rate backpropagationlTrainlm:lGood:对于函数拟合问题,当网络只有几百个可调参数的时候,LM收敛最快.lBad:当网络的权值增加的时候LM的优点逐渐消失(消耗内存急剧增加).而且LM不适合与模式识别网络训练.lTrainrp:lGood:用来训练模式识别问题的网络收敛最快,而且消耗内迅也不多(训练

9、中只借用下降梯度的方向).lBad:函数拟合时效果不好.当接近极小点的时候性能下降.lTrainscg(推荐算法):l 在很多情况下效果都很好,尤其是对规模较大的网络.l 在函数拟合情况下几乎和LM算法一样快(对于较大的网络甚至更快),.在模式识别训练中和 trainrp 一样快.Its performance does not degrade as quickly as trainrp performance does when the error is reduced.l 共轭梯度法(conjugate gradient algorithms)对内存要求不是很高.lTrainbfg:l 性

10、能和 trainlm相近,但对内存要求较trainlm小.但该算法计算量随着网络规模的增加呈几何增长,since the equivalent of a matrix inverse must be computed at each iteration.lTraingdx:l 与其他算法比起来比较慢,内存要求和 trainrp相近.但是仍有其有用之处,有些场合下需要收敛慢的算法.For example,when using early stopping you may have inconsistent results if you use an algorithm that converge

11、s too quickly.You may overshoot the point at which the error on the validation set is minimized.l1.将输入和输出归一划到一定范围内l a.算术处理 l premnmx:得到-1,1的新数据l tramnmx:归一划新的输入l b.统计处理l prestd:得到平均值为0,标准差为1的新数据l poststd:将数据变换回去l 将 输入归一划到一定范围内的原因:l Sigmoid functions are characterized by the fact that their slope mus

12、t approach zero as the input gets large.This causes a problem when using steepest descent to train a multilayer network with sigmoid functions,since the gradient can have a very small magnitude;and therefore,cause small changes in the weights and biases,even though the weights and biases are far fro

13、m their optimal values.l2.主成分分析(PCA)l 当输入维数比较高,而且每一个输入向量的各分量之间相关性比较大的时候.使用主成分分析(principal component analysis)效果更好.l pn,meanp,stdp=prestd(p);l ptrans,transMat=prepca(pn,0.02);l 注意:当有新输入的时候,要先用trastd之然后再用得到的transMat将其PC提取出来l pnewn=trastd(pnew,meanp,stdp);l pnewtrans=trapca(pnewn,transMat);l a=sim(net,

14、pnewtrans);l1.过拟合与网络结构 即网络的训练误差很小(已经收敛),但是预测未学习过的样本时误差很大.网络记住了学习的样本,但是没有扩展能力(generalization).l 一个例子:学习识别什么是树的时候两种极端情况.l 如果网络的可调参数比训练样本数少的多的话,过拟合的可能性就小的多了.l2.解决方法:l a.控制网络规模:trainbrl 一般来说网络隐层节点数越多越容易收敛,但是也越容易过拟 合,所以应该使用规模合适的网络,trainbr可以自动做到这一点.trainbr 算法在输入和输出落在-1,1范围内时效果最好.l trainbr是在LM算法基础上改编的.l b.

15、Automated regularization(正则化):l net.performFcn=msereg;net.performParam.ratio=0.5(难以确定);l 修改网络的性能函数使得在减小MSE的同时也减小权值的绝对值大小,这会使得网络产生的曲线更加光滑因而过拟合可能性变小.21211mse=()N1msereg=mse+(1-)Niiinjjtamswwnmswlc.Early stopping:l 将训练数据分为两部分:training set(训练集)l validation set(验证集),每次迭代用training set 更新网络,然后用网络来预测validat

16、ion set并与更新前的网络预测误差比较,当发现预测validation set的误差开始上升的时候停止训练.(效果不如trainbr)l l推荐方法:trainbrl 在函数拟合的时候trainbr效果比early stopping更好,尤其是当训练数据比较少得时候.This is because Bayesian regularization does not require that a validation data set be separated out of the training data set.It uses all of the data.l注意事项:l a.在多种初

17、始化条件下训练网络.It is possible for either method to fail in certain circumstances.By testing several different initial conditions,you can verify robust network performance.l b.trainbr在用于模式识别的网络训练时效果不佳.l c.trainbr 更耗费时间l1.postreg的使用l 对于训练样本集(x,t)来说,假设训练得到的网络输出为a,m,b,r=postreg(a,t),这样得到线性回归模型l a=m*t+b,r为得到的这个线性回归模型的相关系数.l m,r 越接近于1,b越接近于0的时候得到的网络越好.l2.采用留一法等方法比较模型性能.l Evaluating machine learning models for engineering problems(Artificial Intelligence in Engineering 13(1999)257272 Yoram Reich)lDemobp1示例了如何综合以上过程lNnsample1 集中了以上过程用到的命令

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 办公、行业 > 各类PPT课件(模板)
版权提示 | 免责声明

1,本文([小学教育]在Matlab6x中构建BP课件.ppt)为本站会员(晟晟文业)主动上传,163文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。
2,用户下载本文档,所消耗的文币(积分)将全额增加到上传者的账号。
3, 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(发送邮件至3464097650@qq.com或直接QQ联系客服),我们立即给予删除!


侵权处理QQ:3464097650--上传资料QQ:3464097650

【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。


163文库-Www.163Wenku.Com |网站地图|