摘要
针对农业温室大棚温度测量受噪声影响不易直接预测的问题,提出一种将XGBoost(extreme gradient boosting)和Kalman filter相结合的集成预测模型XGB-KF(extreme gradient boosting with Kalman filter)。该模型首先基于XGBoost对温室内部当前时刻的温度值进行初步估计,使用卡尔曼滤波(Kalman filter)对得到的估计结果进行动态修正,得到最终的预测结果。基于涿州地区农业温室大棚的传感器数据进行了数值实验,以均方根误差(root mean square error,RMSE)作为主要指标对模型进行性能评估。与XGBoost、Bi-LSTM和Bi-LSTM-KF方法相比较,XGB-KF的RMSE分别降低5.22%、10.85%、7.45%。
温度作为农作物生长的重要环境因素,影响着作物的生长速度、产量和质量,如何准确预测和调控温度成为现代农业的重要问题。温室大棚拥有可调控的环境,促进作物生长和提高产量。中国温室建设起步较早,经历了改良型日光温室、大型玻璃温室和现代化温室3个阶段,但受各地区生产状况和经济条件的影响,至今各阶段不同类型的温室依然并
1)传统时间序列分析方法,如自回归移动平均模型(autoregressive moving average, ARMA
2)机器学习方法。针对温室温度或湿度的预测,极限学习机及其改进方
3)深度学习方法。周翔
4)混合模型法。Song
卡尔曼滤波作为一种最优线性状态估计方法,由卡尔曼在1960年提
针对农业温室温度预测问题,研究提出一种将XGBoost(extreme gradient boosting)和Kalman filter相结合的集成模型XGB-KF。该模型首先利用温室内外的相关协变量数据,基于XGBoost对温室内当前时刻的温度进行初步预测,再通过Kalman filter对估计结果进行动态修正。实验结果表明,XGB-KF法在温室温度预测上更准确有效。
XGBoost是一种基于梯度提升决策树(gradient boosting decision tree, GBDT)的改进算
, | (1) |
其中:是线性空间上的表达;表示第个样本;表示第棵树;是第个样本的预测值:;表示棵树的复杂度,表示第k棵树的函数。
由于
, | (2) |
则目标函数可以转化成如下形式
。 | (3) |
卡尔曼滤波适合使用在具有不确定性的动态系统中,基于系统中的观测值和估计值得到一个比任何依据自身估计更好的结果,从而对系统的下一步走向做出预测。
XGB-KF模型的流程如

图1 XGB-KF模型流程
Fig. 1 Flow chart of XGB-KF model
原始数据经预处理后,协变量数据(温室内、外部湿度、气压)作为XGBoost的输入数据,温室内部温度值作为XGBoost的预测目标。训练好的XGBoost被用于估计当前时刻的温室内部温度。与此同时,Kalman filter使用温室内部温度数据作为输入,通过数据的历史观测值得到当前时刻的单步预测结果。最后,将Kalman Filter得到的结果作为系统观测值,将XGBoost得到的结果作为系统估计值,融合这2个值得到最终预测结果。
数据来自科大讯飞开放平台提供的中国农业大学涿州实验站的温室温度数据,数据的时间范围为2019年3月14日1点-2019年4月3日0点,每条数据由时间戳和温室内、外的温度、湿度、气压构成,采样频率为每min 1次。实验中,数据按4:1的比例划分训练集和测试集,最终的实验结果由各方法在测试集上评估得到。
温室内、外的温度变化情况可视化如

图2 温室内、外温度变化情况
Fig. 2 The change of temperature inside and outside the greenhouse

图3 室内温度平稳化结果
Fig. 3 Results of indoor temperature stabilization
删除温室内部温度的缺失数据,以免填充方法不当造成更大误差,然后采用3法则检测气压特征数据中存在的异常值,使用前后数据进行线性修正。最后,通过皮尔逊相关系数筛选出相关性较高的3个特征(温室外部和温室内部的湿度差值、比值以及湿度的乘积)添加进数据集。
对划分过的数据集使用XGBoost、Bi-LSTM、XGB-KF以及Bi-LSTM-KF 4种方法分别进行实验,在训练集上训练XGBoost和Bi-LSTM单模型,在测试集上使用单模型进行预测。XGB-KF和Bi-LSTM-KF 2种模型则在测试集上对单模型的预测结果使用Kalman filter做进一步的调整和修正,修正后的结果作为集成模型的最终预测结果。
最佳状态下,XGBoost单模型取得的均方根误差(RMSE)为0.217 07。预测效果如

图4 XGBoost的预测结果
Fig. 4 Prediction result of XGBoost
Bi-LSTM取得的最低RMSE为0.230 77,预测效果如

图5 Bi-LSTM预测结果
Fig. 5 Prediction result of Bi-LSTM
加入Kalman filter方法对XGBoost的预测结果进行修正,修正后RMSE和变化趋势如图

图6 XGB-KF模型的RMSE变化趋势
Fig. 6 RMSE trend of XGB-KF model

图7 XGB-KF模型的变化趋势
Fig. 7 trend of XGB-KF model
加入Kalman filter对Bi-LSTM的预测结果进行修正后,Bi-LSTM的RMSE从0.230 77降至0.222 29,下降3.67%。从0.993 79降至0.973 08,下降2.08%。RMSE和的趋势变化情况如

