필터 지우기
필터 지우기

How to code my own transfer function

조회 수: 2 (최근 30일)
Souma
Souma 2011년 5월 11일
Hello all,
I am trying to implement my own transfer function that makes the exponential function. I would like then to integrate it in my code. I was inspired by the 'purelin'transfer function present in matlab to code my own exponential function
Here is how i proceed in my main function.
...
net = newff(pn,tn,S1,[],'trainlm');
net.layers{1}.transferFcn = exponential;
net.layers{2}.transferFcn = purelin;
...
And when i do run my code i do have the following error:
??? Error using ==> boiler_transfer at 5 Not enough arguments.
Error in ==> zexponential at 63 boiler_transfer
Error in ==> CorpusParam at 28 net.layers{1}.transferFcn= exponential
Does anyone knows how to fix that problem.
Thank you ,
Souma

답변 (3개)

Souma
Souma 2011년 5월 12일
Any suggestions??

Walter Roberson
Walter Roberson 2011년 5월 12일
Have another look at the documentation example for purelin
Assign this transfer function to layer i of a network.
net.layers{i}.transferFcn = 'purelin';
Notice they supplied a quoted string. Without the quotes, the code would attempt to call purelin right then and there and store the result as the transferFcn.
Likewise, since you coded exponential it is going to try to call exponential immediately and store the result -- an attempt that fails because you have no arguments. So use 'exponential' instead. (Though I suspect that using the function handle @exponential would be even better.)

Souma
Souma 2011년 5월 12일
Thank you Mr. Walter Roberson for your answer.
I have tried to put the name of my function in quotes ('exponential'). The element is compiled and it seems working. However, i get the following message:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.mathworks.toolbox.nnet.v6.diagram.nnTransfer.paint(nnTransfer.java:35) at com.mathworks.toolbox.nnet.v6.image.nnOffsetImage.paint(nnOffsetImage.java:49) at com.mathworks.toolbox.nnet.v6.image.nnLayerImage.paint(nnLayerImage.java:50) at com.mathworks.toolbox.nnet.v6.image.nnOffsetImage.paint(nnOffsetImage.java:49) at com.mathworks.toolbox.nnet.v6.image.nnLayerImage.paint(nnLayerImage.java:50)
and some 15 lines like this.
Do you know what does this mean ?
Thanks
Souma
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 5월 12일
Sorry, I do not have experience with that.

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

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by