Invalid training data. Sequence responses must have the same sequence length as the corresponding predictors

36 次查看(过去 30 天)
I have written a DNN model to train my dataset, however, im not too sure what to put for the inputsize. My training data and validation data is shown in the screenshot below. I got the error message when i put 112000 for inputsize of the DNN model. could someone advice me what the inputsize should be?
.
clear variables;
close all;
% Load training data and essential parameters
load('trainData.mat','XTraindata','YTraindata','XValidatedata','YValidatedata');
numSC = 64;
% Batch size
miniBatchSize = 4000;
% Iteration
maxEpochs = 10;
% Sturcture
inputSize = 112000;
numHiddenUnits = 128;
numHiddenUnits2 = 64;
numHiddenUnits3 = numSC;
numClasses = 16;
% DNN Layers
layers = [ ...
sequenceInputLayer(inputSize,'Name','sequence')
fullyConnectedLayer(numHiddenUnits,'Name','fc1')
reluLayer('Name','relu1')
fullyConnectedLayer(numHiddenUnits2,'Name','fc2')
reluLayer('Name','relu2')
fullyConnectedLayer(numClasses,'Name','fc3')
softmaxLayer('Name','sm')
classificationLayer('Name','class')];
% Training options
options = trainingOptions('adam',...
'InitialLearnRate',0.01,...
'ExecutionEnvironment','auto', ...
'ValidationData',{XValidatedata,YValidatedata},...
'GradientThreshold',1, ...
'LearnRateDropFactor',0.1,...
'MaxEpochs',maxEpochs, ...
'MiniBatchSize',miniBatchSize, ...
'Shuffle','every-epoch', ...
'Verbose',1,...
'Plots','training-progress');
% Train the neural network
tic;
net = trainNetwork(XTraindata,YTraindata,layers,options);
toc;
save('NN.mat','net');

采纳的回答

Sindhu Karri
Sindhu Karri 2021-2-4
Hii,
The input value to the 'sequenceInputLayer' should match 'numFeatures' in 'XTrain' data.
Change the code from:
sequenceInputLayer(112000,'Name','sequence')
to:
sequenceInputLayer(384,'Name','sequence')
will resolve the issue.
Refer to below attached link

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by