필터 지우기
필터 지우기

Neural Network toolbox - transferFcn and transferParam

조회 수: 8 (최근 30일)
Francisco
Francisco 2011년 2월 1일
편집: Guru 2014년 12월 4일
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
Greg Heath
Greg Heath 2014년 12월 4일
There is no problem worth talking about!!!
.. . Read my answer
Greg
Guru
Guru 2014년 12월 4일
편집: Guru 2014년 12월 4일
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;

댓글을 달려면 로그인하십시오.

채택된 답변

George Evers
George Evers 2011년 2월 2일
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
George Evers
George Evers 2011년 2월 3일
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 2011년 2월 3일
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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Greg Heath
Greg Heath 2013년 2월 9일
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

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by