﻿ 基于组合模型的农产品物价预测算法
 计算机系统应用  2019, Vol. 28 Issue (5): 185-189 PDF

1. 中国科学院大学 计算机控制与工程学院, 北京 100049;
2. 中国科学院 沈阳计算技术研究所, 沈阳 110168

Agricultural Product Price Forecasting Algorithm Based on Combination Model
SU Zhao-Jun1,2, GUO Rui-Feng2, GAO Cen2, WANG Mei-Ji2, LI Dong-Mei2
1. School of Computer and Control Engineering, University of Chinese Academy of Sciences, Beijing 100049, China;
2. Shenyang Institute of Computing Technology, Chinese Academy of Sciences, Shenyang 110168, China
Abstract: Nowadays, with the rapid development of science and technology, a number of new technologies have emerged. New scientific fields such as data mining and machine learning have been deeply studied. Many intelligent algorithms have emerged and applied to different fields. This paper constructs a combined model based on BP (Back Propagation) neural network and SVR (Support Vector Regression). Based on the agricultural product price data, the example verification analysis shows that compared with the single prediction model, the BP-SVR-BP prediction model has greatly improved the prediction accuracy. The fitting effect is closer to the real data curve, which can objectively and truly reflect the law of agricultural product price changes.
Key words: combined model     BP neural network     price forecasting     SVR forecasting     agricultural products

1 引言

2 BP-SVR-BP组合模型 2.1 组合模型组合方式

 图 1 BP-SVR-BP组合模型

2.2 优化BP神经网络

 ${{M}}_j^{} = \sum\limits_{i = 1}^n {W_{ij}^{(l)}} {X_i} + B_i^{(l)}$ (1)

 ${{{N}}_j} = {\psi _1}({M_j}) = {\psi _1}\left(\sum\limits_{{{i}} = 1}^n {W_{ij}^{(l)}{X_i} + B_i^{(l)}}\right)$ (2)

 ${{Z}} = \sum\limits_{j = 1}^k {W_{j1}^{(l)}{N_j}} + B_j^{(l)}$ (3)

 ${{{Y}}_{}} = {\psi _2}\left( Z \right) = {\psi _2}\left( {\sum\limits_{j = 1}^k {W_{j1}^{(l)}{N_j} + B_j^{(l)}} } \right)$ (4)

${p_i} = \left( {{p_{i1}}, {p_{i2}}, \cdots, {p_{iD}}} \right)$ 粒子i的位置 ${x_i} = ( {{x_{i1}}, {x_{i2}},}\cdots,$ ${ {x_{iD}}} )$ ; 粒子i的速度 ${v_i} = \left( {{v_{i1}}, {v_{i2}}, \cdots, {v_{iD}}} \right)$ ; 粒子i经过的历史最优位置; 粒子群整体经历的最优位置: ${{g}} = ( {{g_1}, }$ ${{g_2}, \cdots, {g_D}} )$ ; 则PSO速度更新公式为:

 $v_{iD}^{k + 1} = \omega v_{iD}^k + {c_1}{r_1}\left( {p_{iD}^k - x_{iD}^k} \right) + {c_2}{r_2}\left( {p_{gD}^k - x_{iD}^k} \right)$ (5)

 $x_{iD}^{k + 1} = x_{iD}^k + v_{iD}^{k + 1}$ (6)

$k$ 为: 第 $k$ 次迭代; ${c_1}, {c_2}$ 为学习率变量, ${r_1}, {r_2}$ 为[0, 1]范围之内的随机数, $\omega$ 为粒子群权重变量.

 $e = \frac{1}{n}\sum\limits_{j = 1}^n {{{\left( {{O_j} - {Y_j}} \right)}^2}}$ (7)

