Validation set in a NARX network

조회 수: 5 (최근 30일)
Francesco
Francesco 2022년 11월 9일
답변: Neha 2023년 8월 29일
I am using a NARX neural network to estimate a variable from 20 different signals recorded by sensors. I have N different recordings of equal length T. The data are prepared using the preparets function as follows:
[Xs,Xi,Ai,Ts] = preparets(net,Xdata,{},Ydata);
Xdata is a cell array 1xT, and each cell is a matrix 20xN. Ydata is a cell array 1xT, and each cell is a array 1xN.
I am doing the training using the following line
[net,tr] = train(net,Xs,Ts,Xi,Ai)
I would like to make a validation set using a sub-set of recordings to perform early stopping during training. So far, when I enable the validation (e.g. net.divideFcn = 'dividerand'), the validation set is created using time samples from all recordings in the training. I would like to separate specific recordings (let's say the 20% of N) to perform validation during training.
Thanks!

답변 (1개)

Neha
Neha 2023년 8월 29일
Hi Francesco,
I understand that you want to train a NARX neural network and include a subset of recordings for validation. You can refer to the following code to create a validation set with 20% of the recordings:
net = narxnet(1:2,1:2,10);
net.divideMode = 'sample';
net.divideFcn = 'divideind'; % Use individual indices for division
net.divideParam.trainInd = 1:80;
net.divideParam.valInd = 80:100;
[Xs,Xi,Ai,Ts] = preparets(net,Xdata,{},Ydata);
[net,tr] = train(net,Xs,Ts,Xi,Ai)
Hope this helps!

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by