Neural Network toolbox - transferFcn and transferParam
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Francisco
el 1 de Feb. de 2011
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
Greg Heath
el 4 de Dic. de 2014
There is no problem worth talking about!!!
.. . Read my answer
Greg
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;
Respuesta aceptada
George Evers
el 2 de Feb. de 2011
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
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.
Más respuestas (1)
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
0 comentarios
Ver también
Categorías
Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!