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

15 ビュー (過去 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 Center および File ExchangeGet Started with Statistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by