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

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

predictive effect

1
2

2
3
4
5
6
7
8

basic introduction

Matlab implements SO-CNN-BiLSTM snake swarm algorithm to optimize convolutional bidirectional long-term short-term memory network multi-input regression prediction (complete source code and data) 1. Matlab
implements SO-CNN-BiLSTM snake swarm algorithm to optimize convolutional bidirectional long-term short-term memory network (CNN -BiLSTM) 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-indicator evaluation, evaluation indicators include: R2, MAE, MSE, RMSE etc., the code 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-BiLSTM snake swarm algorithm is a neural network model for prediction, which combines the advantages of convolutional neural network (CNN) and bidirectional long-term short-term memory neural network (BiLSTM), which can effectively capture the long-term Dependencies and local features.
In the SO-CNN-BiLSTM snake swarm algorithm, CNN is first used to extract features from the input data, and then the extracted feature sequences are input into BiLSTM for modeling. Then, the snake swarm algorithm is used to optimize the model to improve the prediction accuracy and generalization ability of the model.
Multi-input single-output regression prediction means that the model accepts multiple input sequences, such as data from multiple sensors, and then predicts an output sequence, such as temperature or stock price. This model has a wide range of applications in many fields, such as finance, meteorology, medical care, etc.
The SO-CNN-BiLSTM snake swarm algorithm can be applied to multiple-input single-output regression prediction problems. It can handle multiple input sequences and can capture the dependencies between sequences to achieve more accurate predictions. In practical applications, appropriate parameter adjustment and model optimization can be performed according to specific problems to obtain the best performance.

6

Deep learning network structure based on convolutional neural network and bidirectional long short-term memory (BiLSTM) neural network. Using the method of feature fusion, the shallow features and deep features are extracted and connected through the convolutional network, the features are fused through convolution, and the obtained vector information is input into the BiLSTM unit.

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