Neural Network toolbox - transferFcn and transferParam

I am trying to define a transfer function with parameters in the Neural network toolbox but I am not able to define the parameters correctly
What I did?
1. I copied the LOGSIG Logarithmic sigmoid transfer function file -my transfer function includes a factor in the exponent
2. I defined the parameter to receive as a real scalar with default value 1.0
function param = parameters, param = ...
[nnetParamInfo( 'alpha', ...
'alpha factor in the exponent', ...
'nntype.real_scalar', ...
1.0, ...
'alpha factor in the exponent')];
end
3. I include it in the 'apply' and 'da_dn' functions
function a = apply(n,param)
% The same as logsig but with alpha factor in the exponent
a = 1 ./ (1 + exp(-n * param.alpha));
i = find(~isfinite(a));
a(i) = sign(n(i));
end
4. I create the network and establish the alpha parameter
net = feedforwardnet([10, 10]);
% ... more initializations ...
net.layers{1}.transferParam.alpha = 1.1;
The LAST LINE raise this ERROR
??? Error using ==> param
Too many input arguments.
Error in ==> network.subsasgn>setLayerTransferParam at 1214
err = nntest.param(functionInfo.parameters,transferParam, ...
Any ideas? I did not find any good documentation / example about how to define a transfer function with parameters

4 comentarios

mladen
mladen el 29 de Mzo. de 2013
I am trying to do the same thing with another function, if I find a solution I'll let You know :)
Guru
Guru el 3 de Dic. de 2014
Same issue here. If someone has any solution for this problem, please help.
There is no problem worth talking about!!!
.. . Read my answer
Greg
Guru
Guru el 4 de Dic. de 2014
Editada: Guru el 4 de Dic. de 2014
Actually I don't want to train the network. I'm not using any training algorithms. Instead I'm varying the control parameter of the custom transfer function that I've written. My network is not exactly for the functionality traditionally used with neural networks. So I need to initialise this parameter for the transfer function and vary it based on the output.
This is what the error I'm runnign into,
Undefined function or variable 'newSize'.
Error in network/subsasgn>setLayerTransferParam (line 1231) net.layers{i}.range = repmat(feval(net.layers{i}.transferFcn, ...
Error in network/subsasgn>network_subsasgn (line 189) if isempty(err), [net,err] = setLayerTransferParam(net,i,transferParams); end
Error in network/subsasgn (line 13) net = network_subsasgn(net,subscripts,v,netname);
Error in TestNet (line 21) net.layers{1}.transferParam.no_of_iter = 4;

Iniciar sesión para comentar.

 Respuesta aceptada

George Evers
George Evers el 2 de Feb. de 2011

0 votos

Francisco,
Have you tried the solution methods suggested at http://www.mathworks.com/support/solutions/en/data/1-17LOK/index.html?product=NN&solution=1-17LOK ?
George

3 comentarios

Ned Gulley
Ned Gulley el 2 de Feb. de 2011
Francisco says: "The problem I have is not how to include the function in the library. The problem I have is how to define the parameters for the function.
Thanks anyway for your link, I guess is almost the only one talking about his issue :)"
George Evers
George Evers el 3 de Feb. de 2011
I don't have the NN toolbox by which to help with the debbugging. If no one else has the answer, you might just click "Please provide feedback to help us improve this Solution" at the link above and request the desired instructions.
Francisco
Francisco el 3 de Feb. de 2011
Thanks anyway George.
Till the moment I 'solved' using a global variable instead of passing the parameters in the right way -I was not able to realize how to do it.
Thanks again for your time.
Fran

Iniciar sesión para comentar.

Más respuestas (1)

Greg Heath
Greg Heath el 9 de Feb. de 2013
There is absolutely no reason to use parameters in the transfer function.
Training will vary the weights to minimize the error.
If you want to decrease training time , just increase the learning rate
Hope this helps.
Greg

Preguntada:

el 1 de Feb. de 2011

Editada:

el 4 de Dic. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by