eroor in lstm training network

2 visualizzazioni (ultimi 30 giorni)
bhanu kiran vandrangi
bhanu kiran vandrangi il 25 Mar 2022
Commentato: KSSV il 28 Mar 2022
'The training sequences are of feature dimension 1 but the input layer expects sequences of feature dimension 2.' this is the error i am getting whwn i run the code
clear all; clc;
Data=xlsread('EUR_USD Historical Data.csv')
Stock=Data(:,2)
percentage=Data(:,5)*100
[row col]=size(Data)
%create database for lstm
SequenceLength=30
Database={}
resultDatabase=[]
count=0
for i=row:-1:SequenceLength
count=count+1
a=Stock(i-SequenceLength+1:i)'
a=flip(a)
b=percentage(i-SequenceLength+1:i)'
b=flip(b)
Database{count,1}=[a,b]
end
[rt ct]=size(Database)
count=0
for i=1:rt-1
count=count+1
a=Database{count+1,1}
resultDatabase(count,1)=a(1,end)
end
EURUSDDatabase=Database
save EURUSDDatabase
%lstm creation
for i=1:rt-20
stockTrain{i,1}=Database{i,1}
end
restTrain=resultDatabase(1:rt-20)
numFeatures=2
numHiddenLayers=125
numResponses=1
Layers=[ sequenceInputLayer(numFeatures),...
lstmLayer(numHiddenLayers,'OutputMode','Last'),...
fullyConnectedLayer(numResponses),...
regressionLayer
]
miniBatchSize=3;
Epoch=20;
options=trainingOptions('adam',...
'ExecutionEnvironment','auto',...
'MaxEpochs',Epoch,...
'MiniBatchSize',miniBatchSize,...
'plots','training-progress')
TradernetEURUSD=trainNetwork(stockTrain,restTrain,Layers,options)
save TradernetEURUSD

Risposte (1)

KSSV
KSSV il 25 Mar 2022
I think this line:
numFeatures=2
shoule be
numFeatures=1
  2 Commenti
bhanu kiran vandrangi
bhanu kiran vandrangi il 28 Mar 2022
here i am taking two columns ,so the features should be 2 right?
KSSV
KSSV il 28 Mar 2022
Feature is one.... Code runs but I suspect the data and the code.

Accedi per commentare.

Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by