欢迎您访问《智慧农业(中英文)》官方网站! English

基于优化神经网络时间序列模型的蔬菜价格预测方法

  • 侯颖 1, 3 ,
  • 孙坦 , 2, 3 ,
  • 崔运鹏 , 1, 3 ,
  • 王晓东 4 ,
  • 赵安平 4 ,
  • 王婷 1, 3 ,
  • 王增飞 4 ,
  • 杨唯佳 4 ,
  • 谷钢 5
展开
  • 1. 中国农业科学院农业信息研究所,北京 100081,中国
  • 2. 中国农业科学院,北京 100081,中国
  • 3. 农业农村部农业大数据重点实验室,北京 100081,中国
  • 4. 北京市数字农业农村促进中心,北京 101117,中国
  • 5. 浪潮软件科技有限公司,北京 100094,中国
孙 坦,研究员,研究方向为数字信息描述与组织。E-mail:
崔运鹏,研究员,研究方向为农业大数据挖掘分析、自然语言处理。E-mail:

侯 颖,硕士,研究方向为农业大数据挖掘、自然语言处理。E-mail:

收稿日期: 2024-10-11

  网络出版日期: 2025-05-22

基金资助

“十四五”国家重点研发计划课题(2023YFD1600305)

北京市智慧农业创新团队项目(BAIC10-2025)

Vegetable Price Prediction Based on Optimized Neural Network Time Series Models

  • HOU Ying 1, 3 ,
  • SUN Tan , 2, 3 ,
  • CUI Yunpeng , 1, 3 ,
  • WANG Xiaodong 4 ,
  • ZHAO Anping 4 ,
  • WANG Ting 1, 3 ,
  • WANG Zengfei 4 ,
  • YANG Weijia 4 ,
  • GU Gang 5
Expand
  • 1. Agricultural Information Institute, Chinese Academy of Agricultural Sciences, Beijing 100081, China
  • 2. Chinese Academy of Agricultural Sciences, Beijing 100081, China
  • 3. Key Laboratory of Agricultural Big Data, Ministry of Agriculture and Rural Affairs, Beijing 100081, China
  • 4. Beijing Digital Agriculture Rural Promotion Center, Beijing 101117, China
  • 5. Inspur Software Technology Co. , Beijing 100094, China
SUN Tan, E-mail:
CUI Yunpeng, E-mail:

HOU Ying, E-mail:

Received date: 2024-10-11

  Online published: 2025-05-22

Supported by

National Key Research and Development Program of China(2023YFD1600305)

Beijing Smart Agriculture Innovation Consortium Project(BAIC10-2025)

Copyright

copyright©2025 by the authors

摘要

[目的/意义] 蔬菜价格预测难度较大,在其时间序列中受到天气、物流、季节、供需、政策等多种因素影响,数据具有非线性和非平稳特性。 [方法] 以胡萝卜、白萝卜、茄子和结球生菜4种常见蔬菜价格为研究对象,提出一种基于神经网络结构的时序模型价格预测方法。引入自动调参优化算法对PatchTST、iTransformer、SOFTS、TiDE、Time-LLM这5种基于神经网络结构的时序预测模型进行超参数调优,并将传统自回归积分移动平均模型(Autoregressive Integrated Moving Average, ARIMA)作为基准模型,对比了基于神经网络时序模型的预测性能,最终选择性能最优模型预测蔬菜价格。通过平均绝对误差(Mean Absolute Error, MAE)、平均绝对百分比误差(Mean Absolute Percentage Error, MAPE)、均方误差(Mean Square Error, MSE)多维度指标分析了各模型的价格预测准确度。 [结果和讨论] 基于神经网络结构的时序预测模型在蔬菜价格预测中具有较好的拟合效果,而引入的自动调参优化算法在价格预测任务中成为提高模型表现的关键。具体来说,模型经过自动调参优化算法后,胡萝卜、白萝卜和茄子日价预测在MSE指标上至少分别降低了76.3%,94.7%和74.8%;周价预测至少分别降低85.6%,93.6%和64.0%,表现出较好的准确性。 [结论] 自动调参优化算法有效地提升了模型预测性能,可以较为准确地预测蔬菜价格走势,为蔬菜价格预测问题提供了高效的解决方案。

本文引用格式

侯颖 , 孙坦 , 崔运鹏 , 王晓东 , 赵安平 , 王婷 , 王增飞 , 杨唯佳 , 谷钢 . 基于优化神经网络时间序列模型的蔬菜价格预测方法[J]. 智慧农业, 2025 : 1 -10 . DOI: 10.12133/j.smartag.SA202410037

Abstract

