Neural Network Transfer Function

72 vues (au cours des 30 derniers jours)
James He
James He le 7 Fév 2017
Modifié(e) : Greg Heath le 18 Fév 2018
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

Réponses (2)

Greg Heath
Greg Heath le 18 Fév 2018
Modifié(e) : Greg Heath le 18 Fév 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

Akshay Joshi
Akshay Joshi le 16 Fév 2018
Modifié(e) : Akshay Joshi le 16 Fév 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.

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by