Neural Network Transfer Function

70 次查看(过去 30 天)
James He
James He 2017-2-7
编辑: Greg Heath 2018-2-18
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

回答(2 个)

Greg Heath
Greg Heath 2018-2-18
编辑:Greg Heath 2018-2-18
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

Akshay Joshi
Akshay Joshi 2018-2-16
编辑:Akshay Joshi 2018-2-16
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.

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by