[Objective] Vegetables are a vital component of the human diet, serving not only as a cornerstone of nutritional well-being but also as a significant source of income for agricultural producers. The price volatility of vegetables has profound implications for both farmers and consumers. Fluctuating prices directly impact farmers' earnings and pose challenges to market stability and consumer purchasing behaviors. These fluctuations are driven by a multitude of complex and interrelated factors, including supply and demand, seasonal cycles, climatic conditions, logistical efficiency, government policies, consumer preferences, and suppliers' trading strategies. As a result, vegetable prices tend to exhibit nonlinear and non-stationary patterns, which significantly complicate efforts to produce accurate price forecasts. Addressing these forecasting challenges holds considerable practical and theoretical value, as improved prediction models can support more stable agricultural markets, secure farmers' incomes, reduce cost-of-living volatility for consumers, and inform more precise and effective government regulatory strategies. [Methods] The study investigated the application of neural network-based time series forecasting models for the prediction of vegetable prices. In particular, a selection of state-of-the-art neural network architectures was evaluated for their effectiveness in modeling the complex dynamics of vegetable pricing. The selected models for the research included PatchTST and iTransformer, both of which were built upon the Transformer architecture, as well as SOFTS and TiDE, which leveraged multi-layer perceptron (MLP) structures. In addition, Time-LLM, a model based on a large language model architecture, was incorporated to assess its adaptability to temporal data characterized by irregularity and noise. To enhance the predictive performance and robustness of these models, an automatic hyperparameter optimization algorithm was employed. This algorithm systematically adjusted key hyperparameters such as learning rate, batch size, early stopping, and random seed. It utilized probabilistic modeling techniques to construct performance-informed distributions for guiding the selection of more effective hyperparameter configurations. Through iterative updates informed by prior evaluation data, the optimization algorithm increased the search efficiency in high-dimensional parameter spaces, while simultaneously minimizing computational costs. The training and validation process allocated 80 percent of the data to the training set and 20 percent to the validation set, and employed the mean absolute error (MAE) as the primary loss function. In addition to the neural network models, the study incorporated a traditional statistical model, the autoregressive integrated moving average (ARIMA), as a baseline model for performance comparison. The predictive accuracy of all models was assessed using three widely recognized error metrics: MAE, mean absolute percentage error (MAPE), and mean squared error (MSE). The model that achieved the most favorable performance across these metrics was selected for final vegetable price forecasting. [Results and Discussions] The experimental design of the study focused on four high-demand, commonly consumed vegetables: carrots, white radishes, eggplants, and iceberg lettuce. Both daily and weekly price forecasting tasks were conducted for each type of vegetable. The empirical results demonstrated that the neural network-based time series models provided strong fitting capabilities and produced accurate forecasts for vegetable prices. The integration of automatic hyperparameter tuning significantly improved the performance of these models. In particular, after tuning, the MSE for daily price prediction decreased by at least 76.3% for carrots, 94.7% for white radishes, and 74.8% for eggplants. Similarly, for weekly price predictions, the MSE reductions were at least 85.6%, 93.6%, and 64.0%, respectively, for the same three vegetables. These findings confirm the substantial contribution of the hyperparameter optimization process to enhancing model effectiveness. Further analysis revealed that neural network models performed better on vegetables with relatively stable price trends, indicating that the underlying consistency in data patterns benefited predictive modeling. On the other hand, Time-LLM exhibited stronger performance in weekly price forecasts involving more erratic and volatile price movements. It's robustness in handling time series data with high degrees of randomness suggests that model architecture selection should be closely aligned with the specific characteristics of the target data. Ultimately, the study identified the best-performing model for each vegetable and each prediction frequency. The results demonstrated the generalizability of the proposed approach, as well as its effectiveness across diverse datasets. By aligning model architecture with data attributes and integrating targeted hyperparameter optimization, the research achieved reliable and accurate forecasts. [Conclusions] The study verified the utility of neural network-based time series models for forecasting vegetable prices. The integration of automatic hyperparameter optimization techniques notably improved predictive accuracy, thereby enhancing the practical utility of these models in real-world agricultural settings. The findings provide technical support for intelligent agricultural price forecasting and serve as a methodological reference for predicting prices of other agricultural commodities. Future research may further improve model performance by integrating multi-source heterogeneous data. In addition, the application potential of more advanced deep learning models can be further explored in the field of price prediction.

0 引 言

