NARX DNN: hidden layers and activation function
7 次查看(过去 30 天)
显示 更早的评论
Hi there, can you please tell me how to set the number of hidden layers and the activation function of the output layer in a NARX network? It seems that I can only use one hidden layer and the linear function in the output layer.
0 个评论
回答(1 个)
Adarsh
2025-1-23
Hi,
I am assuming by NARX DNN you are referring to the “narxnet” Network. From what I found in the MATLAB documentation, in the “narxnet” Network the number of hidden layers in the Network can be modified by passing a row vector of one or more hidden layer sizes as input and as for the output layer activation function part you can access the last layer through the object handle of the “narxnet” object created and change its “transferFcn” property to any other function from “purelin” (linear activation). Here is an example code on how to use multiple hidden layers and modify output layer activation function:
net = narxnet(1:2,1:2,[10 2]); % Input delays, Feedback delays, Hidden layers row vector
[Xs,Xi,Ai,Ts] = preparets(net,XTrain,{},TTrain); % Preparing time series data
net.layers{end}.transferFcn = "logsig"; % Modifying the output layer activation function
net = train(net,Xs,Ts,Xi,Ai); % Train the network
Here is the link to the documentation section regarding the usage of “narxnet” with multiple hidden layers:
I hope it helps !
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!