
clc; clear; close all;
%% ---------------------------- init Variabels ----------------------------
opt.Delays = [1 2 3 4 5 6 7 8 9 10 12 16 20];
opt.dataPreprocessMode = 'Data Standardization'; % 'None' 'Data Standardization' 'Data Normalization'
opt.learningMethod = 'LSTM'; % 'MLP' 'LSTM'
opt.trPercentage = 0.8; % divide data into Test and Train dataset
% ------------- BILSTM parameters
opt.NumOfHiddenLayers = 2; % number of (bi)LSTM layers
opt.NumOfUnitsInFirstlayer = 100; % number of (bi)LSTM units in the first layer
opt.NumOfUnitsInSecondlayer = 100; % number of (bi)LSTM units in the second layer
opt.NumOfUnitsInThirdlayer = 75; % number of (bi)LSTM units in the third layer
opt.NumOfUnitsInFourthlayer = 75; % number of (bi)LSTM units in the forth layer
opt.isUseBiLSTMLayer = true; % if it is true the layer turn to the Bidirectional-LSTM and if it is false it will turn the units to the simple LSTM
opt.isUseDropoutLayer = true; % dropout layer avoid of bieng overfit
opt.DropoutValue = 0.5;
opt.maxEpochs = 200; % maximum number of training Epoch in bi-LSTM.
opt.miniBatchSize = 64; % minimum batch size in bi-LSTM .
opt.executionEnvironment = 'gpu'; % 'cpu' 'gpu' 'auto'
opt.LR = 'adam'; % 'sgdm' 'rmsprop' 'adam'
opt.trainingProgress = 'training-progress'; % 'training-progress' 'none'.
% MLP parameters
opt.NumOfFeedForwardLeyars = 2;
opt.NumOfNeuronsInFirstlayer = 15; % number of neurons in the first layer
opt.NumOfNeuronsInSecondlayer = 15; % number of neurons in the second layer
opt.NumOfNeuronsInThirdlayer = 10; % number of neurons in the third layer
opt.trainFcn = 'trainbr'; % 'trainlm' 'trainscg' 'traincgf' 'trainbr'
opt.maxItrations = 100; % maximum number of training itration.
opt.showWindow = true; % display training window.
opt.showCommandLine = true; % display training process on workspace.
opt.isSavePredictedData = true; % save output prediction on an excel file
获取完整代码和数据集请阅读全文
未经允许不得转载!【Matlab源码】深度学习和浅层学习算法的时间序列预测