how can i changhe the transfer function of output layer of neural network?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
mehdi
am 16 Aug. 2013
Kommentiert: Christina Sivoronov
am 3 Mai 2021
i want to change the transfer function of output layer from purelin(difult) to other function like hardlim. i khow that i could use "net.layers{1}.transferFcn='tansig'" for layers but how could change the output?
0 Kommentare
Akzeptierte Antwort
Greg Heath
am 17 Aug. 2013
With obsolete (since 2010b) nets like newfit for regression/curve-fitting and newpr for classification/pattern-recognition (both call newff), you can specify the transfer functions in the net creation statement. See
help newfit , help newpr
However, in their replacements fitnet and patternnet (both call feedforwardnet), you have to specify them as you have indicated. The default configurations are 2 layer nets with layer 2 containing the output transfer function.
I do not recommend using non-differentiable functions like hardlim and hardlims.
For best performance use scaled centered inputs via mapminmax, mapstd or zscore. The corresponding compatible hidden layer transfer function is the symmetric TANSIG (i.e., I do not recommend LOGSIG for hidden layers).
For fitnet, also use scaled centered outputs with PURELIN or TANSIG as output transfer functions.
For patternnet, outputs are desired to be consistent estimates of the input conditional class posterior probabilities. Therefore targets should be unit column vectors with the "1" in the row corresponding to the true class of the corresponding input. The corresponding output transfer function is LOGSIG.
help ind2vec , help vec2ind
net.layers{2}.transferFcn = 'logsig'
Hope this helps.
Thank you for formally accepting my answer
Greg
2 Kommentare
Christina Sivoronov
am 3 Mai 2021
Is it possible to have a simmilar approach for the hyperbolic tangent function ('tanh'). This approach seems to throw an error whilst doing so.
Weitere Antworten (1)
Hesam Jafarian
am 23 Mär. 2018
with NET.layers you can access to the network layers' property where you can set the transfer function layer {i} by using the following command :
net.layers{i}.transferFcn = 'something' ex: net.layers{1}.transferFcn = 'logsig'
note: for other networks not obsolete it works too for instance (fitnet)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Define Shallow Neural Network Architectures finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!