BP神经网络的学习率对网络的收敛速度有影响整. $\eta$ 过大, 收敛速度过快; $\eta$ 过小, 导致收敛速度过慢. 因此需采用一种动态改变的学习速率 $\eta$ .

 $\eta (k) = \left\{ {\begin{array}{*{20}{c}} 1.05\eta (k - 1),& E(k + 1) < E(k)\\ 0.75\eta (k - 1), &E(k + 1) > E(k)\\ \eta (k), &E(k + 1) = E(k) \end{array}} \right.$ (8)
2.3 支持向量回归机(SVR)模型

 $f(X) = {W^{\rm{T}}}\phi (X) + b$ (9)

 $\mathop {\min }\limits_{w, {\xi _i}, {{\hat \xi }_i}} \left( {\frac{1}{2}{{\left\| w \right\|}^2} + C\sum\limits_{i = 1}^m {\left( {{\xi _i} + {{\hat \xi }_i}} \right)} } \right)$ (10)

 $\left\{ \begin{array}{l} f({x_i}) - {y_i} + b \le \varepsilon + {\xi _i}\\ {y_i} - f({x_i}) - b \le \varepsilon + {{\hat \xi }_i}\\ {\xi _i} \ge 0, {{\hat \xi }_i} \ge 0, i = 1, 2, \cdots, m \end{array} \right.$ (11)
3 训练组合模型 3.1 数据集

 图 2 构建模型流程图

3.2 数据预处理

(1) 将数据发布时间转换为YYMMDD的时间格式, 例如2016/6/11转换为20160611.

(2) 采用前后k个数据的平均值填充缺失值.

(3) 采用MIN-MAX方法对特征数据归一化.

3.3 组合模型训练

(1) 预处理之后的数据, 选用集合数据(train_data)的70%作为训练数据(Train1), train_data的30%的数据作为测试数据(Test1). 将Train1数据分别输入到SVR算法和BP算法中训练出SVR模型(M1)和BP模型(M2). 将Test1输入到M1和M2模型中, 得到两组预测结果(P1, P2), 和真实数据(Price)组成三列数据(train_data2), 形如(P1, P2, Price). 将train_data2的80%作为训练集(Train2), train_data2的20%作为测试集(Test2), Train2训练集训练BP模型, 得到最优权重系数组合, 得到模型M3. 将Test2输入M3模型得到预测结果值.

(2) 对BP神经网络训练, 选择最优隐含层节点数目. 使用均方根误差(RMSE)衡量真实值和预测值之间的准确率, 如图3.

 图 3 隐藏层节点数-RMSE图

(3) SVR模型, 选用多项式核函数(Poly).

4 实验结果与分析 4.1 与单一模型对比分析

 图 4 时间-价格图

 图 5 时间-价格图

4.2 与组合模型对比分析

 图 6 组合模型时间-价格图

5 结语

 [1] 陈咏梅. 基于BP-ARIMA组合模型的福建滨海旅游市场规模预测. 厦门理工学院学报, 2018, 26(4): 22-26. [2] 马健, 盛魁, 董辉. 基于改进型误差函数的复值BP神经网络对股票价格的预测研究. 长春师范大学学报, 2018, 37(6): 85-90. [3] 朱叶, 喻晓玲. 基于组合模型的兵团农产品物流市场需求预测. 塔里木大学学报, 2016, 28(2): 52-60. DOI:10.3969/j.issn.1009-0568.2016.02.010 [4] 刘金源, 王寿喜, 李婵. 城市燃气日负荷PCA-GM-BPNN组合预测模型. 天然气与石油, 2018, 36(5): 13-19. DOI:10.3969/j.issn.1006-5539.2018.05.003 [5] 吴叶, 刘婷婷, 方少勇. 基于MIV-GA-BP神经网络的我国棉价预测研究. 棉纺织技术, 2018, 46(7): 77-80. DOI:10.3969/j.issn.1001-7415.2018.07.020 [6] 江粉桃. 非线性方法的时间序列组合模型在农产品价格预测中的应用研究[硕士学位论文]. 兰州: 兰州交通大学, 2018.