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');
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get 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!