时序预测 | MATLAB实现基于LSTM长短期记忆神经网络的时间序列预测-递归预测未来(多指标评价)

时序预测 | MATLAB实现基于LSTM长短期记忆神经网络的时间序列预测-递归预测未来(多指标评价)

目录

    • [时序预测 | MATLAB实现基于LSTM长短期记忆神经网络的时间序列预测-递归预测未来(多指标评价)](#时序预测 | MATLAB实现基于LSTM长短期记忆神经网络的时间序列预测-递归预测未来(多指标评价))

预测结果







基本介绍

Matlab实现LSTM长短期记忆神经网络时间序列预测未来(完整程序和数据)

1.Matlab实现LSTM长短期记忆神经网络时间序列预测未来;

2.运行环境Matlab2018及以上,data为数据集,单变量时间序列预测;

3.递归预测未来数据,可以控制预测未来大小的数目,适合循环性、周期性数据预测;

4.命令窗口输出R2、MAE、MAPE、MBE、MSE等评价指标;

程序设计

clike 复制代码
%% 创建混合LSTM网络架构
% 输入特征维度
numFeatures  = f_;
% 输出特征维度
numResponses = 1;
FiltZise = 10;
%  创建"LSTM"模型
    layers = [...
        % 输入特征
        sequenceInputLayer([numFeatures 1 1],'Name','input')
        sequenceFoldingLayer('Name','fold')
        % LSTM特征学习
        lstmLayer(50,'Name','lstm1','RecurrentWeightsInitializer','He','InputWeightsInitializer','He')
        % LSTM输出
        lstmLayer(optVars.NumOfUnits,'OutputMode',"last",'Name','bil4','RecurrentWeightsInitializer','He','InputWeightsInitializer','He')
        dropoutLayer(0.25,'Name','drop3')
        % 全连接层
        fullyConnectedLayer(numResponses,'Name','fc')
        regressionLayer('Name','output')    ];

    layers = layerGraph(layers);
    layers = connectLayers(layers,'fold/miniBatchSize','unfold/miniBatchSize');

%% LSTM训练选项
% 批处理样本
MiniBatchSize =128;
% 最大迭代次数
MaxEpochs = 500;
    options = trainingOptions( 'adam', ...
        'MaxEpochs',500, ...
        'GradientThreshold',1, ...
        'InitialLearnRate',optVars.InitialLearnRate, ...
        'LearnRateSchedule','piecewise', ...
        'LearnRateDropPeriod',400, ...
        'LearnRateDropFactor',0.2, ...
        'L2Regularization',optVars.L2Regularization,...
        'Verbose',false, ...
        'Plots','none');

%% 训练混合网络
net = trainNetwork(XrTrain,YrTrain,layers,options);

参考资料

1\] https://blog.csdn.net/kjm13182345320/article/details/129036772?spm=1001.2014.3001.5502 \[2\] https://blog.csdn.net/kjm13182345320/article/details/128690229

相关推荐
鹿角片ljp18 小时前
基于 BiLSTM 的中文文本相似度计算项目实现
python·nlp·lstm
像风一样自由20202 天前
LSTM-KNN融合模型:让AI既有记忆又会“查字典“
人工智能·rnn·lstm
CClaris4 天前
手撕 LSTM:用 NumPy 从零实现 LSTM 前向传播
人工智能·numpy·lstm
fantasy_arch4 天前
LSTM和DenseNet区别
人工智能·rnn·lstm
Dev7z5 天前
基于粒子群优化的LSTM时间序列预测模型研究
人工智能·机器学习·lstm
提娜米苏6 天前
[论文笔记] End-to-End Audiovisual Fusion with LSTMs
论文阅读·深度学习·lstm·语音识别·论文笔记·多模态
极客BIM工作室6 天前
序列建模:RNN、LSTM 与 Transformer 的技术异同深度解析
rnn·lstm·transformer
提娜米苏6 天前
[论文笔记] 基于 LSTM 的端到端视觉语音识别 (End-to-End Visual Speech Recognition with LSTMs)
论文阅读·深度学习·计算机视觉·lstm·语音识别·视觉语音识别
deepdata_cn6 天前
时序性步态数据处理的RNN及LSTM算法
rnn·算法·lstm
木头左6 天前
门控注意力单元与LSTM细胞状态更新的协同机制
人工智能·rnn·lstm