Neural Network Transfer Function
55 views (last 30 days)
Show older comments
Hi friends,
I was using neural network to train a set of sensing data. The transfer function is designed to be 'logsig'. The input is a n*4 matrix values between 0 to 3, output is a n*3 matrix values between 0 to 10.
The training process is normal. But after we have the resultant network, when applying, output values are no less than 5 which is the average of my target output. That is to say, for all values supposed to be lower than 5, it returns 5.
Code will be the following: net1=feedforwardnet([80,80]); net1.trainParam.max_fail=10; net1.layers{3}.transferFcn='logsig'; net1.layers{1}.transferFcn='logsig'; net1.layers{2}.transferFcn='logsig'; net1=train(net1,transpose(det),transpose(pos));
Thank you all in advance.
Yichang
0 Comments
Answers (2)
Greg Heath
on 18 Feb 2018
Edited: Greg Heath
on 18 Feb 2018
There is no good reason to differ from the default
help fitnet % Form of feedforwardnet for regression & curvefitting)
doc fitnet
given matrix sizes
[ I N ] = size(input) % [ 4 N ]
[ O N ] = size(target) % [ 3 N ]
Default number of training equations
Ntrneq = 0.7*N*O = 2.1*N
and number of unknown weights for a single hidden layer with H nodes yielding Nw unknown weights and biases
Nw = (I+1)*H+(H+1)*O = (4+1+3)*H + 3 = 8*H+3
For more training equations than unknowns
Ntrneq >= Nw
or
H <= (Ntrneq -O) /( I + O +1)=(2.1*N-3)/8
Therefore, the default value of H = 10 can be used if
N >= 40 .
Hope this helps.
Thank you for formally accepting my answer
Greg
0 Comments
Akshay Joshi
on 16 Feb 2018
Edited: Akshay Joshi
on 16 Feb 2018
Try the following:
net1.layers{1}.transferFcn='logsig';
net1.layers{2}.transferFcn='logsig';
net1.layers{3}.transferFcn='purelin'
In many cases, using non-linear function for classification at hidden layer, and then using linear function at output layer yields a proper, classified output data.
0 Comments
See Also
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!