得到的输出都是一个数,而且和期望相差太远。
Mostra commenti meno recenti
clc; %清屏
clear all; %清除所有变量
p=[150 150 150 200 200 200 200 200
317 297 311 267 249 267 221 212
0.11 0.11 0.12 0.11 0.12 0.11 0.11 0.12
0.3765 0.3789 0.3109 0.4286 0.3777 0.3694 0.2692 0.2681
3.95 3.95 2.453 3.95 2.258 3.95 3.95 2.887];
t=[250 250 238 283 262 279 245 244];
[pn,ps]=mapstd(p);
[tn,ts]=mapstd(t);
net=newff(p,t,10,{'tansig','purelin'},'trainlm');
net=init(net);
net.trainparam.epochs=20000; %最大训练次数(前缺省为10,自trainrp后,缺省为100)
net.trainparam.lr=0.05; %学习率(缺省为0.01)
net.trainparam.show=25; %限时训练迭代过程(NaN表示不显示,缺省为25)
net.trainparam.goal=1e-8; %训练要求精度(缺省为0)
net.trainparam.max_fail=15; %最大失败次数(缺省为5)
%net.trainparam.min_grad 最小梯度要求(前缺省为1e-10,自trainrp后,缺省为1e-6)
%net.trainparam.time 最大训练时间(缺省为inf)
[net,tr]=train(net,p,t); %网络训练
V = net.iw{1,1}%输入层到中间层权值
theta1 = net.b{1}%中间层各神经元阈值
W = net.lw{2,1}%中间层到输出层权值
theta2 = net.b{2}%输出层各神经元阈值
pnew=[100 100 100 125 125 125 125 125 150 150 150 150 150 175 175 175 175 175 200 200 200 200 200
250 275 300 200 225 250 275 300 200 225 250 275 300 200 225 250 275 300 200 225 250 275 300
0.14 0.16 0.18 0.12 0.14 0.16 0.18 0.1 0.14 0.16 0.18 0.1 0.12 0.16 0.18 0.1 0.12 0.14 0.18 0.1 0.12 0.14 0.16
0.25 0.3 0.35 0.25 0.3 0.35 0.15 0.2 0.35 0.15 0.2 0.25 0.3 0.2 0.25 0.3 0.35 0.15 0.3 0.35 0.15 0.2 0.25
2 3 4 3 4 1 1.5 2 1.5 2 3 4 1 4 1 1.5 2 3 2 3 4 1 1.5];
pnewn=mapstd('apply',pnew,ps);
anewn=sim(net,pnewn); %对BP网络进行仿真
anew=mapstd('reverse',anewn,ts) %还原数据
得到的输出都是一个数,而且和期望相差太远,这是期望
250
233
259
239
250
238
283
262
279
261
268
256
245
244
245
254
麻烦大家了。
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su 初等数学 in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!