在MATLAB工具箱bp神经网络(1)和(2)中介绍了两个BP神经网络的训练函数,这里接着介绍第三个人工神经网络训练函数traingdx函数。
traingdx函数
traingdx函数结合了自适应改变学习速率和动量法,和traingda函数完全相同,只是增加了一个动量因子参数mc。
net=newff(minmax(P),[5,1],{'logsig','purelin'},'traingdx');在MATLAB命令行窗口中输入:
net.trainParam
ans =
epochs: 100
goal: 0
lr: 0.0100 %学习速率基值
lr_dec: 0.7000 %学习速率减少率
lr_inc: 1.0500 %学习速率增加率
max_fail: 5
max_perf_inc: 1.0400
mc: 0.9000 %动量因子
min_grad: 1.0000e-006
show: 25
time: Inf
net=newff(minmax(P),[5,1],{'logsig','purelin'},'traingdx');下图所示为traingdx函数bp神经网络训练过程曲线,测试样本的输出结果为:
net.trainParam.show = 50;
net.trainParam.lr = 0.1;
net.trainParam.lr_inc = 1.05;
net.trainParam.lr_dec = 0.85;
net.trainParam.mc = 0.9;
net.trainParam.epochs = 300;
net.trainParam.goal = 0.01;
[net,tr]=train(net,P,T);
%回代检验
A=sim(net,P);
%测试样本检验
a=sim(net,p);
TRAINGDX-calcgrad, Epoch 0/300, MSE 5.70591/0.01, Gradient 7.94678/1e-006
TRAINGDX-calcgrad, Epoch 50/300, MSE 0.0185869/0.01, Gradient 0.0617651/1e-006
TRAINGDX-calcgrad, Epoch 72/300, MSE 0.00997184/0.01, Gradient 0.0194848/1e-006
TRAINGDX, Performance goal met.
a =
0.5880 0.6223 0.5236
More details could be found in my published book:
MATLAB编程基础与典型应用
北京:人民邮电出版社,2008
ISBN:978-7-115-17932-6/TP
Pls contact me with Email:lhd06@mails.tsinghua.edu.cn
更多MATLAB资源,欢迎访问:
No comments:
Post a Comment