トレーニングシーケンスの特徴次元について

12 vues (au cours des 30 derniers jours)
misato abe
misato abe le 12 Déc 2019
Commenté : misato abe le 13 Déc 2019
LSTMネットワークを用いた予測について質問があります。
現在、商品出荷台数や人口などを含めた4つのデータから、将来の商品出荷台数を予測できないか考えております。
を参考にしました。
以下のコードを実行したところ
「トレーニング シーケンスの特徴次元は 1 ですが、入力層には特徴次元 4のシーケンスが必要です。」
と警告を受けました。
「%予測子と応答」の部分が悪いのでしょうか。
ご回答よろしくお願いします。
%データの読み取り
opts = detectImportOptions('mlaysia.xlsx','DataRange','B3');
T1=readtable('mlaysia.xlsx',opts,'ReadVariableNames',false);
T1_data = T1.Variables;
%1行N列の配列へ
for i=1:4
T1_array{i}=T1_data(1:end,i)';
end
%転置
T1_a=(T1_array)';
%シーケンスの最初の90%で学習を行い残りの10%でテストする
numTimeStepsTrain = floor(0.9*numel(T1_a));
T1Train = T1_a(1:numTimeStepsTrain+1);
T1Test = T1_a(numTimeStepsTrain+1:end);
%予測子と応答の準備
XT1Train = T1Train(1:end-1);
YT1Train = T1Train(2:end);
%lstmアーキテクチャ 定義
numFeatures=2;
numResponse=1;
numHiddenUnits=200;
%lstm層
layers = [ ...
sequenceInputLayer(numFeatures)
lstmLayer(numHiddenUnits)
fullyConnectedLayer(numResponse)
regressionLayer];
%トレーニングオプション
options = trainingOptions('adam', ...
'MaxEpochs',200, ...
'GradientThreshold',1, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropPeriod',125, ...
'LearnRateDropFactor',0.2, ...
'Verbose',0, ...
'Plots','training-progress');
net = trainNetwork(XT1Train,YT1Train,layers,options);
取り込んだExcelファイルの一部は以下の通りです。

Réponse acceptée

Hiro Yoshino
Hiro Yoshino le 12 Déc 2019
データの作り方が多分おかしいのだと思われます。
fig.PNG
こんな風にして、一つのベクトルを一つのcellに入れます。
つまり、データセット数 (ここは自分で決める) x 4 のセルを作って、そのセルの一つ一つには
上のようなベクトルが入っているようにします。
  1 commentaire
misato abe
misato abe le 13 Déc 2019
勉強不足でした。
ありがとうございます!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Tags

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!