回归预测 | MATLAB实现GRU门控循环单元多输入多输出
预测效果
基本介绍
MATLAB实现GRU门控循环单元多输入多输出,数据为多输入多输出预测数据,输入10个特征,输出3个变量,程序乱码是由于版本不一致导致,可以用记事本打开复制到你的文件,运行环境MATLAB2020b及以上。命令窗口输出MAE和R2,可在下载区获取数据和程序内容。
程序设计
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
layers = [ ...
sequenceInputLayer(numFeatures)
fullyConnectedLayer(numResponses)
regressionLayer];
options = trainingOptions('adam', ...
'MaxEpochs',250, ...
'GradientThreshold',1, ...
'InitialLearnRate',0.005, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropPeriod',125, ...
'LearnRateDropFactor',0.2, ...
'ExecutionEnvironment','cpu', ...
'Verbose',0, ...
'Plots','training-progress');
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
net = trainNetwork(XTrain,YTrain,layers,options);
dataTestStandardized = (dataTest - mu) / sig;
XTest = dataTestStandardized(1:end-1);
net = predictAndUpdateState(net,XTrain);
[net,YPred] = predictAndUpdateState(net,YTrain(end));
numTimeStepsTest = numel(XTest);
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
往期精彩
MATLAB实现RBF径向基神经网络多输入多输出预测
MATLAB实现BP神经网络多输入多输出预测
MATLAB实现DNN神经网络多输入多输出预测
MATLAB实现GRNN广义回归神经网络多输入多输出预测
参考资料
[1]
https://blog.csdn.net/kjm13182345320/article/details/116377961
[2]
https://blog.csdn.net/kjm13182345320/article/details/127931217
[3]
https://blog.csdn.net/kjm13182345320/article/details/127894261