✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
⛄ 内容介绍
伴随着经济全球化的发展,一个亟待解决的全球性问题即环境问题逐渐的演变成一个非常重要的问题.环境问题涉及的范围很广,如温室气体的排放,大多数污染物排放量较高的产业发生跨国的迁移,资源能源的大量消耗以及不可再生资源的不断减少等等所有这一系列环境问题已经引起越来越多的学术界的重视和研究.2007年,我国超过美国成为二氧化碳排放总量世界第一,也是世界上第二位能源生产国.我国是一个贸易出口大国,在贸易的流通当中,工业产品占据我国贸易的绝对主导地位,正因如此,也给我国带来了不可估量的环境成本.如何去解决环境问题是我们每个人都需要思考的问题.
⛄ 部分代码
% In these codes we will show an example of using reccurent expanssion with
% multiple reapeats (REMR)for improving deep representations of LSTM under
% regression problem.
% 'simplefit_dataset' is used as an example in this case.
% Please refer to this paper for more information about the algorithm:
% T. Berghout, M. Benbouzid, T. Bentrcia, Y. Amirat, and L. Mouss,
% 揈xposing Deep Representations to a Recurrent Expansion with Multiple
% Repeats for Fuel Cells Time Series Prognosis,?Entropy, pp. 1?3, 2022.
% *Note* : It should be mentioned that REMR rules suffer from difficulties in
% finding the appropriate initial mappings allowing better AULC convergence.
% In this case, for future perspectives, it is worth seeking better strategies
% to initialize the REMR especially for first round
%
clc
clear
rng('default')
addpath('REDL');
%% Load dataset
load('simplefit_dataset');
%% Divide dataset into training and testing
Q=size(simplefitInputs,2);
trainRatio=0.7;
testRatio=1-trainRatio;
[trainInd,~,testInd] = divideint(Q,trainRatio,0,testRatio);
%
xtr=simplefitInputs(:,trainInd)';
ytr=simplefitTargets(:,trainInd)';
%
xts=simplefitInputs(:,testInd)';
yts=simplefitTargets(:,testInd)';
%% Define training rounds and number of PCA components for dimensionality reduction
rounds=20;
number_of_componenets=2;% Number of PCA componenets
%% Intialize new feature mapps
xtr_new=[];
xts_new=[];
%% Begine the training process
for j=1:rounds
% Training the j_th deep network
[network{j}]= LSTM_TB(xtr,ytr);
% Collect mapping results Q and y_hat from representations
LSTM=network{j}.LSTM;
%
[Q_tr]= LSTM_Mapp(LSTM,xtr);
ytr_hat{j} = predict(LSTM,xtr');
% Build the new feature space for training
xtr_new=[xtr_new Q_tr ytr_hat{j}'];
% Collect testing features
[Q_ts]=LSTM_Mapp(LSTM,xts);
yts_hat{j} = predict(LSTM,xts');
% Build the new feature space for testing
xts_new=[xts_new Q_ts yts_hat{j}'];
% Preprocessing & dimensionality reduction
[xtr_new,xts_new]=preproces(xtr_new,xts_new,number_of_componenets);
% Evalute model accuracy at each round
% Testing
[Metrics_ts{j,1}]= peformance(yts,yts_hat{j}');
% Update training inputs
xtr=xtr_new;
% Normelize training inputs
Mu_tr=mean(xtr,'all');
Std_tr=std(xtr,0,'all');
[xtr]=Scaledata_Mu_Std(xtr,Mu_tr,Std_tr);
% Update testing inputs
xts=xts_new;
% Normelize testing inputs
Mu_ts=mean(xts,'all');
Std_ts=std(xts,0,'all');
[xts]=Scaledata_Mu_Std(xts,Mu_ts,Std_ts);
end
%
Metrics_ts=struct2table(cell2mat(Metrics_ts'));
clearvars -except Metrics_ts network rounds
%
%% Plotting of results ( _Loss_ function, _AULC_, _RMSE_, _MAPE_, and _MAE_)
%
% Plot performances of trainig ( Loss)
%
figure (1)
subplot(1,3,1)
steps=5;
for i=1:steps:rounds
l=network{i}.info.TrainingLoss;
plot(l,'lineWidth',2)
hold on
end
hold off
xlabel({'Epoch','(a)'})
ylabel('Loss')
lgd=legend('Round 1',...
'Round 6',...
'Round 11',...
'Round 16');
lgd.EdgeColor='none';
lgd.Color='none';
%
% plot Area Under Loss Curve ( AULC) first part
%
subplot(1,3,2)
for i=1:rounds
l=network{i}.info.TrainingLoss;
Area(i) = trapz(l);
end
plot(smooth(Area,10),'lineWidth',2);
xlabel({'Rounds','(b)'})
ylabel('AULC')
%
% Plot metrics ( RMSE, MAPE, and MAE)
%
subplot(1,3,3)
plot(smooth(Metrics_ts.RMSE),'DisplayName','Metrics_Challenge.RMSE','LineWidth',2);
hold on;
plot(smooth(Metrics_ts.MAPE),'DisplayName','Metrics_Challenge.MAPE','LineWidth',2);
plot(smooth(Metrics_ts.MAE),'DisplayName','Metrics_Challenge.MAE','LineWidth',2);
xlabel({'Rounds','(b)'})
ylabel('Accuracy')
lgd=legend('RMSE',...
'MPAE',...
'MAE');
lgd.EdgeColor='none';
lgd.Color='none';
hold off;
⛄ 运行结果
⛄ 参考文献
[1]周志斌. 经济发展对CO2排放的影响——基于省际数据的研究[D]. 西南财经大学, 2017.