淘先锋技术网

首页 1 2 3 4 5 6 7

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

预测效果

1
2

3

基本介绍

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

模型描述

Matlab实现BiLSTM-Adaboost和BiLSTM多变量时间序列预测对比(完整程序和数据)
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;
————————————————
版权声明:本文为CSDN博主「机器学习之心」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

参考资料

[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