9层隐含层BP神经网络MATLAB程序(旅游环境容量的预测,由过去数据预测未来年份环境容量),在下面T=[?](T,输出量,)中,因该怎样选择T内的值?P(输入量,)因该如何选取?运行结果见程序下面。

close all

clear

echo on

pause

clc

P=[489578 459620 337362 441262 462313;459620 337362 441262 462313 504276;337362 441262 462313 504276 507243;441262 462313 504276 507243 591853;462313 504276 507243 591853 707148;504276 507243 591853 707148 819438 ;507243 591853 707148 819438 1056266;591853 707148 819438 1056266 861163;707148 819438 1056266 861163 1234063;819438 1056266 861163 1234063 1513585;1056266 861163 1234063 1513585 1820171;861163 1234063 1513585 1820171 2085997;1234063 1513585 1820171 2085997 2213329;1513585 1820171 2085997 2213329 2304045;1820171 2085997 2213329 2304045 2757147;2085997 2213329 2304045 2757147 3063140];

T=[?];

pause;

clc

net=newff(minmax(P),[9,1],{'tansig','purelin'},'traingdm')

inputWeights=net.IW{1,1}

inputbias=net.b{1}

layerWeights=net.LW{2,1}

layerbias=net.b{2}

pause

clc

net.trainParam.show=50;

net.trainParam.lr=0.01;

net.trainParam.mc=0.9;

net.trainParam.epochs=30000;

net.trainParam.goal=1e-3;

pause

clc

[net,tr]=train(net,P,T);

pause

clc

A=sim(net,P)

E=T-A

MSE=mse(E)

pause

clc

x=[1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16];

figure;

plot(x,T,'*r',x,A,'ob')

%axis([0 5 -1.5 1.5]);

clc

echo off

运行结果:请问是哪里错了?

net=newff(minmax(P),[9,1],{'tansig','purelin'},'traingdm')

net =

Neural Network object:

architecture:

numInputs: 1

numLayers: 2

biasConnect: [1; 1]

inputConnect: [1; 0]

layerConnect: [0 0; 1 0]

outputConnect: [0 1]

targetConnect: [0 1]

numOutputs: 1  (read-only)

numTargets: 1  (read-only)

numInputDelays: 0  (read-only)

numLayerDelays: 0  (read-only)

subobject structures:

inputs: {1x1 cell} of inputs

layers: {2x1 cell} of layers

outputs: {1x2 cell} containing 1 output

targets: {1x2 cell} containing 1 target

biases: {2x1 cell} containing 2 biases

inputWeights: {2x1 cell} containing 1 input weight

layerWeights: {2x2 cell} containing 1 layer weight

functions:

adaptFcn: 'trains'

initFcn: 'initlay'

performFcn: 'mse'

trainFcn: 'traingdm'

parameters:

adaptParam: .passes

initParam: (none)

performParam: (none)

trainParam: .epochs, .goal, .lr, .max_fail,

.mc, .min_grad, .show, .time

weight and bias values:

IW: {2x1 cell} containing 1 input weight matrix

LW: {2x2 cell} containing 1 layer weight matrix

b: {2x1 cell} containing 2 bias vectors

other:

userdata: (user stuff)

inputWeights=net.IW{1,1}

inputWeights =

1.0e-004 *

Columns 1 through 9

0.0180    0.0201   -0.0328   -0.0628   -0.0083   -0.0379   -0.0010   -0.0228   -0.0145

0.0112    0.0831   -0.0279    0.0937   -0.0184    0.0073   -0.0088    0.0186    0.0065

-0.0689    0.0220   -0.0665    0.0025    0.0432   -0.0105    0.0125   -0.0277    0.0222

0.0296    0.0588    0.0087    0.1013    0.0229    0.0306   -0.0074    0.0073   -0.0150

-0.0093   -0.0096    0.0491   -0.0624    0.0467    0.0232    0.0181    0.0244    0.0007

-0.0699    0.0708   -0.0513   -0.0736   -0.0338   -0.0091   -0.0142   -0.0054    0.0064

-0.0276   -0.0810   -0.0647   -0.0266    0.0340   -0.0263   -0.0080    0.0167   -0.0063

-0.0499    0.0050   -0.0770   -0.0175   -0.0156   -0.0151    0.0230    0.0120   -0.0008

0.0780    0.0076    0.0533   -0.0183   -0.0052    0.0415    0.0008    0.0288    0.0133

Columns 10 through 16

-0.0139   -0.0036    0.0081   -0.0121   -0.0027    0.0086    0.0131

-0.0241   -0.0066    0.0060   -0.0008   -0.0096   -0.0049   -0.0052

-0.0048    0.0074    0.0054   -0.0108   -0.0069   -0.0054    0.0061

0.0092   -0.0070    0.0128    0.0050    0.0106   -0.0045    0.0050

0.0156   -0.0083   -0.0020    0.0114   -0.0126    0.0055    0.0046

-0.0008    0.0049   -0.0074   -0.0011   -0.0131   -0.0087   -0.0124

-0.0179   -0.0082    0.0061    0.0013    0.0094    0.0112    0.0053

-0.0007   -0.0013    0.0099   -0.0134    0.0101   -0.0011    0.0138

0.0179    0.0100   -0.0075   -0.0002    0.0056    0.0066    0.0032

inputbias=net.b{1}

inputbias =

5.9734

-2.4617

4.3166

-16.7995

-8.2167

17.3879

3.8298

-0.1247

-15.1185

layerWeights=net.LW{2,1}

layerWeights =

0.5659   -0.9937    0.5939    0.2836   -0.6430    0.0588   -0.5625    0.0961   -0.8835

layerbias=net.b{2}

layerbias =

0.1752

pause

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