图8 Bi-LSTM-KF模型的RMSE变化趋势
Fig. 8 RMSE trend of Bi-LSTM-KF model

图9 Bi-LSTM-KF模型的变化趋势
Fig. 9 trend of Bi-LSTM-KF model
各方法的指标评估结果如
方法 | RMSE | |
---|---|---|
Bi-LSTM | 0.230 77 | 0.993 79 |
XGBoost | 0.217 07 | 0.974 33 |
Bi-LSTM-KF | 0.222 29 | 0.973 08 |
XGB-KF | 0.205 73 | 0.976 94 |
针对温室温度测量受噪声影响大的问题,提出集成模型XGB-KF。经过在真实数据集上的实验,模型在与XGBoost、Bi-LSTM、Bi-LSTM-KF方法的对比中取得了最低的均方根误差。实验虽然只基于温室温度数据,但XGB-KF模型引入协变量预测的思路对时序预测的其他应用场景也有一定参考价值,如区域气温预测、城市供水量预测等。在未来的研究中,长短时记忆网络、时间卷积网络等优异方法可以被考虑用于时序预测的自回归问题中,同时它们的改进和组合方法也值得进一步尝试。
参考文献
葛志军,傅理.国内外温室产业发展现状与研究进展[J].安徽农业科学,2008,36(35):15751-15753. [百度学术]
GE Z J,FU L.Development status and research progress of the creenhouse industry at home and abroad[J].Journal of Anhui Agricultural Sciences,2008,36(35):15751-15753.(in Chinese) [百度学术]
周翔宇, 程勇, 王军. 基于改进深度信念网络的农业温室温度预测方法[J]. 计算机应用, 2019, 39(4): 1053-1058. [百度学术]
ZHOU X Y, CHENG Y, WANG J. Agricultural greenhouse temperature prediction method based on improved deep belief network[J]. Journal of Computer Applications, 2019, 39(4): 1053-1058. (in Chinese) [百度学术]
左志宇, 毛罕平, 张晓东, 等. 基于时序分析法的温室温度预测模型[J]. 农业机械学报, 2010, 41(11): 173-177. [百度学术]
ZUO Z Y,MAO H P,ZHANG X D,et al. Forecast model of greenhouse temperature based on time series method[J]. Transactions of the Chinese Society for Agricultural Machinery, 2010, 41(11): 173-177. (in Chinese) [百度学术]
Wang H,Huang J J,Zhou H,et al.An integrated variational mode decomposition and arima model to forecast air temperature[J].Sustainability,2019,11(15):4018. [百度学术]
Liu Q,Jin D D,Shen J,et al.A WSN-based prediction model of microclimate in a greenhouse using extreme learning approaches[C]//2016 18th International Conference on Advanced Communication Technology(ICACT).Piscataway:IEEE,2016:730-735. [百度学术]
Zou W D,Yao F X,Zhang B H,et al.Verification and predicting temperature and humidity in a solar greenhouse based on convex bidirectional extreme learning machine algorithm[J].Neurocomputing,2017,249:72-85. [百度学术]
Yu H H,Chen Y Y,Hassan S G,et al.Prediction of the temperature in a Chinese solar greenhouse based on LSSVM optimized by improved PSO[J].Computers and Electronics in Agriculture,2016,122:94-102. [百度学术]
Jung D H,Kim H S,Jhin C,et al.Time-serial analysis of deep neural network models for prediction of climatic conditions inside a greenhouse[J].Computers and Electronics in Agriculture,2020,173:105402. [百度学术]
Jung D H,Kim H J,Park S H,et al. Recurrent neural network models for prediction of the inside temperature and humidity in greenhouse[C]//Proceedings of the Korean Society for Agricultural Machinery Conference. South Korea: Korean Society for Agricultural Machinery,2017:135-135. [百度学术]
Song Y E,Moon A, AN S Y,et al.Prediction of smart greenhouse temperature-humidity based on multi-dimensional LSTMs[J].Journal of the Korean Society for Precision Engineering, 2019, 36(3): 239-246. [百度学术]
Wang H K,Li L,Wu Y,et al.Recurrent neural network model for prediction of microclimate in solar greenhouse[EB/OL].(2018-09-12)[2021-01-01]. https://www.sciencedirect.com/science/article/pii/S2405896318312151. [百度学术]
Song X J,Huang J J,Song D W.Air quality prediction based on LSTM-Kalman model[C]//2019 IEEE 8th Joint International Information Technology and Artificial Intelligence Conference(ITAIC).Piscataway:IEEE,2019:695-699. [百度学术]
Yan J N,Mu L,Wang L Z,et al.Temporal convolutional networks for the advance prediction of ENSO[J].Scientific Reports,2020,10(1):8055. [百度学术]
Hu P,Tong J,Wang J C,et al.A hybrid model based on CNN and Bi-LSTM for urban water demand prediction[C]//2019 IEEE Congress on Evolutionary Computation(CEC).Piscataway:IEEE,2019:1088-1094. [百度学术]
Kalman R E.A new approach to linear filtering and prediction problems[J].Journal of Basic Engineering, 1960, 82(1): 35-45. [百度学术]
Chen T Q, Guestrin C, et al. XGBoost[C]//Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. New York: ACM, 2016: 785-794. [百度学术]