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

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

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法       神经网络预测       雷达通信      无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机

⛄ 内容介绍

随着大数据、云计算技术的兴起,越来越多的回归模型、分类模型出现在人们的视野中。同时也伴随着越来越多的模型的改进与成熟。这些技术的发展,成熟以及农产品价格数据的出现为农产品价格预测走进研究人员的视野提供了契机,引起了很多研究人员的关注。中国作为农产品生产以及消费大国,农产品的价格不仅关乎着消费者的利益,同时也对于农产品生产的调控有着重要意义。现在的农产品价格预测模型主要是数据挖掘、机器学习领域中的方法,对于时间序列分析的应用较为少见,而且传统的时间序列分析对于价格的有很大的延迟性,导致预测的精度较差。本文建立基于遗传算法优化支持向量机GA-SVM农产品价格时间序列预测模型。

⛄ 运行结果

【SVM时序预测】基于遗传算法优化支持向量机GA-SVM农产品价格时间序列预测附matlab代码_遗传算法

【SVM时序预测】基于遗传算法优化支持向量机GA-SVM农产品价格时间序列预测附matlab代码_支持向量机_02

【SVM时序预测】基于遗传算法优化支持向量机GA-SVM农产品价格时间序列预测附matlab代码_支持向量机_03

【SVM时序预测】基于遗传算法优化支持向量机GA-SVM农产品价格时间序列预测附matlab代码_遗传算法_04

⛄ 部分代码展示

function NewChrom = xovmp(OldChrom, Px, Npt, Rs)

%%  多点交叉

%       This function takes a matrix OldChrom containing the binary

%       representation of the individuals in the current population,

%       applies crossover to consecutive pairs of individuals with

%       probability Px and returns the resulting population.

%

%       Npt indicates how many crossover points to use (1 or 2, zero

%       indicates shuffle crossover).

%       Rs indicates whether or not to force the production of

%       offspring different from their parents.

% Identify the population size (Nind) and the chromosome length (Lind)

%%  一致性检查

[Nind, Lind] = size(OldChrom);

if Lind < 2

    NewChrom = OldChrom;

    return

end

if nargin < 4

    Rs = 0;

end

if nargin < 3

    Npt = 0;

    Rs = 0;

end

if nargin < 2

    Px = 0.7;

    Npt = 0;

    Rs = 0;

end

if isnan(Px)

    Px = 0.7;

end

if isnan(Npt)

    Npt = 0;

end

if isnan(Rs)

    Rs = 0;

end

if isempty(Px)

    Px = 0.7;

end

if isempty(Npt)

    Npt = 0;

end

if isempty(Rs)

    Rs = 0;

end

Xops = floor(Nind / 2);

DoCross = rand(Xops, 1) < Px;

odd = 1: 2: Nind - 1;

even = 2: 2: Nind;

%%  计算每对染色体的有效长度

Mask = ~Rs | (OldChrom(odd, :) ~= OldChrom(even, :));

Mask = cumsum(Mask')';

%%  根据有效长度和 Px 计算每对个体的交叉站点(两个相等的交叉站点意味着没有交叉)

xsites(:, 1) = Mask(:, Lind);

if Npt >= 2

    xsites(:, 1) = ceil(xsites(:, 1) .* rand(Xops, 1));

end

xsites(:, 2) = rem(xsites + ceil((Mask(:, Lind) - 1) .* rand(Xops, 1)) ...

                                .* DoCross - 1, Mask(:, Lind)) + 1;

%%  以 0-1 掩码表示跨站点

Mask = (xsites(:, ones(1, Lind)) < Mask) == ...

                        (xsites(:, 2 * ones(1, Lind)) < Mask);

if ~Npt

    shuff = rand(Lind, Xops);

    [~, shuff] = sort(shuff);

    for i = 1: Xops

        OldChrom(odd(i), :) = OldChrom(odd(i), shuff(:, i));

        OldChrom(even(i), :) = OldChrom(even(i), shuff(:, i));

    end

end

%%  执行交叉

NewChrom(odd, :) = (OldChrom(odd, :) .* Mask) + (OldChrom(even, :) .* (~Mask));

NewChrom(even, :) = (OldChrom(odd, :) .* (~Mask)) + (OldChrom(even, :) .* Mask);

%%  如果个体数为奇数,最后一个个体不能交配,但必须包含在新种群中

if rem(Nind, 2)

  NewChrom(Nind, :) = OldChrom(Nind, :);

end

if ~Npt

    [~, unshuff] = sort(shuff);

    for i = 1: Xops

        NewChrom(odd(i), :) = NewChrom(odd(i), unshuff(:, i));

        NewChrom(even(i), :) = NewChrom(even(i), unshuff(:, i));

    end

end

⛄ 参考文献

[1] 方向, 丁兆军, 舒新前. 基于遗传算法优化的支持向量机(SVM-GA)低阶煤制氢产量预测模型[J]. 煤炭学报, 2010(S1):5.

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

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

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

⛳️ 代码获取关注我

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