How can i use Hyperbolic tangent activation function in Neural Network

2 ビュー (過去 30 日間)
DONG JUN KIM
DONG JUN KIM 2021 年 5 月 15 日
コメント済み: DONG JUN KIM 2021 年 5 月 27 日
i want to change activation function from ReLU to tangent Hyperbolic function in Neural Network
now, i'm using this command
net.layers{1}.transferFcn = 'poslin';
but Is there a way to change the layer to the tangent Hyperbolic layer? Thanks

採用された回答

Aditya Patil
Aditya Patil 2021 年 5 月 18 日
You can create a custom function, and assign it to transerFcn property. The details are mentioned in the Custom Neural Network Helper Functions documentation.
The steps for replicating this workflow are summarized as follows:
  1. Navigate to the folder containing the NN transfer functions (MATLAB\<version>\toolbox\nnet\nnet\nntransfer in Windows)
  2. Copy the file "tansig.m" and the directory "+tansig".
  3. Paste the copied file and directory into your working directory
  4. Modify the name of "tansig.m" and "+tansig" to reflect the new transfer function name, for example "myFcn.m" and "+myFcn".
  5. Modify the code in the relevant files of "+myFcn"to properly calculate the new transfer function and its derivative.
  6. For the layer in the neural network that will use this transfer function, change the "transferFcn" property to 'myFcn'.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by