Classification prediction | MATLAB implements MTBO-CNN multi-input classification prediction

Classification prediction | MATLAB implements MTBO-CNN multi-input classification prediction

predictive effect

insert image description here
insert image description here
insert image description here
insert image description here

basic introduction

1. MATLAB implements MTBO-CNN multi-input classification prediction
2. Code description: Data classification prediction program based on mountaineering team optimization algorithm (MTBO) and convolutional neural network (CNN).
Program platform: Matlab version 2021 and above are required.
Features:
The learning rate, the size of the convolution kernel, and the number of convolution kernels are optimized through the mountaineering team optimization algorithm. These three key parameters take the highest accuracy of the test set as the objective function. Drawing: Loss, precision iterative change diagram; test comparison scatter diagram, confusion matrix diagram; fitness curve (if the accuracy of the first round is the highest, the fitness curve is a horizontal straight line). Display: precision, recall rate, precision rate, F1 score and other evaluation indicators. The data can be directly replaced and imported using the EXCEL form without greatly modifying the program. There are detailed comments inside the code, which is easy to understand the operation of the program.
The Mountaineering Team-Based Optimization (MTBO) algorithm was proposed by Faridmehr in March 2023. The algorithm is based on the coordinated intelligence and environmental evolution of human behavior. The mountaineering team consists of multiple climbers with experienced and professional leaders, whose goal is to conquer the mountain tops in the area, which are considered to be the final global solution to the optimization problem.

programming

  • Complete program and data acquisition method 1: program exchange of equal value;
  • The complete program and data acquisition method 2: Private message bloggers reply to MATLAB to achieve MTBO-CNN multi-input classification prediction acquisition.
%%  划分训练集和测试集
P_train = res(1: num_train_s, 1: f_)';
T_train = res(1: num_train_s, f_ + 1: end)';
M = size(P_train, 2);

P_test = res(num_train_s + 1: end, 1: f_)';
T_test = res(num_train_s + 1: end, f_ + 1: end)';
N = size(P_test, 2);

%%  数据归一化
[p_train, ps_input] = mapminmax(P_train, 0, 1);
p_test = mapminmax('apply', P_test, ps_input);

[t_train, ps_output] = mapminmax(T_train, 0, 1);
t_test = mapminmax('apply', T_test, ps_output);
%%  个体极值和群体极值
[fitnesszbest, bestindex] = min(fitness);
zbest = pop(bestindex, :);     % 全局最佳
gbest = pop;                   % 个体最佳
fitnessgbest = fitness;        % 个体最佳适应度值
BestFit = fitnesszbest;        % 全局最佳适应度值

%%  迭代寻优
for i = 1 : maxgen
    for j = 1 : sizepop
        
        % 速度更新
        V(j, :) = V(j, :) + c1 * rand * (gbest(j, :) - pop(j, :)) + c2 * rand * (zbest - pop(j, :));
        V(j, (V(j, :) > Vmax)) = Vmax;
        V(j, (V(j, :) < Vmin)) = Vmin;
        
        % 种群更新
        pop(j, :) = pop(j, :) + 0.2 * V(j, :);
        pop(j, (pop(j, :) > popmax)) = popmax;
        pop(j, (pop(j, :) < popmin)) = popmin;
        
        % 自适应变异
        pos = unidrnd(numsum);
        if rand > 0.95
            pop(j, pos) = rands(1, 1);
        end
        
        % 适应度值
        fitness(j) = fun(pop(j, :), hiddennum, net, p_train, t_train);

    end
    
    for j = 1 : sizepop

        % 个体最优更新
        if fitness(j) < fitnessgbest(j)
            gbest(j, :) = pop(j, :);
            fitnessgbest(j) = fitness(j);
        end

        % 群体最优更新 
        if fitness(j) < fitnesszbest
            zbest = pop(j, :);
            fitnesszbest = fitness(j);
        end

    end

    BestFit = [BestFit, fitnesszbest];    
end
————————————————
版权声明:本文为CSDN博主「机器学习之心」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/kjm13182345320/article/details/130462492


References

[1] https://blog.csdn.net/kjm13182345320/article/details/129679476?spm=1001.2014.3001.5501
[2] https://blog.csdn.net/kjm13182345320/article/details/129659229?spm=1001.2014.3001.5501
[3] https://blog.csdn.net/kjm13182345320/article/details/129653829?spm=1001.2014.3001.5501

Guess you like

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