eroor in lstm training network

조회 수: 1 (최근 30일)
bhanu kiran vandrangi
bhanu kiran vandrangi 2022년 3월 25일
댓글: KSSV 2022년 3월 28일
'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

답변 (1개)

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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by