农业是国民经济的命脉。农产品供给安全、价格稳定更是保障社会安定、人民生活正常的重要前提,对经济社会有序发展至关重要1。农产品价格是农产品市场变化的风向标,价格的频繁和大幅波动可能会影响国家和全球粮食安全2。蔬菜作为日常生活必不可缺的一部分,其价格波动直接影响农民的收入、市场的稳定性以及消费者的购买决策。近年来,随着全球气候变化、供需关系的动态变化以及政策调整,蔬菜价格的波动愈发剧烈。因此,准确预测蔬菜价格不仅对农业生产者和政策制定者至关重要,也对消费者和投资者具有重要的经济意义。
蔬菜价格除了受供需、季节等发生波动,还受到天气、物流、政策、消费者偏好、供应商交易策略等外界因素的影响。价格和这些因素之间的关系通常是非线性、动态的和不稳定的3,这导致了蔬菜价格预测的困难。目前针对蔬菜等农产品的价格预测方法包括传统时间序列模型和神经网络模型两类。传统的价格预测模型,如自回归移动平均模型(Autoregressive Moving Average, ARMA),自回归积分移动平均模型(Autoregressive Integrated Moving Average, ARIMA)45,自回归条件异方差模型(Autoregressive Conditional Heteroskedasticity Model, ARCH)等,已被应用于许多时间序列场景中。其中,ARIMA模型在农产品价格预测领域取得了广泛应用,例如,胡杨等6采用ARIMA模型对河北省玉米价格数据建模,很好地预测玉米价格的变化情况。Zhou7使用ARIMA对2019年4月至2021年2月中国月度玉米价格进行建模并估算2021年3月的价格具有很高的准确度。Abdul等8比较了ARIMA和差分整合自回归移动平均(Autoregressive Fractionally Integrated Moving Average, ARFIMA)模型在世界食用油价格预测中的表现,强调了模型选择的重要性。Cariappad等9重点研究了印度小麦市场价格预测及其决策方法,采用ARIMA模型,使用来自农业市场信息(Agricultural Marketing Information, AGMARK)价格门户网站的历史数据,预测不同市场的月度小麦批发价格。同样,Darekar和Reddy10也对预测印度常见稻谷价格进行了研究,使用从AGMARK收集的稻谷月平均价格,并采用ARIMA模型进行未来价格预测。除ARIMA模型外,ARMA模型和ARCH模型也被用于农产品价格预测。例如,吕星辰11以小宗农产品为对象,采用ARMA模型分析其价格波动特征,并结合广义自回归条件异方差模型(Generalized Autoregressive Conditional Heteroskedasticity, GARCH)类模型进一步探讨价格波动的影响因素。王溯等12基于2011年1月至2022年8月的月度价格指数,运用ARCH类模型对猪肉、牛肉、棉花、大豆、稻谷、羊肉六种农产品的价格波动特征进行分析。Mahmoud13利用ARIMA、GARCH模型分析埃及部分出口农作物(如绿豆、土豆、番茄、洋葱、橙子、葡萄和草莓)的价格波动,发现GARCH模型在捕捉价格波动性方面具有较高的准确性。这些传统模型依赖于时间序列数据的平稳性假设,且难以处理复杂的非线性关系。在农产品价格预测等高维非线性的问题上,传统模型往往表现出预测精度不足的局限性。
随着深度学习技术的发展,循环神经网络(Recurrent Neural Network, RNN)14、长短期记忆网络(Long Short-term Memory, LSTM)15和门控循环单元(Gated Recurrent Unit, GRU)16等神经网络模型,在农业领域应用越来越广泛。这些模型能捕捉长时间依赖关系及非线性特征,取得优于传统方法的效果。李哲敏等17构建动态混沌神经网络模型,对中国马铃薯日价进行预测。而Choudhary等18同样对马铃薯日价序列进行分解,构建人工神经网络预测价格。王桂红等19、胡彦军等20均基于GRU神经网络构建价格预测模型,以大蒜为例对农产品价格进行预测。Xu和Zhang21, 22不仅探索了美国16个州近500个市场的每日玉米现货价格的预测问题,还探索了神经网络模型在预测咖啡、玉米、棉花、燕麦、大豆、大豆油、糖和小麦等商品超过50年的每日价格数据集问题中的有效性。Latifi和Fami23比较了几种单变量时间序列模型和人工神经网络(Artificial Neural Network, ANN)模型,以预测伊朗的小麦产量。然而,ANN等模型具有固定的神经元,即使集成了一些方法以提高准确性,也无法对其进行修改以满足任务的需求。面对复杂的任务,RNN被广泛认为优于具有固定神经元的神经网络。通过改进内部结构,LSTM解决了传统RNN的弱点。袁铭涓和孙若莹24、张璇25分别基于LSTM神经网络模型获取大宗农产品价格、河南省花生价格的周期性变化规律。贾宁等26设计了双重注意力机制与长短期记忆网络融合(LSTM-DA)神经网络模型,对蔬菜类农产品价格指数进行预测,相比于传统模型均取得了较理想的准确度。然而,LSTM模型在处理长序列数据和复杂非线性关系方面存在一定局限,尤其在面对数据的高频波动或突变时准确率下降。
在价格预测中,由于单一模型往往存在泛化能力差、对特定模式敏感等问题,研究者们提出了组合模型。例如,对于猪肉价格,吴培等27、Zhang等28分别构建了ARIMA-GM-RBF及STL-LSTM组合模型进行预测,体现了较好的拟合效果。Chen等29提出了一种称为CNN+LSTM的混合预测方法,以番茄价格序列为例,证明了方法的有效性。曹新悦等30提出了一种结合X12-ARIMA和LSTM的组合模型,用于分析成都市莴笋价格的波动规律,实验结果表明,该组合模型在预测精度和性能上优于单独使用X12-ARIMA或LSTM模型。这些组合模型在一定程度上提升了预测性能,但模型融合方式较为简单,部分研究未考虑农产品价格的特殊波动特征,在模型泛化能力方面仍有待加强。
基于神经网络模型的时间序列预测方法相比传统模型能产生更准确的结果,但也存在一些挑战。在实际应用中,如何平衡模型复杂度与预测的精度,如何将深度学习模型与领域知识更好地结合,仍然是研究的重点。本研究探索基于神经网络的时间预测模型在蔬菜价格预测中的应用潜力,针对蔬菜价格预测问题,选取并使用多种基于Transformer、多层感知机(Multilayer Perceptron, MLP)以及大语言模型(Large Language Model, LLM)架构支撑的模型,引入自动调参优化算法对基于神经网络结构的时序预测模型进行超参数调优,在不同蔬菜价格数据上对比分析模型预测性能,选取最优模型预测蔬菜价格,以期为蔬菜价格预测问题提供高效的解决方案。

1 研究数据

本研究所使用的数据为北京市数字农业农村促进中心提供的蔬菜日价格数据。数据的核心指标包括价格(元/kg)和上市量(kg)等。选择胡萝卜、白萝卜、茄子和结球生菜等4种在日常生活中比较常见、销量较大,且数据比较容易获取的蔬菜进行实验。使用2003年1月至2024年11月的日价格数据,分别对4种蔬菜的日价和周价进行预测和评价,其中周价通过日价得到。在数据预处理中,首先进行了数据完整性检查,仅部分年份在春节期间的近1周数据存在缺失值,考虑春节期间的特殊性,未对缺失值进行处理。

2 研究方法

