1.Matlab实现LSTM长短期记忆神经网络多输入单输出未来预测,预测新数据(完整源码和数据)
2.输入多个特征,输出单个变量,多输入单输出,预测新数据;
3.运行环境matlab2018及以上,excel数据,方便替换;
4.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。
%% 清空环境变量
warning off % 关闭报警信息
close all % 关闭开启的图窗
clear % 清空变量
clc % 清空命令行
%% 导入数据
res = xlsread('sj.xlsx','训练数据');
%% 读取未来输入特征数据
kes = xlsread('sj.xlsx','需要预测的数据');
%% 划分训练集和测试集
temp = 1:11;
P_train = res(temp(1: 8), 1: 3)';
T_train = res(temp(1: 8), 4)';
M = size(P_train, 2);
P_test = res(temp(9: end), 1: 3)';
T_test = res(temp(9: end), 4)';
N = size(P_test, 2);
%% 数据转置
kes = kes';
K = size(kes, 2);
%% 数据归一化
[P_train, ps_input] = mapminmax(P_train, 0, 1);
P_test = mapminmax('apply', P_test, ps_input);
[t_train, ps_output] = mapminmax(T_train, 0, 1);
t_test = mapminmax('apply', T_test, ps_output);
[1] https://blog.csdn.net/kjm13182345320/article/details/129036772?spm=1001.2014.3001.5502
[2] https://blog.csdn.net/kjm13182345320/article/details/128690229