我的代码如下:
clear;
clc;
shuru=[1305554.51 662938.89 877648.23 955254.91 1182286.47 605157.99 769639.28 1000855.67 1567936.19 712892.06 995621.47 1210817.23 1824825.89 805095.78 1357303.95 1913573.98 2221913.29 988940.37 1520540.25;
-535933.67 -265478.17 -358139.96 -390311.91 -484727.57 -240666.79 -312753.06 -408491.77 -644476.31 -284092.72 -405644.61 -495278.31 -750743.05 -320627.06 -555553.68 -786731.21 -914786.21 -395704.62 -622816.59;
190253.14 97770.16 127640.62 138952.91 172150.18 89252.23 111812.5 145619.16 228386.33 105038.33 144834.43 176107.03 265871.87 118663.71 197368.22 278538.97 323968.44 145708.66 220970.77 ]'; %/(')for zhuanzhi
shuchu=[7510 7907 7432 6989 6760 7124 7548 7422 8333 8333 9375 11011 12045 13207 13592 13530 13963 15819 16118];
net = newff(minmax(shuru),[19,1],{'purelin','purelin'},'trainscg');
net.trainParam.show=50;%
net.trainParam.lr=0.05;
net.trainParam.epochs=800;
net.trainParam.goal=0.00000001;
[net,tr]=train(net,shuru,shuchu);
net.iw{1,1};%隐层权值
net.b{1};%隐层阈值
net.lw{2,1};%输出层权值
net.b{2};%输出层阈值
sim(net,shuru)
结果运行的时候总是说出现以下问题:
Warning: NEWFF used in an obsolete way.
> In obs_use at 18
In newff>create_network at 127
In newff at 102
See help for NEWFF to update calls to the new argument list.
Error using trainscg (line 104)
Inputs and targets have different numbers of samples.
Error in network/train (line 106)
[net,tr] = feval(net.trainFcn,net,X,T,Xi,Ai,EW,net.trainParam);
可是我检查过N遍输入层和输出层各变量都是19个啊,为什么会这样呢?求救~谢谢
感谢大神!请问接下来如果我要给出一组新的自变量看计算机按之前训练情况预测的因变量值是多少应该怎么做?
追答1、我上面的答案有点问题,就是19*3改成3*19,这样才是19列
2、对于新的输入如:newinput,你必须保证的你的newinput是一个3*n的数组
那么预测输出Predictoutput=sim(net,newinput),net是已经训练好的网络,Predictoutput将会是一个1*n的预测数组
好的,非常感谢!