本研究根据现有神经网络模型架构,选取基于Transformer、MLP和LLM架构支撑的模型,模型分别为PatchTST(Patch Time Series Transformer)31、iTransformer(inverted Transformer)32、SOFTS(Series-cOre Fused Time Series)33、TiDE(Time-series Dense Encoder)34和Time-LLM35

2.1 Transformer架构

Transformer模型是当前深度学习领域中非常流行的一种架构。PatchTST和iTransformer模型均为采用了Transformer架构的多变量时间序列预测模型。PatchTST模型基于两个关键组件:Patch和Transformer。Patch将时间序列按照一定大小的窗口和步长分割为“时序块”(Patch),将其传输到Transformer,通过自注意力机制提取“时序块”的全局依赖关系,从而提高预测性能。PatchTST减少了直接处理长时间序列的计算复杂度,同时还保留了全局信息,该模型结构自上而下可以描述为:
1)Patch分割。将时间序列划分为多个固定长度的Patch,作为Transformer的输入。Patch通过1个可训练的线性参数矩阵 W p 和1个位置编码矩阵 W p o s ,将原始时间序列数据映射到维度为D的Transformer输入潜在空间。位置编码矩阵 W p o s 用于捕获Patch的时间顺序信息。
2)通过多头自注意力机制(Multi-head Attention)捕捉不同时间片段的依赖关系,增强模型对复杂时间序列的理解能力。
3)将Transformer的输出展平后输入由1个全连接层组成的预测头,得到最终预测结果。
iTransformer是改进版的时间序列Transformer模型,采用了一种倒置的视角,将注意力机制和反馈网络的角色颠倒。iTransformer将每个变量的整个时间序列独立嵌入为token,采用注意力机制对嵌入token处理,增加可解释性和多变量的相关性,然后通过前馈神经网络提取每个token的特征表示,并应用层归一化(Layer Normalization)来减少变量的差异,获取更好的时序表示。

2.2 MLP架构

SOFTS和TiDE是基于MLP架构的时序预测模型。SOFTS通过多个通道的序列表示和整个多元序列的核心表示融合来实现通道关系的建模,与iTransformer一样,每个序列都是单独嵌入的。不同的是,SOFTS通过一种星型聚合分发模块(STar Aggregate Redistribute Module, STAR)提取不同通道的序列的相关性,交换不同序列的信息,最后通过线性层对每个通道做出预测。
TiDE模型分为特征投影、密集编码器、密集解码器和时序解码器4个部分。特征投影将外部变量映射到一个低维向量,以降低外部变量的维度;密集编码器将历史序列、属性信息,以及外部变量映射的低维向量拼接在一起,并对其映射得到编码结果。密集解码器部分将编码结果映射为g,并将其重塑为[ pH ]矩阵,其中 H 为对应预测窗口的长度; p 为解码器的输出维度。时序解码器将上一步的g和外部变量x按照时间维度拼接到一起,并对每个时刻的输出结果进行映射。最后历史序列的直接映射结果被加入残差连接中,得到最终的预测结果。

2.3 LLM架构

Time-LLM是一个重新编程框架,将LLM重新应用于一般时间序列,同时保持基础语音模型的完整。Time-LLM框架的实现涉及3个关键部分:输入转换、预训练且冻结的LLM,以及输出投影。首先,输入的时间序列数据通过文本原型进行重新编程,然后输入到冻结的LLM中,以实现两种模态的对齐。为了增强LLM对时间序列数据的推理能力,研究者们提出了Prompt-as-Prefix(PaP)技术,通过在输入中添加额外的上下文和任务指令来指导LLM的转换。最后,从LLM输出的时间序列片段被投影以获得预测结果。
这些模型各具特色,结合了Transformer、MLP和LLM架构的不同优势,为时间序列预测提供了多种可能的解决方案。

2.4 自动调参优化算法

超参数调优在机器学习模型训练中至关重要,直接影响模型的性能和准确性。为了提升神经网络模型在蔬菜价格预测时的性能,引入自动调参优化算法对模型关键参数进行调优。本研究采用HyperOpt提供的TPE(Tree-structured Parzen Estimator)方法进行超参数搜索。TPE能够利用历史评估数据构建概率模型,来预测较优的超参数分布,从而提高搜索效率和模型的稳定性;并在高维超参数空间中有更低的计算开销。
TPE算法不是直接对目标函数建模,而是通过估计两个概率密度函数: g ( x ) l x 。其中, g ( x ) 表示当前超参数组合x在较优结果(如损失较低)下的概率分布; l ( x ) 表示当前超参数组合x在较差结果(如损失较高)下的概率分布。选择最大化 E I x = g ( x ) / l ( x ) 值的超参数作为下一个候选超参数进行评估。其中, E I x 用于衡量新选择的超参数是否比当前最佳结果更优。在训练模型时,模型性能受到多种超参数的影响,本研究重点关注了以下参数。
1)学习率(Learning Rate)。控制模型参数在训练过程中的更新步长,值过大会导致训练不稳定,值过小可能导致训练时间过长。
2)批量大小(Batch Size)。窗口中的序列数目,影响训练速度、内存/显存占用。
3)早停(Early Stopping)。在早停之前的验证迭代次数,提前停止训练以避免过拟合。
4)损失函数(Loss)。反映决策变量与目标值存在的差异,其功能是计算预测数据和实际数据的差异化程度36。本研究使用平均绝对误差(Mean Absolute Error, MAE)作为模型的损失函数,它能够体现某个数据集的离散化程度。
5)随机种子(Random Seed)。用于控制随机过程的可重复性。
本研究针对学习率、批量大小、早停、随机种子超参数构建搜索空间,采用MAE作为训练和验证集的损失函数,使用TPE估计超参数与目标函数的关系,根据设置的迭代轮次,每轮根据前一轮的结果来调整搜索方向,从而在搜索空间中探索到更优的参数配置,直到模型收敛或迭代达到最大轮次。

