✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

⛄ 内容介绍

为了得到性能优越的SVM预测 模型,实现失业率的准确预测,文中提出基于遗传算法优化支持向量机(GA-SVM)的失业率预测方法.其中通过遗传算法对SVM中的训练参数 进行优化处理,以得到优化的SVM预测模型.实验结果表明:用GA-SVM对失业率预测,预测精度远优于人工神经网络.

⛄ 部分代码

function NewChrom = recombin(REC_F, Chrom, RecOpt, SUBPOP)

%%  重组高级函数

% This function performs recombination between pairs of individuals

% and returns the new individuals after mating. The function handles

% multiple populations and calls the low-level recombination function

% for the actual recombination process.

%

% Input parameters:

%    REC_F     - String containing the name of the recombination or

%                crossover function

%    Chrom     - Matrix containing the chromosomes of the old

%                population. Each line corresponds to one individual

%    RecOpt    - (optional) Scalar containing the probability of 

%                recombination/crossover occurring between pairs

%                of individuals.

%                if omitted or NaN, 1 is assumed

%    SUBPOP    - (optional) Number of subpopulations

%                if omitted or NaN, 1 subpopulation is assumed

%

% Output parameter:

%    NewChrom  - Matrix containing the chromosomes of the population

%                after recombination in the same format as OldChrom.

%%  一致性检查

if nargin < 2

    error('Not enough input parameter');

end

%%  确定种群规模 (Nind)

[Nind,~] = size(Chrom);

if nargin < 4

    SUBPOP = 1;

end

if nargin > 3

    if isempty(SUBPOP)

        SUBPOP = 1;

    elseif isnan(SUBPOP)

        SUBPOP = 1;

    elseif length(SUBPOP) ~= 1

        error('SUBPOP must be a scalar');

    end

end

if (Nind / SUBPOP) ~= fix(Nind / SUBPOP)

    error('Chrom and SUBPOP disagree');

end

%%  计算每个亚群的个体数量

Nind = Nind / SUBPOP;

if nargin < 3

    RecOpt = 0.7;

end

if nargin > 2

    if isempty(RecOpt)

        RecOpt = 0.7;

    elseif isnan(RecOpt)

        RecOpt = 0.7;

    elseif length(RecOpt) ~= 1

        error('RecOpt must be a scalar');

    elseif (RecOpt < 0 || RecOpt > 1)

        error('RecOpt must be a scalar in [0, 1]');

    end

end

%%  选择一个亚群的个体并调用低级函数

NewChrom = [];

for irun = 1: SUBPOP

    ChromSub = Chrom((irun - 1) * Nind + 1 : irun * Nind, :);  

    NewChromSub = feval(REC_F, ChromSub, RecOpt);

    NewChrom = [NewChrom; NewChromSub];

end

⛄ 运行结果

【SVM时序预测】基于遗传算法优化支持向量机GA-SVM的失业率时间序列预测附matlab代码_支持向量机

【SVM时序预测】基于遗传算法优化支持向量机GA-SVM的失业率时间序列预测附matlab代码_支持向量机_02

【SVM时序预测】基于遗传算法优化支持向量机GA-SVM的失业率时间序列预测附matlab代码_遗传算法_03

【SVM时序预测】基于遗传算法优化支持向量机GA-SVM的失业率时间序列预测附matlab代码_scala_04

⛄ 参考文献

[1] 孙超. 基于遗传算法优化支持向量机模型的变形预测分析[D]. 山东科技大学, 2016.

[2] 朱伟. 基于遗传算法优化支持向量机的铁路客运量预测[D]. 重庆交通大学, 2013.

[3] 高青. 基于遗传算法优化支持向量机的物流需求预测研究[J]. 宿州学院学报, 2016, 31(012):31-35.

⛳️ 完整代码

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料