编程知识 cdmana.com

Time series prediction of deep learning and shallow learning algorithm

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

Get full code

版权声明
本文为[ai52learn]所创,转载请带上原文链接,感谢
https://cdmana.com/2020/12/20201224232622324g.html

Scroll to Top