回归预测 | Matlab实现CNN-BiLSTM-self-Attention多变量回归预测

发布于:2025-08-13 ⋅ 阅读:(13) ⋅ 点赞:(0)

回归预测 | Matlab实现CNN-BiLSTM-self-Attention多变量回归预测

预测效果

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

基本介绍

1.Matlab实现CNN-BiLSTM融合自注意力机制多变量回归预测,CNN-BiLSTM-self-Attention;

MATLAB实现CNN-BiLSTM-self-Attention卷积神经网络-双向长短期记忆网络融合自注意力机制多变量回归预测。
2.data为数据集,格式为excel,7个输入特征,1个输出特征,多输入单输出回归预测,main.m是主程序;

3.评价指标包括:R2、MAE、MSE、RMSE和MAPE等;

4.运行环境matlab2023b及以上。

程序设计

  • 完整代码私信回复回归预测 | Matlab实现CNN-BiLSTM-self-Attention多变量回归预测
%%  清空环境变量
warning off             % 关闭报警信息
close all               % 关闭开启的图窗
clear                   % 清空变量
clc                     % 清空命令行

%%  导入数据
res =xlsread('data.xlsx');

%%  数据分析
num_size = 0.7;                              % 训练集占数据集比例
outdim = 1;                                  % 最后一列为输出
num_samples = size(res, 1);                  % 样本个数
rng(0);
res = res(randperm(num_samples), :);         % 打乱数据集(不希望打乱时,注释该行)
num_train_s = round(num_size * num_samples); % 训练集样本个数
f_ = size(res, 2) - outdim;                  % 输入特征维度

%%  划分训练集和测试集
P_train = res(1: num_train_s, 1: f_)';
T_train = res(1: num_train_s, f_ + 1: end)';
M = size(P_train, 2);

P_test = res(num_train_s + 1: end, 1: f_)';
T_test = res(num_train_s + 1: end, f_ + 1: end)';
N = size(P_test, 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] An Empirical Evaluation of Generic Convolutional and Recurrent Networks for Sequence Modeling
[2] https://locuslab/TCN
[3] https://profiles/blogs/temporal-convolutional-nets-tcns-take-over
[3] Temporal Convolutional Networks for Action Segmentation
[4] http://t.cj.sina.com.cn/articles/view


网站公告

今日签到

点亮在社区的每一天
去签到