Multiple input and multiple output | MATLAB implements PSO-LSSVM particle swarm optimization least squares support vector machine multiple input and multiple output

Multiple input and multiple output | MATLAB implements PSO-LSSVM particle swarm optimization least squares support vector machine multiple input and multiple output

Prediction effect

Insert image description here
Insert image description here
Insert image description here

Insert image description here
Insert image description here

basic introduction

MATLAB implements PSO-LSSVM particle swarm optimization least squares support vector machine multi-input multi-output
1.data is a data set with 10 input features and 3 output variables.
2.main.m is the main program file.
3. The command window outputs MBE, MAE and R2, and the data and program content can be obtained in the download area.

programming

  • How to download the complete program and data: Private message the blogger to reply to MATLAB to implement PSO-LSSVM particle swarm optimization least squares support vector machine multiple input and multiple output .
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
%%  参数初始化
c1      = 4.494;       % 学习因子
c2      = 4.494;       % 学习因子
maxgen  =   50;        % 种群更新次数  
sizepop =    5;        % 种群规模
Vmax    =  1.0;        % 最大速度
Vmin    = -1.0;        % 最小速度
popmax  =  1.0;        % 最大边界
popmin  = -1.0;        % 最小边界
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
for i = 1 : sizepop
    pop(i, :) = rands(1, numsum);  % 初始化种群
    V(i, :) = rands(1, numsum);    % 初始化速度
    fitness(i) = fun(pop(i, :), hiddennum, net, p_train, t_train);
end
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
%%  个体极值和群体极值
[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;
      
        
        % 适应度值
        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

 

    end

    BestFit = [BestFit, fitnesszbest];    
end

Past highlights

MATLAB implements RBF radial basis neural network multi-input multi-output prediction
MATLAB implements BP neural network multi-input multi-output prediction
MATLAB implements DNN neural network multi-input multi-output prediction

References

[1] https://blog.csdn.net/kjm13182345320/article/details/116377961
[2] https://blog.csdn.net/kjm13182345320/article/details/127931217
[3] https://blog.csdn.net/kjm13182345320/article/details/127894261

Guess you like

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