3 实验设计

3.1 实验环境

实验环境由计算机硬件和开发平台两部分组成。详细信息如表1所示。
表1 蔬菜价格预测实验环境配置

Table 1 Experimental environment configuration for vegetable price prediction

名称 参数
OS Linux
CPU Intel(R)Xeon(R)Gold 6132 CPU @ 2.60 GHz
GPU Tesla V100
Deep learning framework Pytorch
Programing language Python
CUDA Cuda 11.7

3.2 性能评估指标

本研究的时间序列预测方法均可以对蔬菜价格进行预测,需要一种准确有效的方法将这些预测值与实际值进行比较。本研究选取MAE、MAPE(Mean Absolute Percentage Error)、均方误差(Mean Squared Error, MSE)作为模型的评价指标。评价指标说明和计算公式如下。
1)MAE:衡量预测值与实际值差异的指标,计算所有样本误差绝对值的均值,如公式(1)所示。
M A E = 1 n i = 1 n | y i - y ^ i |
2)MAPE:衡量预测值与真实值的百分比误差,计算所有样本误差的绝对值占实际值的比值,如公式(2)所示。
M A P E = 1 n i = 1 n | y i - y ^ i y i |
3)MSE:衡量预测值与真实值差异的平方的均值,计算所有样本误差平方的均值,如公式(3)所示。
M S E = 1 n i = 1 n ( y i - y ^ i ) 2
式中: n 为价格样本数; i 为样本中的第 i 个样本; y 为真实值; y ^ 为预测值。MAE、MAPE、MSE值越小,则表示模型预测的准确性越好。

3.3 模型训练评估方法

本实验采用ARIMA作为基准模型(Baseline Model),基于历史价格数据进行时间序列建模,并对比基于神经网络的时序模型(包括PatchTST、iTransformer、SOFTS、TiDE、Time-LLM)在蔬菜价格预测上的表现。实验将数据集按时间顺序划分为训练集(80%)和验证集(20%),并基于滚动窗口策略进行预测,其中,训练集用于模型构建和模型,验证集用于模型性能评估。在模型训练优化过程中,引入自动调参优化算法对模型关键超参数进行调优。具体优化参数范围如表2所示。
表2 神经网络模型参数及优化范围

Table 2 Parameters and optimization ranges for neural network models

参数 参数值
Learning Rate (1e-5, 1e-1)
Batch Size 24
Early Stopping 3
Random Seed (1, 10)
Loss MAE

4 结果与分析

4.1 模型性能对比

为了验证自动调参优化算法对神经网络模型预测性能的提升效果,本节在4种蔬菜价格预测任务中,分别对比了调优前后的模型表现。神经网络模型在调优前使用了默认或人工设定的超参数;在调优后,通过自动调参优化算法对关键超参数(包括学习率、批量大小、早停、随机种子等)进行了优化。
表3表4展示了在4种蔬菜日价预测任务中,各模型调优前后在MAE、MAPE、MSE指标上的表现。从实验结果可以看出,神经网络模型在经过参数调优后,在所有4种蔬菜的预测任务中均表现出更优的预测性能,调优后的模型在MAE、MAPE和MSE指标方面均显著降低。从MAE指标来看,特别是在白萝卜日价预测中,MAE值至少降低了74.7%;在MSE指标上表现最为突出,胡萝卜、白萝卜和茄子日价预测在MSE指标上至少分别降低了76.3%,94.7%和74.8%。
表3 不同模型调优前的结球生菜、胡萝卜、白萝卜、茄子日价预测性能对比

Table 3 Comparison of daily price prediction performance of different models before tuning for lettuce, carrot, white radish, and eggplant

模型架构 模型名称 结球生菜 胡萝卜 白萝卜 茄子
MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2
Transformer PatchTST 0.550 0.156 0.827 0.142 0.070 0.050 0.159 0.117 0.061 0.465 0.124 0.489
iTransformer 0.625 0.156 0.941 0.160 0.079 0.056 0.186 0.136 0.074 0.514 0.137 0.541
MLP SOFTS 0.621 0.164 0.952 0.173 0.085 0.063 0.184 0.133 0.075 0.532 0.141 0.576
TiDE 0.606 0.158 0.941 0.169 0.082 0.059 0.174 0.127 0.067 0.513 0.138 0.556
LLM Time-LLM 0.578 0.154 0.856 0.152 0.075 0.052 0.175 0.126 0.070 0.470 0.125 0.470
表4 不同模型调优后的结球生菜、胡萝卜、白萝卜、茄子日价预测性能对比

Table 4 Comparison of daily price prediction performance of different models after tuning for lettuce, carrot, white radish, and eggplant

