Validation set in a NARX network

1 visualización (últimos 30 días)
Francesco
Francesco el 9 de Nov. de 2022
Respondida: Neha el 29 de Ag. de 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!

Respuestas (1)

Neha
Neha el 29 de Ag. de 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!

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by