Multi-dimensional time series | MATLAB implements GWO-GRU gray wolf algorithm to optimize multi-variable time series prediction of gated cyclic unit
Table of contents
Prediction effect
basic introduction
MATLAB implements multi-variable time series prediction based on the GWO-GRU gray wolf algorithm to optimize the gated cyclic unit (complete program and data)
1. Input multiple features and output a single variable;
2. Consider the influence of historical features, multi-variable time series prediction ;
4. Excel data, easy to replace;
5. Running environment Matlab2018b and above;
6. Output evaluation indicators such as R2, MAE, MBE;
7. Optimize learning rate, hidden layer nodes, and regularization coefficients.
Note that the program and data are placed in one folder, and the running environment is Matlab2021b and above.
programming
- Complete program and data acquisition method 1: Exchange for programs of equal value;
- Complete program and data acquisition method 2 (download from the resource): MATLAB implements the GWO-GRU gray wolf algorithm to optimize the multivariable time series prediction acquisition of the gated cyclic unit .
dropoutLayer(0.25,'Name','drop2')
% 全连接层
fullyConnectedLayer(numResponses,'Name','fc')
regressionLayer('Name','output') ];
layers = layerGraph(layers);
layers = connectLayers(layers,'fold/miniBatchSize','unfold/miniBatchSize');
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
%% 训练选项
if gpuDeviceCount>0
mydevice = 'gpu';
else
mydevice = 'cpu';
end
options = trainingOptions('adam', ...
'MaxEpochs',MaxEpochs, ...
'MiniBatchSize',MiniBatchSize, ...
'GradientThreshold',1, ...
'InitialLearnRate',learningrate, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropPeriod',56, ...
'LearnRateDropFactor',0.25, ...
'L2Regularization',1e-3,...
'GradientDecayFactor',0.95,...
'Verbose',false, ...
'Shuffle',"every-epoch",...
'ExecutionEnvironment',mydevice,...
'Plots','training-progress');
%% 模型训练
rng(0);
net = trainNetwork(XrTrain,YrTrain,layers,options);
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
%% 测试数据预测
% 测试集预测
YPred = predict(net,XrTest,"ExecutionEnvironment",mydevice,"MiniBatchSize",numFeatures);
YPred = YPred';
% 数据反归一化
YPred = sig.*YPred + mu;
YTest = sig.*YTest + mu;
————————————————
版权声明:本文为CSDN博主「机器学习之心」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
References
[1] http://t.csdn.cn/pCWSp
[2] https://download.csdn.net/download/kjm13182345320/87568090?spm=1001.2014.3001.5501
[3] https://blog.csdn.net/kjm13182345320/article/details/129433463?spm=1001.2014.3001.5501