NARX DNN: hidden layers and activation function

5 vues (au cours des 30 derniers jours)
Darrell Kartrip
Darrell Kartrip le 27 Août 2020
Réponse apportée : Adarsh le 23 Jan 2025
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.

Réponses (1)

Adarsh
Adarsh le 23 Jan 2025
Hi,
I am assuming by NARX DNN you are referring to the “narxnetNetwork. 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 !

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by