新版Matlab中神经网络训练函数Newff的使用方法
介绍新版newff
Syntax
net = newff(P,T,[S1 S2...S(N-l)],{TF1 TF2...TFNl}, BTF,BLF,PF,IPF,OPF,DDF)
Description
newff(P,T,[S1 S2...S(N-l)],{TF1 TF2...TFNl}, BTF,BLF,PF,IPF,OPF,DDF) takes several arguments
PR x Q1 matrix of Q1 sample R-element input vectorsTSN x Q2 matrix of Q2 sample SN-element target vectorsSiSize of ith layer, for N-1 layers, default = [ ].(Output layer size SN is determined from T.)TFiTransfer function of ith layer. (Default = 'tansig' forhidden layers and 'purelin' for output layer.)BTFBackpropagation network training function (default = 'trainlm')BLFBackpropagation weight/bias learning function (default = 'learngdm')IPFRow cell array of input processing functions. (Default = {'fixunknowns','removeconstantrows','mapminmax'})OPFRow cell array of output processing functions. (Default = {'removeconstantrows','mapminmax'})DDFData divison function (default = 'dividerand')
Examples
Here is a problem consisting of inputs P and targets T to be solved with a network.
P = [0 1 2 3 4 5 6 7 8 9 10];T = [0 1 2 3 4 3 2 1 2 3 4];
Here a network is created with one hidden layer of five neurons.
net = newff(P,T,5);
The network is simulated and its output plotted against the targets.
Y = sim(net,P);plot(P,T,P,Y,'o')
The network is trained for 50 epochs. Again the network's output is plotted.
net.trainParam.epochs = 50;net = train(net,P,T);Y = sim(net,P);plot(P,T,P,Y,'o')
新版newff与旧版newff调用语法对比
Example1
比如输入input(6*1000),输出output为(4*1000),那么
旧版定义:net=newff(minmax(input),[7,1],{'tansig','purelin'},'trainlm');
新版定义:net=newff(input,output,7,{'tansig','purelin'},'trainlm');
Example2
比如输入input(6*1000),输出output为(4*1000),那么
旧版定义:net=newff(minmax(input),[49,10,1],{'tansig','tansig','tansig'},'traingdx');
新版定义:net=newff(input,output, [49,10], {'tansig','tansig','tansig'},'traingdx');
旧版newff使用方法在新版本中使用
提示:旧版本定义的newff虽也能在新版本中使用,但会有警告,警告如下:
Warning: NEWFF used in an obsolete way. > In obs_use at 18??In newff>crea