多维时序 | Matlab实现LSTM-Adaboost和LSTM多变量时间序列预测对比


目录

  • 多维时序 | Matlab实现LSTM-Adaboost和LSTM多变量时间序列预测对比
  • 预测效果
  • 基本介绍
  • 模型描述
  • 程序设计
  • 参考资料


预测效果

多维时序 | Matlab实现LSTM-Adaboost和LSTM多变量时间序列预测对比_Ada

多维时序 | Matlab实现LSTM-Adaboost和LSTM多变量时间序列预测对比_Ada_02


多维时序 | Matlab实现LSTM-Adaboost和LSTM多变量时间序列预测对比_LSTM-Adaboost_03

基本介绍

多维时序 | Matlab实现LSTM-Adaboost和LSTM多变量时间序列预测对比

模型描述

Matlab实现LSTM-Adaboost和LSTM多变量时间序列预测对比(完整程序和数据)
1.输入多个特征,输出单个变量;
2.考虑历史特征的影响,多变量时间序列预测;
4.csv数据,方便替换;
5.运行环境Matlab2018b及以上;
6.输出误差对比图。

程序设计

(32,'OutputMode',"last",'Name','bil4','RecurrentWeightsInitializer','He','InputWeightsInitializer','He')
        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;