Invalid training data. Sequence responses must have the same sequence length as the corresponding predictors.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
my data is n*1, I apply LSTM to analysis,,,,choose:
k =3; %滑动窗口设置为1 具体设多少需要衡量
for i = 1:size(dataTrainStandardized)-k+1
XTrain(:,i) = dataTrainStandardized(i:i+k-1,:); %将其分为101个序列,每个序列长度500,特征5个
YTrain(:,i)= dataTrainStandardized(i+k-1,:);
end
inputsize= 3;
outputsize = 1;
numHiddenUnits = 20;
layers = [sequenceInputLayer(inputsize)
lstmLayer(numHiddenUnits)
dropoutLayer(0.5)%防止过拟合
fullyConnectedLayer(outputsize)
regressionLayer];
options = trainingOptions('adam', ...
'MaxEpochs',500,...
'MiniBatchSize',16, ...
'GradientThreshold',1, ...%梯度下降阈值
'InitialLearnRate',0.005, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropPeriod',250, ...%
'LearnRateDropFactor',0.5, ...
'ValidationData',{XTrain,YTrain}, ...
'ValidationFrequency',1, ...
'Verbose',1, ...
'Plots','training-progress');
%% Train LSTM Network
[net tr] = trainNetwork(XTrain,YTrain,layers,options);
but error is Invalid training data. Sequence responses must have the same sequence length as the corresponding predictors.
look for help!!!!thank you
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur 时序、序列和文本深度学习 dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!