NARX DNN: hidden layers and activation function

조회 수: 5 (최근 30일)
Darrell Kartrip
Darrell Kartrip 2020년 8월 27일
답변: Adarsh 2025년 1월 23일
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.

답변 (1개)

Adarsh
Adarsh 2025년 1월 23일
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 !

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by