Validation set in a NARX network

3 visualizzazioni (ultimi 30 giorni)
Francesco
Francesco il 9 Nov 2022
Risposto: Neha il 29 Ago 2023
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!

Risposte (1)

Neha
Neha il 29 Ago 2023
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!

Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by