Regression prediction | MATLAB implements SO-CNN-LSTM snake swarm algorithm to optimize convolutional long-term short-term memory neural network multi-input single-output regression prediction

Regression prediction | MATLAB implements SO-CNN-LSTM snake swarm algorithm to optimize convolutional long-term short-term memory neural network multi-input single-output regression prediction

predictive effect

1

2
3
4
5
6
7
8
9
10
11
12

basic introduction

MATLAB implements SO-CNN-LSTM snake swarm algorithm to optimize convolutional long-term short-term memory neural network multi-input single-output regression prediction (complete source code and data) 1. MATLAB
implements SO-CNN-LSTM snake swarm algorithm to optimize convolutional long-term short-term memory neural network Multi-input single-output regression prediction (complete source code and data)
2. Input multiple features, output a single variable, multi-input single-output regression prediction;
3. Multi-index evaluation, evaluation indicators include: R2, MAE, MSE, RMSE, etc., code The quality is extremely high;
4. The optimization parameters of the snake swarm algorithm are: learning rate, hidden layer nodes, and regularization parameters;
5. Excel data, easy to replace, and the operating environment is 2020 and above.

Model description

SO-CNN-LSTM snake swarm algorithm is an algorithm for optimizing convolutional long short-term memory neural network, which is used for regression prediction problems with multiple inputs and single outputs. Below I will explain the various components of this algorithm step by step.
First, Convolutional Long Short-Term Memory Neural Network (Convolutional LSTM). It is a hybrid model combining a convolutional neural network and a long short-term memory neural network, capable of processing sequence data and image data. In convolutional LSTMs, convolutional layers are used to extract features of the input data, and LSTM layers are used to model the temporal dependencies of these features in order to model sequence data.
SO-CNN-LSTM snake swarm algorithm. This algorithm is an algorithm optimized by the snake swarm algorithm, which can help us find the optimal model parameters during the training process. In this algorithm, we use the parameters of the convolutional LSTM network as variables to be optimized, and use the snake swarm algorithm for parameter search. The snake swarm algorithm is a heuristic algorithm that simulates the foraging behavior of snakes, and can efficiently find the optimal solution in the search space. Multiple-Input Single-Output Regression Forecasting Problem. This is a problem of mapping multiple input data to one output data. In this case, we can use a convolutional LSTM network to process each input data and then combine their results together to get the final output result. During training, we can train the model with known input and output data so that it can make accurate predictions on the input data. In general, the SO-CNN-LSTM snake swarm algorithm is an algorithm for optimizing convolutional long short-term memory neural networks for regression prediction problems with multiple inputs and single outputs. It helps us find the optimal model parameters during training so that we can make accurate predictions on the input data.

6

programming

%%  获取最优种群
   for j = 1 : SearchAgents
       if(fitness_new(j) < GBestF)
          GBestF = fitness_new(j);
          GBestX = X_new(j, :);
       end
   end
   
%%  更新种群和适应度值
   pop_new = X_new;
   fitness = fitness_new;

%%  更新种群 
   [fitness, index] = sort(fitness);
   for j = 1 : SearchAgents
      pop_new(j, :) = pop_new(index(j), :);
   end

%%  得到优化曲线
   curve(i) = GBestF;
   avcurve(i) = sum(curve) / length(curve);
end

%%  得到最优值
Best_pos = GBestX;
Best_score = curve(end);

%%  得到最优参数
NumOfUnits       =abs(round( Best_pos(1,3)));       % 最佳神经元个数
InitialLearnRate =  Best_pos(1,2) ;% 最佳初始学习率
L2Regularization = Best_pos(1,1); % 最佳L2正则化系数
% 
inputSize = k;
outputSize = 1;  %数据输出y的维度  
%  参数设置
opts = trainingOptions('adam', ...                    % 优化算法Adam
    'MaxEpochs', 20, ...                              % 最大训练次数
    'GradientThreshold', 1, ...                       % 梯度阈值
    'InitialLearnRate', InitialLearnRate, ...         % 初始学习率
    'LearnRateSchedule', 'piecewise', ...             % 学习率调整
    'LearnRateDropPeriod', 6, ...                     % 训练次后开始调整学习率
    'LearnRateDropFactor',0.2, ...                    % 学习率调整因子
    'L2Regularization', L2Regularization, ...         % 正则化参数
    'ExecutionEnvironment', 'gpu',...                 % 训练环境
    'Verbose', 0, ...                                 % 关闭优化过程
    'SequenceLength',1,...
    'MiniBatchSize',10,...
    'Plots', 'training-progress');                    % 画出曲线

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/132023230