In neural network, how can I change the sigmoid activation function to a Gaussian one, How to modify the Matlab codes to achieve this?

1 次查看(过去 30 天)
that is, change this function: a = tansig(n) = 2/(1+exp(-2*n))-1 to a = gauss(n) = exp(-(n.^2))

采纳的回答

Greg Heath
Greg Heath 2015-6-6
net = fitnet;
net.layers{1}.transferFcn = 'radbas';
Hope this helps.
Thank you for formally accepting my answer
Greg
  3 个评论
Jay Wong
Jay Wong 2015-6-6
If I want to set this activation function at the hidden layer (only have one hidden layer), do I just need to change the codes to net.layers{2}.transferFcn = 'radbas'
Jet Yu
Jet Yu 2019-4-12
looks type in
net.layers{1}.transferFcn = 'radbas';
would NOT work in R2018a version for bug below
Error using network/subsasgn>network_subsasgn (line 166)
Attempt to assign cell array as a double array.
Error in network/subsasgn (line 14)
net = network_subsasgn(net,subscripts,v,netname);
Even i change as to fix the data type
net.layers(1).transferFcn(1,:) = cellstr('radbas')
error still
Error using network/subsasgn>network_subsasgn (line 166)
Attempt to assign cell array as a double array.
Error in network/subsasgn (line 14)
net = network_subsasgn(net,subscripts,v,netname);
Any way to fix it?
Best

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by