Formatting input and target data for narxnet as concurrent sequences

조회 수: 10 (최근 30일)
Allen Yin
Allen Yin 2018년 4월 3일
댓글: christttttttophe 2020년 2월 17일
I am using narxnet to train on and predict time series data. My input is NxT, output is MxT, where T=number of time points. My time series are collected in individual trials of different lengths, so according to the doc on multiple sequences with dynamic neural network, I am combining my trial data into concurrent set of sequences, while at the same padding the shorter sequences.
This gives me the input Xnf as a Tx1 cell array, where T=number of time points in the longest trial. Each of these cells is an NxK matrix, N=dimension of input vector, K=number of trials. If trial k is length t1, then in all cells Xnf(t1+1:end), the k-th column will all be nan.
However, I want to divide my data into train, validation, and test with individual trials as units. For example, trials {1,5,6,7,8} are for training, trials {2,3,4} are for validation, and trials {9,10,11} are for testing.
I can't use any of the divdeFcn schemes to do that with my input format.
I then formatted my input such that XnF(1:i1) correspond to training, XnF((i1+1):i2) correspond to validation, and XnF((i2+1):end) correspond to test.
However, the number of columns in each cell within XnF(1:i1) is equal to the number of trials for training; the number of columns in each cell within XnF((i1+1):i2) is equal to the number of trials for validation. This way I can use use
net.divideFcn='divideind';
net.divideParam.trainInd=1:i1;
net.divideParam.valInd=(i1+1):i2;
net.divideParam.testInd=(i2+1):length(XnF)
However, this does not work and I get the following error from train:
Error using nntraining.setup>setupPerWorker (line 61)
Inputs X{1,1892} and Inputs X{1,1} have different numbers of columns.
This suggest to me all of the inputs need to have the same number of columns, so my input format does not work. How should I format my unequal-length trials of time series for narxnet?
  댓글 수: 2
Allen Yin
Allen Yin 2018년 4월 3일
Further reading on RNN suggests that a good solution would be to reset the network state after training on each sequence. But it is not clear how to do this with narxnet...is this something that can be done?
Greg Heath
Greg Heath 2018년 4월 4일
I've reread this multiple times and still don't understand what you are doing and why. Are you able to get someone to edit or cowrite?

댓글을 달려면 로그인하십시오.

답변 (1개)

Allen Yin
Allen Yin 2018년 4월 4일
So I have experiment where I collect behavior variables and neuronal activities in multiple trials. I want to predict the covariates with the neuronal activities.
The trial lengths are different, and the covariates also differ from trial-to-trial. So to train the narxnet, I would for example randomly select 10 trials for training, 5 trials for validation and 5 trials for testing.
When I give the data to the narxnet, I would prefer not to concatenate all 15 training and validation trials together in time, because of the huge discontinuities between one trials' end and another's beginning. Instead, I think the correct approach should be training on one trial, reset the network's state, train on the next trial, reset the state, and so on.
Does this make sense, and is this something I can do easily?
  댓글 수: 2
Greg Heath
Greg Heath 2018년 4월 5일
편집: Greg Heath 2018년 4월 5일
You have erroneously put your comment into an answer box.
However, your comment does describe the correct procedure.
Good Luck
Greg
christttttttophe
christttttttophe 2020년 2월 17일
Hey Allen, did you ever work this out? If so can you explain how?
I am just not sure how to do multiple 'trials' at the same time in Matlab. Especially because of the unequal length of the trials which seems to really make a difficulty with this.
Best.

댓글을 달려면 로그인하십시오.

카테고리

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