the use of Neural network training function newff in the new MATLAB
I. Introduction of the New 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
P |
R x Q1 matrix of Q1 sample r-element input vectors |
T |
SN x Q2 matrix of Q2 sample sn-element target vectors |
Si |
Size of ith layer, for N-1 layers, default = []. (Output layer size SN is determined from T.) |
TFi |
Transfer function of ith layer. (Default = ' Tansig ' for Hidden layers and ' purelin ' for output layer.) |
BTF |
BackPropagation Network training function (default = ' TRAINLM ') |
BLF |
BackPropagation Weight/bias Learning Function (default = ' LEARNGDM ') |
Ipf |
Row cell array of input processing functions. (Default = {' fixunknowns ', ' removeconstantrows ', ' Mapminmax '}) |
OPF |
Row cell array of output processing functions. (Default = {' Removeconstantrows ', ' Mapminmax '}) |
DDF |
Data divison Function (default = ' Dividerand ') |
Examples
Here are a problem consisting of inputs P and targets T to being 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's 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);p lot (p,t,p,y, ' O ')
The network is trained for epochs. Again the network s output is plotted.
· Net.trainParam.epochs = 50;net = Train (net,p,t); Y = Sim (net,p);p lot (p,t,p,y, ' O ')
second, the new version of NEWFF and older NEWFF call syntax comparison
Example1
For example, enter input (6*1000), Output is (4*1000), then
Legacy definitions: NET=NEWFF (Minmax (input), [14,4],{' Tansig ', ' Purelin '}, ' TRAINLM ');
New definition: net=newff (input,output,14,{' tansig ', ' Purelin '}, ' TRAINLM ');
Example2
For example, enter input (6*1000), Output is (4*1000), then
Legacy definitions: NET=NEWFF (Minmax (input), [49,14,4],{' Tansig ', ' tansig ', ' Tansig '}, ' Traingdx ');
New definition: NET=NEWFF (input,output, [49,14], {' Tansig ', ' tansig ', ' Tansig '}, ' Traingdx ');
third, the old version of the NEWFF use method in the new version
Hint: The old version of the defined NEWFF can also be used in the new version, but there will be warnings, warning as follows:
WARNING:NEWFF used in an obsolete.
> in Obs_use at 18
In Newff>create_network at 127
In NEWFF at 102
See NEWFF to update calls to the new argument list.
Four, the new version newff and the old edition NEWFF uses the training effect comparison
old version: old usage training many times, but high precision
new version: less training for new usage, but may not reach the required accuracy
This is caused by the following reasons:
The initial values of the weights and thresholds in the program are randomly assigned, so the results of each run will be different, good and bad.
You can use the weights and thresholds of the network that predict good results as the initial values.
You can view the values of net.iw{1,1}, net.lw{2,1}, Net.b{1}, net.b{2}.
now give a complete example
Percent empty environment variable
CLC
Clear
Percent training data forecast data
data=importdata (' test.txt ');
% randomly sorted from 1 to 768
K=rand (1,768);
[M,n]=sort (k);
% input/output data
Input=data (:, 1:8);
Output =data (:, 9);