Regression prediction | MATLAB implements regression prediction based on LSTM-AdaBoost long short-term memory network combined with AdaBoost multi-input single-output

Regression prediction | MATLAB implements regression prediction based on LSTM-AdaBoost long short-term memory network combined with AdaBoost multi-input single-output

predictive effect

1

2

basic introduction

1. MATLAB realizes regression prediction based on LSTM-AdaBoost long short-term memory network combined with AdaBoost multi-input single-output;
2. The operating environment is Matlab2020b;
3. Input multiple features, output a single variable, and multivariate regression prediction;
4.data is a data set , excel data, the first 7 columns are input, the last 1 column is output, main.m is the main program, just run it, and all files are placed in one folder; 5. The
command window outputs R2, MSE, MAE, MAPE and MBE multi-index evaluation .

Model description

AdaBoost multiple-input single-output regression prediction based on LSTM-AdaBoost long short-term memory network is an ensemble learning method that aims to use multiple input variables to predict the value of a single output variable. It combines the advantages of LSTM network and AdaBoost algorithm, which can capture the long-term dependence and nonlinear relationship of time series data and improve the prediction accuracy.
LSTM network is a recurrent neural network suitable for sequence data, which can effectively deal with long-term dependence problems through gating mechanism. AdaBoost is an ensemble learning algorithm that improves prediction accuracy by weighting and combining multiple weak learners. Combining these two methods, the LSTM network can be used to extract the features of the sequence data, and then use these features as the input of AdaBoost, and predict the value of the output variable through the weighted combination of multiple weak learners.
The specific implementation steps are as follows:
Data preprocessing: Divide the input data into multiple sequences in chronological order, and each sequence contains multiple input variables and one output variable.
LSTM feature extraction: For each sequence, its feature representation is extracted using an LSTM network. Use the output of the LSTM network as the input data for AdaBoost.
AdaBoost regression: The output of the LSTM network is used as the input data of AdaBoost, and multiple weak learners are used to perform regression prediction on the output variable. The weights of each weak learner are updated according to its prediction error to improve the overall prediction accuracy.
Prediction output: The prediction results of multiple weak learners are weighted and combined to obtain the final prediction output result.
It should be noted that cross-validation and parameter tuning are required in the implementation process to avoid over-fitting and under-fitting problems. At the same time, in order to improve the robustness of the model, methods such as bagging and random forest in integrated learning can be used to further improve the prediction accuracy.

programming

  • Complete source code and data acquisition method: private message blogger;
%% 预测
t_sim1 = predict(net, p_train); 
t_sim2 = predict(net, p_test ); 

%%  数据反归一化
T_sim1 = mapminmax('reverse', t_sim1, ps_output);
T_sim2 = mapminmax('reverse', t_sim2, ps_output);

%%  均方根误差
error1 = sqrt(sum((T_sim1' - T_train).^2) ./ M);
error2 = sqrt(sum((T_sim2' - T_test ).^2) ./ N);


%%  相关指标计算
%  R2
R1 = 1 - norm(T_train - T_sim1')^2 / norm(T_train - mean(T_train))^2;
R2 = 1 - norm(T_test  - T_sim2')^2 / norm(T_test  - mean(T_test ))^2;

disp(['训练集数据的R2为:', num2str(R1)])
disp(['测试集数据的R2为:', num2str(R2)])

%  MAE
mae1 = sum(abs(T_sim1' - T_train)) ./ M ;
mae2 = sum(abs(T_sim2' - T_test )) ./ N ;

disp(['训练集数据的MAE为:', num2str(mae1)])
disp(['测试集数据的MAE为:', num2str(mae2)])

%% 平均绝对百分比误差MAPE
MAPE1 = mean(abs((T_train - T_sim1')./T_train));
MAPE2 = mean(abs((T_test - T_sim2')./T_test));

disp(['训练集数据的MAPE为:', num2str(MAPE1)])
disp(['测试集数据的MAPE为:', num2str(MAPE2)])

%  MBE
mbe1 = sum(abs(T_sim1' - T_train)) ./ M ;
mbe2 = sum(abs(T_sim1' - T_train)) ./ N ;

disp(['训练集数据的MBE为:', num2str(mbe1)])
disp(['测试集数据的MBE为:', num2str(mbe2)])

%均方误差 MSE
mse1 = sum((T_sim1' - T_train).^2)./M;
mse2 = sum((T_sim2' - T_test).^2)./N;

disp(['训练集数据的MSE为:', num2str(mse1)])
disp(['测试集数据的MSE为:', num2str(mse2)])

References

[1] https://blog.csdn.net/kjm13182345320/article/details/128577926?spm=1001.2014.3001.5501
[2] https://blog.csdn.net/kjm13182345320/article/details/128573597?spm=1001.2014.3001.5501

Guess you like

Origin blog.csdn.net/kjm13182345320/article/details/131198457