模型架构 模型名称 结球生菜 胡萝卜 白萝卜 茄子
MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2
Transformer PatchTST 0.531 0.140 0.724 0.079 0.035 0.008 0.037 0.042 0.003 0.249 0.069 0.108
iTransformer 0.540 0.140 0.788 0.079 0.035 0.008 0.032 0.036 0.002 0.271 0.075 0.120
MLP SOFTS 0.511 0.133 0.707 0.080 0.035 0.008 0.046 0.052 0.004 0.273 0.076 0.121
TiDE 0.543 0.142 0.766 0.102 0.044 0.014 0.039 0.044 0.003 0.290 0.081 0.140
LLM Time-LLM 0.519 0.135 0.725 0.073 0.032 0.007 0.046 0.053 0.003 0.253 0.070 0.114
表5表6分别展示了在4种蔬菜的周价数据上,各模型调优前后在MAE、MAPE、MSE指标上的表现。从实验结果同样可以看出,神经网络模型在经过参数调优后,在所有蔬菜的预测任务中均表现出更优的预测性能。在MAE指标上,白萝卜周价数据至少降低了66.4%,在MSE指标上表现最为突出,结球生菜、胡萝卜、白萝卜和茄子周价预测在MSE指标上至少分别降低了79.0%,85.6%,93.6%和64.0%。实验表明调优策略对模型泛化能力的提升具有积极作用。由此可见,合理的超参数调优在时间序列类价格预测任务中是提高模型表现的关键步骤。
表5 不同模型调优前的结球生菜、胡萝卜、白萝卜、茄子周价预测性能对比

Table 5 Comparison of weekly price prediction performance of different models before tuning for lettuce, carrot, white radish, and eggplant

模型架构 模型名称 结球生菜 胡萝卜 白萝卜 茄子
MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2
Transformer PatchTST 1.073 0.243 2.597 0.248 0.123 0.123 0.262 0.192 0.152 0.781 0.217 1.152
iTransformer 1.250 0.284 3.087 0.292 0.144 0.160 0.284 0.203 0.177 0.957 0.273 1.583
MLP SOFTS 1.137 0.256 2.683 0.278 0.138 0.153 0.280 0.199 0.173 0.956 0.275 1.575
TiDE 1.129 0.238 2.957 0.297 0.143 0.164 0.269 0.184 0.168 0.818 0.216 1.173
LLM Time-LLM 1.477 0.343 4.060 0.551 0.296 0.483 0.377 0.282 0.269 0.766 0.200 1.127
表6 不同模型调优后的结球生菜、胡萝卜、白萝卜、茄子周价预测性能对比

Table 6 Comparison of weekly price prediction performance of different models after tuning for lettuce, carrot, white radish, and eggplant

模型架构 模型名称 结球生菜 胡萝卜 白萝卜 茄子
MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2 MAE/(元/kg) MAPE/% MSE/(元2/kg2
Transformer PatchTST 0.447 0.126 0.505 0.085 0.037 0.009 0.051 0.054 0.005 0.326 0.090 0.239
iTransformer 0.474 0.130 0.647 0.076 0.033 0.009 0.066 0.071 0.007 0.387 0.109 0.256
MLP SOFTS 0.467 0.133 0.528 0.141 0.062 0.022 0.094 0.102 0.011 0.591 0.168 0.567
TiDE 0.452 0.125 0.564 0.080 0.035 0.009 0.083 0.092 0.010 0.348 0.097 0.257
LLM Time-LLM 0.708 0.255 0.511 0.105 0.046 0.013 0.073 0.079 0.011 0.246 0.070 0.088
通过分析不同蔬菜价格的时序特征,本研究发现:1)价格波动较平稳的蔬菜(如白萝卜、胡萝卜)在这些神经网络模型上的MAE指标值更低;2)价格变化幅度较大的蔬菜(如结球生菜)在神经网络模型上的MAE指标值更高。

4.2 预测结果

本节以白萝卜和茄子为例分别对比了在日价和周价预测上预测性能最优模型的预测值和真实值。选取2023年11月至2024年10月的测试数据进行预测值的真实值对比。图1图2分别给出了白萝卜和茄子在数据集上最优模型的价格对比折线图。
图1 测试集中白萝卜最优模型预测值与真实值对比

注: y表示白萝卜蔬菜的真实价格。

Fig. 1 Comparison of predicted and actual daily prices of white radish in the test set

图2 测试集中茄子最优模型预测值与真实值对比

注: y表示白萝卜蔬菜的真实价格。

Fig. 2 Comparison of predicted and actual weekly prices of white radish in the test set

可以看出,基于Transformer架构的PatchTST模型在白萝卜周价预测和茄子日价预测上表现突出,iTransformer模型在白萝卜日价上有出色表现,基于LLM架构的Time-LLM模型则在茄子周价上表现良好。通过分析不同蔬菜价格的时序特征,本研究发现:1)iTransformer和PatchTST能较好地捕捉具有较强周期性波动特征的数据,适应非线性变化,从而提高更精准的预测;适合季节性明显的蔬菜;2)Time-LLM模型在价格波动幅度稍大的周价预测上表现较好,能够较好地适应随机性较高的时间序列数据;适合价格幅度波动有较大随机性的蔬菜。针对不同的数据波动特征,选择最优性能预测模型可更准确地预测蔬菜价格,这使得本方法具有一定的通用性,能更合理准确预测不同特征数据。另外,日价相比周价,在模型预测上具有更好的拟合效果。周价是通过日价计算得到的,误差等因素的累计使得周价的预测波动相比日价更为明显。

5 结 论

