[MATLAB Issue 78] Optimizing LSTM time series prediction model based on MATLAB's VMD-SSA-LSTM sparrow algorithm

[MATLAB Issue 78] Optimizing LSTM time series prediction model based on MATLAB's VMD-SSA-LSTM sparrow algorithm

1. LSTM

data = xlsread('数据集.xlsx');%
[x,y]=data_process(data,15);%15个时刻 预测下一个时刻
%归一化
[xs,mappingx]=mapminmax(x',0,1);x=xs';
[ys,mappingy]=mapminmax(y',0,1);y=ys';
%划分数据
n=size(x,1);
m=round(n*0.7);%70%训练,对最后30%进行预测
options = trainingOptions('adam', ...
    'MaxEpochs',35, ...
    'ExecutionEnvironment' ,'cpu',...
    'GradientThreshold',1, ...
    'InitialLearnRate',0.001, ...
    'LearnRateSchedule','piecewise', ...
    'LearnRateDropPeriod',30, ...
    'LearnRateDropFactor',0.2, ...%指定初始学习率 0.005,在 125 轮训练后通过乘以因子 0.2 来降低学习率
    'L2Regularization',0.0001,...
    'Verbose',0);

Single LSTM prediction
………………………………………………………………………………………………………………………………
Training set error indicators:
Root mean square error (RMSE): 0.021219
Mean absolute error (MAE): 0.016203
Mean relative percentage error (MAPE): 2.7615%

Test set error indicators:
Root mean square error (RMSE): 0.024491
Mean absolute error (MAE): 0.019084
Mean relative percentage error (MAPE): 3.2038%

Insert image description here

2. VMD-LSTM

Insert image description here
VMD-LSTM prediction
…………………………………………………………………………………………………………
1st component modeling
2nd component modeling 3rd component
modeling 4th component modeling
5th
component modeling
6th component modeling
7th component modeling
8th component modeling
9th Component modeling
Training set error indicators:
Root mean square error (RMSE): 0.019865
Mean absolute error (MAE): 0.014202
Mean relative percentage error (MAPE): 2.3709%

Test set error indicators:
Root mean square error (RMSE): 0.01275
Mean absolute error (MAE): 0.011012
Mean relative percentage error (MAPE): 1.8442%

Insert image description here

3. VMD-SSA-LSTM

pop=5; % 麻雀数量
Max_iteration=5; % 最大迭代次数
dim=3; % 优化lstm的3个参数
lb = [40,40,0.001];%下边界
ub = [200,200,0.03];%上边界

The optimal number of hidden units is 144,
the optimal maximum training period is 150,
the optimal initial learning rate is 0.012689, and
the optimal L2 regularization coefficient is 149.8417

Training set error indicators:
Root mean square error (RMSE): 0.005728
Mean absolute error (MAE): 0.0044444
Mean relative percentage error (MAPE): 0.77018%

Test set error indicators:
Root mean square error (RMSE): 0.005453
Mean absolute error (MAE): 0.004349
Mean relative percentage error (MAPE): 0.74173%
Insert image description here

4. Code acquisition

CSDN private message reply "Issue 78" to get the download method.

Guess you like

Origin blog.csdn.net/qq_29736627/article/details/133365502