Validation set in a NARX network
3 views (last 30 days)
Show older comments
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!
0 Comments
Answers (1)
Neha
on 29 Aug 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!
0 Comments
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!