由于蔬菜具有季节性、并受供需、天气、物流、政策等外界因素的影响,会造成蔬菜价格预测困难。本研究基于神经网络时间序列预测模型,提出了一种面向蔬菜价格预测的深度学习解决方案,并通过实验验证了其有效性。主要结论如下。
1)相比于传统ARIMA模型,基于神经网络的模型能够更有效地捕捉价格波动的长期依赖性和非线性特征,在预测精度上显著优于传统模型。
2)本研究在模型训练中通过自动调参方式对超参数调优,实现了模型关键参数的高效优化,提升模型的预测准确度和稳定性。其中,模型调优前后在MSE指标上表现最为突出,胡萝卜、白萝卜和茄子日价预测在MSE指标上至少分别降低了76.3%,94.7%和74.8%;在周价预测上至少分别降低85.6%,93.6%和64.0%。通过对比各模型性能,选择预测性能最优模型进行预测,表明所提出的方法具有一定的通用性,可适用于其他类型农产品价格预测问题。
3)实验结果表明,数据波动大小对模型预测性能影响较大,日价的预测效果明显优于周价的预测。周价是通过日价计算得到的,误差等因素的累计使得周价的波动相比日价更为明显。而且在同一蔬菜品种的日价和周价数据上最优模型是不同的,验证了模型的通用性。
尽管本研究取得了一些进展,但仍存在一定的局限性。例如,数据的特征分析相对单一,缺乏多维度因素(如气候、政策)的考虑,未来可以结合多源异构数据进一步提高预测精度。此外,还可以探索更多先进的深度学习模型(如LLM、组合神经网络模型等)在该任务中的应用潜力。总之,本研究为蔬菜价格预测提供了新的解决思路和高效的解决方案。

利益冲突声明

本研究不存在研究者以及与公开研究成果有关的利益冲突。

1
郑艳洁, 郭晓晓 . 流通业效率、数字经济发展对农产品价格波动的影响[J]. 商业经济研究, 2023, (1): 67-70.

ZHENG Y J , GUO X X . Research on the influence of the efficiency of circulation industry and digital economy on the price fluctuation of agricultural products[J]. Journal of Commercial Economics, 2023, (1): 67-70.

2
许世卫, 李乾川, 栾汝朋, 等 . 农产品市场监测预警深度学习智能预测方法[J]. 智慧农业(中英文), 2025, 7(1): 57-69.

XU S W , LI Q C , LUAN R P , et al . Agricultural market monitoring and early warning: An integrated forecasting approach based on deep learning[J]. Smart agriculture, 2025, 7(1): 57-69.

3
陈雯, 谢云 . 经济政策不确定性对中国农产品价格的影响[J]. 农业展望, 2024, 20(10): 62-68.

CHEN W , XIE Y . Impact of economic policy uncertainty on the prices of agricultural products in China[J]. Agricultural Outlook, 2024, 20(10): 62-68.

4
夏如玉, 王梓桥 . 基于ARIMA模型对重庆市GDP预测分析[J]. 中国储运, 2022(8): 93-94.

XIA R Y , WANG Z Q . Prediction and analysis of Chongqing GDP based on ARIMA model[J]. China storage & transport, 2022(8): 93-94.

5
黄文玲, 郑晓颖, McCarthyBreda, 等 . 基于ARIMA模型对广东省生猪价格的短期预测[J]. 中国畜牧杂志, 2018, 54(12): 119-123.

HUANG W L , ZHENG X Y , MCCARTHY B , et al . Short term prediction of the price of live pigs in Guangdong Province based on ARIMA model[J]. Chinese journal of animal science, 2018, 54(12): 119-123.

6
胡杨, 张朝阳 . 基于ARIMA模型的河北省玉米价格预测[J]. 农业与技术, 2020, 40(23): 149-152.

HU Y , ZHANG C /Z)Y . Forecast of corn price in Hebei Province based on ARIMA model[J]. Agriculture and technology, 2020, 40(23): 149-152.

7
ZHOU L W . Application of ARIMA model on prediction of China's corn market[J]. Journal of physics: conference series, 2021, 1941(1): ID 012064.

8
ABDUL A K , TAUFIK A H , IMBARINE B . World edible oil prices prediction: Evidence from mix effect of ever difference on Box-Jenkins approach[J]. Journal of business and retail management research, 2016, 10(3): 11-23.

9
ADEETH CARIAPPA A G , KATHAYAT B , KARTHIGA S , et al . Price analysis and forecasting for decision making: Insights from wheat markets in India[J]. The Indian journal of agricultural sciences, 2020, 90(5): 979-984.

10
DAREKAR A , REDDY A A . Forecasting of common paddy prices in India[J]. SSRN electronic journal, 2017: 71-75.

11
吕星辰 . 基于网络舆情影响的小宗农产品价格预测研究[D]. 哈尔滨: 东北农业大学, 2023.

LYU X C . Research on price prediction of Xiaozong agricultural products based on the influence of Internet public opinion[D]. Harbin: Northeast Agricultural University, 2023.

12
王溯, 胡长情 . 基于ARCH类模型的农产品价格波动特征研究[J]. 中国林业经济, 2023, (2): 80-84.

WANG S , HU C Q . Research on the characteristics of agricultural product price fluctuation based on ARCH model[J]. China Forestry Economics, 2023, (2): 80-84.

13
MAHMOUD SAYED AGBO H . Forecasting agricultural price volatility of some export crops in Egypt using ARIMA/GARCH model[J]. Review of economics and political science, 2023, 8(2): 123-133.

14
FUNAHASHI K I , NAKAMURA Y . Approximation of dynamical systems by continuous time recurrent neural networks[J]. Neural networks, 1993, 6(6): 801-806.

15
HOCHREITER S , SCHMIDHUBER J . Long short-term memory[J]. Neural computation, 1997, 9(8): 1735-1780.

16
CHO K , VAN MERRIENBOER B , GULCEHRE C , et al . Learning phrase representations using RNN encoder-decoder for statistical machine translation[EB/OL]. arXiv: 1406.1078, 2014.

