I am attempting to run a LSTM neural network to classify time-series data from an IMU as either a correct or incorrect motion. The error is saying that the input is 2D but it needs to be 3D. Is there a method or way of forcing the input to be 3D without manually editing the input before loading it into the neural network? My features and labels are in one file and I want to read the last column as the labels while the first 3 columns are used as features. This is how I am loading the input data.
DataSet trainData;
SequenceRecordReader trainFEATURES = new CSVSequenceRecordReader(0, “;”);
trainFEATURES.initialize(new NumberedFileInputSplit(trnValue, 2, 2));
SequenceRecordReaderDataSetIterator trainIter = new SequenceRecordReaderDataSetIterator(trainFEATURES, miniBatchSize1, numLabels,labelIndex, false);
trainIter.setPreProcessor(new LabelLastTimeStepPreProcessor());
trainData = trainIter.next();
//Loading the test data
DataSet testData;
SequenceRecordReader testFEATURES = new CSVSequenceRecordReader(0, “;”);
testFEATURES.initialize(new NumberedFileInputSplit(tstValue, 2, 2));
SequenceRecordReaderDataSetIterator testIter = new SequenceRecordReaderDataSetIterator(testFEATURES, miniBatchSize2, numLabels, labelIndex, false);
testIter.setPreProcessor(new LabelLastTimeStepPreProcessor());
testData = testIter.next();
and this is how I have setup my neural network layers.
.layer(0, new LastTimeStep (new LSTM.Builder().nIn(numInputs).nOut(numHiddenNodes).activation( Activation . TANH ).weightInit( WeightInit . RELU ).build()))
.layer(1, new LastTimeStep(new LSTM.Builder().nIn(numHiddenNodes).nOut(numHiddenNodes).activation( Activation . TANH ).weightInit( WeightInit . RELU ).build()))
.layer(2, new RnnOutputLayer.Builder(LossFunctions. LossFunction . MCXENT ).nIn(numHiddenNodes).nOut(numOutputs).activation( Activation . SOFTMAX ).weightInit( WeightInit . XAVIER ).build()).build();