基于cnn-lstm模型的负荷预测

数学建模加油站 2022-10-19 21:04:09

 利用CNN提取负荷的特征输入到LSTM中进行负荷预测。采用MATLAB搭建模型如下:       

           

 2、部分代码 

layers4=  [ sequenceUnfoldingLayer('name','unfold')
            flattenLayer('name','flatten')
            lstmLayer(numhidden_units1,'Outputmode','sequence','InputWeightsInitializer',func,'name','lstm1') 
            dropoutLayer(0.1,'name','dropout_1')
            lstmLayer(numhidden_units2,'Outputmode','last','InputWeightsInitializer',func,'name','lstm2') 
            dropoutLayer(0.1,'name','drdiopout_2')
            fullyConnectedLayer(outputSize,'WeightsInitializer',func,'name','fullconnect')   % 全连接层设置(影响输出维度)(cell层出来的输出层) %
            leakyReluLayer('name','ReluLayer')
            regressionLayer('name','output')];
            
lgraph = addLayers(lgraph,layers4);
lgraph = connectLayers(lgraph,'concat','unfold/in');
lgraph = connectLayers(lgraph,'fold/miniBatchSize','unfold/miniBatchSize');

figure
plot(lgraph)


%%
% 网络训练
tic

net = trainNetwork(Train_xNorm,Train_yNorm,lgraph,opts);




%% 测试
% close all
figure
Predict_Ynorm = net.predict(Test_xNorm);
Predict_Y  = mapminmax('reverse',Predict_Ynorm',yopt);
Predict_Y = Predict_Y';

plot(Predict_Y,'g-')
hold on 

plot(Test_y);    
legend('预测值','实际值')

3、结果展示

      

完整代码见 基于cnn-lstm模型的负荷预测-数据 (mianbaoduo.com)

...全文
158 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,050

社区成员

发帖
与我相关
我的任务
社区描述
数学建模,就是根据实际问题来建立数学模型,对数学模型来进行求解,然后根据结果去解决实际问题。当需要从定量的角度分析和研究一个实际问题时,人们就要在深入调查研究。加入小岛让我们分享更多建模新知识~
python数据挖掘机器学习 个人社区 浙江省·杭州市
社区管理员
  • fanstuck
  • 老师我作业忘带了
  • 一直在尽头
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

欢迎加入数学建模知识共享小岛~

岛主定期共享每个数学建模竞赛的思路和代码(纯开源免费获取)

有需要可以联系岛主

试试用AI创作助手写篇文章吧