17
李哲敏, 许世卫, 崔利国, 等 . 基于动态混沌神经网络的预测研究: 以马铃薯时间序列价格为例[J]. 系统工程理论与实践, 2015, 35(8): 2083-2091.

LI Z M , XU S W , CUI L G , et al . Prediction study based on dynamic chaotic neural network: Taking potato time-series prices as an example[J]. Systems engineering-theory & practice, 2015, 35(8): 2083-2091.

18
CHOUDHARY K , JHA G K , DAS P, et al . Forecasting potato price using ensemble artificial neural networks[J]. Indian journal of extension education, 2019, 55(1): 73-77.

19
王桂红, 潘栋, 刘向锋 . 基于门控循环单元网络的农产品价格预测模型构建[J]. 沈阳师范大学学报(自然科学版), 2022, 40(5): 451-456.

WANG G H , PAN D , LIU X F . Construction of agricultural product price forecasting model based on gated recurrent unit[J]. Journal of Shenyang normal university (natural science edition), 2022, 40(5): 451-456.

20
胡彦军, 张平川, 尚峥, 等 . 基于深度学习的大蒜价格预测研究[J]. 河南科技学院学报(自然科学版), 2023, 51(3): 35-42.

HU Y J , ZHANG P C , SHANG Z , et al . Research on garlic price prediction based on deep learning[J]. Journal of Henan institute of science and technology (natural science edition), 2023, 51(3): 35-42.

21
XU X J , ZHANG Y . Commodity price forecasting via neural networks for coffee, corn, cotton, oats, soybeans, soybean oil, sugar, and wheat[J]. Intelligent systems in accounting, finance and management, 2022, 29(3): 169-181.

22
XU X J , ZHANG Y . Corn cash price forecasting with neural networks[J]. Computers and electronics in agriculture, 2021, 184: ID 106120.

23
LATIFI Z , FAMI H S . Forecasting wheat production in Iran using time series technique and artificial neural network[J]. Journal of agricultural science and technology, 2022, 24(2): 261-273.

24
袁铭涓, 孙若莹 . 基于LSTM神经网络的大宗农产品价格预测研究[J]. 海峡科技与产业, 2021, 34(11): 43-47, 60.

YUAN M J , SUN R Y . Research on price prediction of bulk agricultural products based on LSTM neural network[J]. Technology and industry across the Straits, 2021, 34(11): 43-47, 60.

25
张璇 . 基于LSTM的河南省花生价格预测研究[D]. 郑州: 华北水利水电大学, 2021.

ZHANG X . Research on peanut price forecast in Henan province based on long short-term memory[D]. Zhengzhou: North China University of Water Resources and Electric Power, 2021.

26
贾宁, 郑纯军 . 基于LSTM-DA神经网络的农产品价格指数短期预测模型[J]. 计算机科学, 2019, 46(S2): 62-65, 71.

JIA N , ZHENG C J . Short-term forecasting model of agricultural product price index based on LSTM-DA neural network[J]. Computer science, 2019, 46(S2): 62-65, 71.

27
吴培, 李哲敏 . 中国猪肉价格预测研究: 基于ARIMA-GM-RBF组合模型的分析[J]. 价格理论与实践, 2019(1): 75-78.

WU P , LI Z M . Forecast researchon China's pork price based on the ARIMA-GM-RBF hybrid model[J]. Price: theory & practice, 2019(1): 75-78.

28
ZHANG Q H , YAN H Z , NING J , et al . A deep learning framework for forecasting pork import prices using PPI_IPD index[C]// Proceedings of the 2023 International Conference on Intelligent Computing and Its Emerging Applications. New York, USA: ACM, 2023: 167-169.

29
CHEN P , YE H Z . Short-term forecast of agricultural prices using CNN+LSTM[C]// Proceedings of the 7th International Conference on Intelligent Information Processing. New York, USA: ACM, 2022.

30
曹新悦, 贺春林, 崔梦天 . 基于X12-ARIMA和LSTM组合模型的城市蔬菜价格波动规律及预测[J]. 西南民族大学学报(自然科学版), 2021, 47(4): 418-425.

CAO X Y , HE C L , CUI M T . Construction of urban vegetable price fluctuation prediction model based on X12-ARIMA and LSTM[J]. Journal of southwest Minzu university (natural science edition), 2021, 47(4): 418-425.

31
NIE Y , NGUYEN N H , SINTHONG P , et al . A time series is worth 64 words: Long-term forecasting with transformers[EB/OL]. arXiv: 2211.14730, 2022.

32
LIU Y , HU T , ZHANG H , et al . itransformer: Inverted transformers are effective for time series forecasting[EB/OL]. arXiv: 2310.06625, 2024.

33
HAN L , CHEN X Y , YE H J , et al . Softs: Efficient multivariate time series forecasting with series-core fusion[EB/OL]. arXiv: 2404.14197, 2024.

34
DAS A, KONG W , LEACH A , et al . Long-term forecasting with tide: Time-series dense encoder[EB/OL]. arXiv: 2304.08424, 2023.

35
JIN M , WANG S , MA L , et al . Time-LLM: Time series forecasting by reprogramming large language models[EB/OL]. arXiv: 2310.01728, 2024.

36
曹淑欣, 许学斌, 路龙宾, 等 . 融合注意力机制与残差网络的人耳识别方法[J]. 光电子·激光, 2023, 34(4): 378-386.

CAO S X , XU X B , LU L B , et al . Ear recognition method combining attention mechanism and residual network[J]. Journal of Optoelectronics·Laser, 2023, 34(4): 378-386.

文章导航

/