# A Framework for Crop Price Forecasting in Emerging Economies by Analyzing
the Quality of Time-series Data

Ayush Jain* *The first two authors contributed equally to this paper. IBM
Research - India
<EMAIL_ADDRESS>Smit Marvaniya* IBM Research - India
<EMAIL_ADDRESS>Shantanu Godbole  IBM Research - India
<EMAIL_ADDRESS>Vitobha Munigala  IBM Research - India
<EMAIL_ADDRESS>
###### Abstract

Accuracy of crop price forecasting techniques is important because it enables
the supply chain planners and government bodies to take appropriate actions by
estimating market factors such as demand and supply. In emerging economies
such as India, the crop prices at marketplaces are manually entered every day,
which can be prone to human-induced errors like the entry of incorrect data or
entry of no data for many days. In addition to such human prone errors, the
fluctuations in the prices itself make the creation of stable and robust
forecasting solution a challenging task. Considering such complexities in crop
price forecasting, in this paper, we present techniques to build robust crop
price prediction models considering various features such as (i) historical
price and market arrival quantity of crops, (ii) historical weather data that
influence crop production and transportation, (iii) data quality-related
features obtained by performing statistical analysis. We additionally propose
a framework for context-based model selection and retraining considering
factors such as model stability, data quality metrics, and trend analysis of
crop prices. To show the efficacy of the proposed approach, we show
experimental results on two crops - Tomato and Maize for 14 marketplaces in
India and demonstrate that the proposed approach not only improves accuracy
metrics significantly when compared against the standard forecasting
techniques but also provides robust models.

###### Index Terms:

Time-series Data Analysis, Crop Price Prediction, Data Quality of Time-series,
Context-based Model Selection

##  I Introduction

India is an agriculture-based country where 54.6% of the total workforce is
engaged in agricultural and allied sector activities, accounting for 17.1% of
the country’s Gross Value Added (GVA)111Annual Report 2018-19, Ministry of
Agriculture and Farmers Welfare, Government of India. Hence, it becomes
important for the government bodies associated with agriculture to estimate
market factors and take suitable actions to benefit the farmers. Therefore,
having a robust automated solution, especially in developing countries such as
India, not only aids the government in taking decisions in a timely manner but
also helps in positively affecting the large demographics. The price of crops
is one such market factor that requires the attention of the government.
Accurate crop price forecasting can be useful for the government to take
proactive steps and decide various policy measures such as adjusting MSP
(Minimum Support Price) so that farmers get a decent price for their produce,
restricting the export price by imposing an MEP (Minimum Export Price), so
that exporters are forced to sell locally, thus bringing down the crop prices.
At the same time, it will also be useful for the farmer for making better
decisions like when to sell their produce or when to harvest the crop.

The crop prices are affected due to several factors such as the area under
cultivation for a particular crop, supply projection, government policies,
consumer demands, supply chain aspects of producers for agriculture-based
products, etc. Additionally, weather conditions also play an important factor
since the majority of agricultural production in India is rain-fed. Therefore,
the study of fluctuations in agricultural crop prices is interesting as well
as an important problem to solve from the government’s perspective.

Apart from the above-stated reasons, agricultural crop price forecasting is
quite challenging due to many factors such as data quality issues,
unreliability in future weather predictions, high fluctuation present in the
historical crop price, crop price variations across neighboring marketplaces,
etc. Moreover, the manually recorded data is prone to human-induced errors
such as no data or wrong data entered for a certain day. Considering ML/DL
based models, with a new price data arrival every day, updating the models
might cause stability issues because of quality issues associated with the
crop price data.

In this paper, we address the set of challenges present in deploying a real-
world crop price prediction solution by evaluating its robustness and
reliability over a continuous time-frame. We summarize our contributions as
below:

  * •

We present the architecture of end-to-end pipeline for robust crop price
prediction by analyzing historical marketplace data, weather data and data
quality-related features.

  * •

We propose a framework for enabling context-based model selection strategies
under different conditions such as identifying context based on data quality
metrics, model stability, and trend of historical crop prices.

  * •

We experiment with various regression models and show the results for two
crops namely, Tomato and Maize for 14 marketplaces in India. We additionally
report interesting findings to illustrate the benefits in modeling trend
specific models built on marketplace level as well as crop level for a robust
crop price forecast.

##  II Related Work

Time-series forecasting has been an active research area and has been studied
under various scenarios such as stock price prediction [1], energy load
forecasting [2], traffic forecasting [3], crop yield prediction [4], etc. To
capture time-series specific properties, various categories of models were
proposed such as (i) Univariate models, which can only model the endogenous
variables, like MA, ARMA, ARIMA and its variants such as SARIMA (ii)
Multivariate models which can model exogenous variables along with the
endogenous variables like VAR models along with its variants such as
elliptical [5], structured VAR model [6], ARIMAX, SARIMAX, etc. Along with
these time-series specific models, many classical machine learning models
found their way into the problem of time-series forecasting such as support
vector regression [7], LASSO [8], gaussian processes [9] and even recent deep
learning techniques such as LSTMs [10]. Apart from using single models,
various ensemble models [11, 12, 13] were designed and tested to improve the
accuracy of time-series forecasting problems.
Crop price prediction is one such instantiation of time-series forecasting
problem which is being actively pursued by the research community in the
recent past. For example, [14] use exponential smoothing, ARIMA and spectral
methods for predicting crop prices. [15] exploit the seasonal properties of
the prices and recommend seasonal models like SARIMA for Tomato price
prediction. [16] proposes spline-based interpolation techniques for Tomato
price prediction. [17] proposed usage of Back Propagating Neural Networks
(BPNN) for forecasting vegetable prices. [18] modeled the problem of Tomato
price forecasting using the radial basis function neural networks. [19]
proposed the usage of Long- and Short-Term Time-series Network (LSTNet) for
modeling the prices of agricultural crops. In addition to these simple models,
various ensemble models were also proposed for efficiently forecasting
techniques in agriculture-related problems. [4] used stacking based ensemble
models for predicting crop yield. [20, 21] decompose time-series data into a
seasonal, trend, and remainder components and proposed individual model to
forecast the trend, remainder and seasonal components and finally add them to
get the final forecast value. However, most of the prior works focus on
continuous retraining of the model as opposed to contextual model retraining.

Further, apart from concentrating on building complex models, researchers
proposed various additional features that can help the price forecasting
problem. [22] analyzed new events along with the Agmarknet data to predict
food prices and reported a significant improvement over the standard ARIMA
model. [23] used collaborative filtering for imputing missing data values
using data from neighboring marketplaces. [24] performed price forecasting and
anomaly detection in the crop prices by training a classifier model on the
dataset of news articles covering hoarding related incidents. [25] proposed
various features such as complexity, linearity, stationarity, periodicity in
addition to a model based on horizon features to model agricultural prices. A
pilot study222Price Predictions using Machine Learning (AI) for Soyabean and
Onion, Atal Bihari Vajpayee Institute of Good Governance and Policy Analysis,
2019 was performed on soybean and onion for price prediction that uses
features such as historical yield, production, exchange rate, historical
rainfall, etc. [26] uses environmental factors like rainfall and temperature
for price prediction of corn and soybean. However, these prior works do not
consider features related to data quality aspects.

In our work, we explore the time-series forecasting models proposed in the
literature as discussed above in the context of crop price prediction.
Specifically, we analyze the impact of data quality of time-series data and
properties of the time-series data such as trend on the downstream models and
suggest a framework for continuous retraining of models upon arrival of new
data and retrieval of models for the best forecast. Additionally, we also
study the impact of building models for each market versus each crop and
report our findings in the form of quantitative and qualitative results.

(a) Weather parameters (Davangere)

(b) Crop prices

Figure 1: Variations present in weather condition shown in (a) and crop price
variations shown in (b).

(a) Tomato

(b) Maize

Figure 2: Historical crop price variations for Tomato and Maize Prices in Rs.
per Quintal.

##  III Dataset

In this section, we briefly discuss various factors we use for modeling crop
prices and provide necessary evidence to showcase their importance. In our
analysis, we choose different regions from Karnataka state in India for
analyzing the prices of Tomato and Maize.

###  III-A Weather Data

Crop prices are affected due to many factors such as (i) bad weather like
heavy rainfall may impact the routes used for transporting crops to the
marketplaces (ii) temperature and humidity affect the shelf life of crops
(iii) quantity of crops brought to the marketplaces, as a surplus supply
generally brings the prices down and vice versa, which is in turn affected by
the weather conditions. Therefore it becomes important to consider weather-
related information while predicting prices of crops. We analyze weather
parameters such as average humidity, total rainfall and average temperature on
a daily basis. We use The Weather Channel APIs to access the weather data for
the geo-locations of all the marketplaces. Fig. 1(a) shows the variations in
the weather parameters for Davangere district in Karnataka state for the years
2017 and 2018.

###  III-B Agmarknet Data

Agmarknet333https://agmarknet.gov.in/(Agricultural Marketing Information
Network) website is maintained by the Government of India that maintains crop
related information such as minimum, maximum, and the modal price per quintal
at marketplace level. The Agmarknet website also captures the marketplace
arrival volume of each crop which is measured in quintal for every
marketplace. Agmarknet website is updated every day except Sundays since
marketplaces are closed and there is no arrival of crops on Sundays.
Sometimes, even for the weekdays, data is not updated on the website due to
some issues resulting in days with missing values.

Fig. 1(b) shows the modal price variations for Tomato and Maize from Kolar and
Davangere marketplaces in Karnataka. It can be observed that the variations in
prices are much more pronounced in Tomato than in Maize.

Fig. 2 shows the heat maps444The missing values have been imputed as provided
in IV-A which visualize the variation in modal price per Quintal of Tomato and
Maize for marketplaces located in different districts in Karnataka. From the
heat maps, we can infer that there is some seasonality in the prices that can
be seen from the repeating patterns in any row over a period of 3 and a half
years. Also, it can be seen that some of the marketplaces appear to have
correlation amongst them.

Figure 3: Overall steps of our approach for crop price prediction framework
using a trend-based model selection strategy.  Figure 4: Percentage of missing
and outlier values for Tomato and Maize.

##  IV Proposed Method

Given historical crop prices along with weather data and other Agmarknet data,
we first perform data preprocessing steps to deal with missing values and
outliers. We then perform statistical analysis on the crop price data to
obtain insights into the data quality along with trend and variations present
in the data. We identify a set of additional features with the help of the
insights from the statistical analysis. Two different feature representation
techniques are introduced to capture data quality aspects along with Agmarknet
data and weather data. The data quality based feature representation and the
context-based model selection strategies have been designed to deal with data
quality issues in time-series forecasting. Fig. 3 shows a high-level pipeline
of our proposed framework using trend-based model selection strategy.

###  IV-A Data Preprocessing and Statistical Analysis

In the data quality analysis, we primarily focus on the identification of
missing values and outliers present in the data. All the days (except Sundays)
where there was no entry were considered as missing values in the Agmarknet
data and filled using spline based technique [27]. Outliers in the data were
detected using IQR (Interquartile range) method [28] with threshold value as
1, and the outlier values were not modified. We attribute the presence of
outliers to human errors while entering the data in a digital system. Fig.
4(a) and 4(b) show the fraction of days with missing values and outliers for
the considered marketplaces of Tomato and Maize respectively.

In the statistical analysis, we perform ADF, KPSS tests [29] and compare the
test statistics with the 5 percent critical value. Based on these two tests,
we infer if the data is non-stationary, strict-stationary, trend-stationary or
difference-stationary. Time-series for tomato price is found to be strict
stationary while that of maize is found to be non-stationary. Further, the
Agmarknet data is decomposed into trend, seasonal and residual components
using additive seasonal decomposition techniques.

We further analyze the statistical properties of the residual component or
noise. The mean is quite close to zero for all marketplaces which is expected.
The average standard deviation of the residual component for Tomato is 202.43
which is much higher than that of Maize, which is found to be 34.39,
indicating that there is a higher fluctuation in Tomato prices than in Maize.

###  IV-B Data Quality based Features

Based on the insights from the data quality and statistical analysis, the
following list of features is proposed to capture the data quality issues and
variations present in the Agmarknet time-series data.

Missing value flag (M): From the missing value analysis, a missing value flag
is added as a feature, encoded as a binary value of 1 for days with missing
values and 0 for others.
Outlier flag (O): From outlier analysis, an outlier flag is added as a
feature. The flag takes value 1 for all the days which were identified as
outliers and 0 for the other days.
Fourier transform based features (FT): FFT (Fast Fourier Transform) is
performed on Agmarknet data, thereby transforming it into the frequency
domain. Then, higher frequency components are removed from the FFT, following
which Inverse FFT is performed to obtain time-series which is used as features
[30]. In our experiments, we retain first 3, 6, 9, and 100 frequencies to
obtain 4 time-series inverse transforms, with the transform with more
components closer to the real data. These additional features help in removing
the noise component from the data and discover the underlying patterns.
Time-related features (T): Information such as day and month of crop arrival
are considered as additional features inorder to capture the temporal
seasonality in the prices. These features are encoded in numeric form.
Statistical Indicators (SI): Statistical indicators such as moving averages,
moving standard deviation of the price time-series are added as a part of the
feature set. These indicators are useful in capturing recent variations in
time-series for long-term forecasting and are usually used in problems related
to stock price predictions. In our experiments, we use the following
indicators: 3 and 7 days Moving Averages, Exponential Moving Averages with
Center of Mass 0.25 and 0.5, 20 days Moving Standard Deviation and Moving
Average Convergence Divergence (MACD), as used in [31].

###  IV-C Feature Representation

Typically, historical crop prices are used to obtain the feature
representation. In addition to the Agmarknet data ($AG$), we utilize
additional information such as weather data ($WD$), and data quality-related
features as discussed above ($DQ$) for constructing the final feature
representation. All the individual features can be combined into single
representation using the two definitions of $\mathcal{F}$ as described below:

  1. 1.

Feature Concatenation: To construct a feature vector for $i^{th}$ day, we
concatenate the historical $k$ days of attributes and use it to train a
regressor model for crop price forecasting. Let $f$ be the operator that
creates the feature representation $\mathcal{F}(d_{i})$ for $i^{th}$ day. For
$f_{AG}(d_{i,i-k})$ concatenate arrival quantity and crop price from $i^{th}$
day to $(i-k)^{th}$ day. Similarly, we compute the feature representation for
weather data ($f_{WD}(d_{i,i-k})$), and feature representation for data
quality ($f_{DQ}(d_{i,i-k})$) for $i^{th}$ day. The concatenated features for
$i^{th}$ day is computed as:

$\mathcal{F}(d_{i})=[f_{AG}(d_{i,i-k}),f_{WD}(d_{i,i-k}),f_{DQ}(d_{i,i-k})]$
(1)

The feature representation $\mathcal{F}(d)$ is a combination of WD, DQ, and AG
based historical features. The final combined feature representation is of
dimension size $k\cdot$$N_{WD}$ \+ $k\cdot$$N_{DQ}$ \+ $k\cdot$$N_{AG}$
dimensional, where $N_{WD}$, $N_{DQ}$ and $N_{AG}$ are the dimensions of daily
weather data, data quality, and Agmarknet data respectively. The values of
$N_{WD}$ is 3, $N_{DQ}$ is 13, and $N_{AG}$ is 2. To show the importance of
the constructed feature vector, we use a Multilayer perceptron (MLP) regressor
with 1 hidden layer containing 10 neurons with ReLU activation, using feature
concatenation-based feature representation. To train the model we use lbfgs
solver with a constant learning rate of 0.001 and squared error as the loss
function. The MLP model takes as input the feature vector $\mathcal{F}(d_{i})$
and makes a forecast for the next 30 days i.e., ($i+1$) to ($i+30$) days.

Figure 5: LSTM-based feature encoder for crop price forecasting

  2. 2.

Time-series dependent feature representation: To capture the time-series
dependency between the different attributes, we use a stacked LSTM based
feature encoder to represent the multivariate data [10]. The LSTM model has a
stack of two LSTM layers to encode the input features and the output from the
last time step of the second LSTM layer is considered as an input to a Dense
layer which forecasts for 30 days. The LSTM layer encodes the sequential
information from the input that captures the historical weather data, data
quality-related features, and Agmarknet data through the recurrent network.
Fig. 5 shows the high-level steps for extracting time-series dependent feature
representation and use it for crop price forecasting. In our experiments, the
two LSTM layers are 100 and 100 units respectively with each layer having ReLU
activation. To train the network, we use Adam optimizer with a learning rate
of 0.001 and mean squared error as the loss function.

Next, we introduce different contexts to retrain and select models considering
different factors such as data quality, model stability, and trend analysis.
The procedure for model retraining, model management, and version control for
different model selection strategies for a given context is also described.

###  IV-D Context-based Model Selection Strategies

In real-world time-series data analysis, automated way of model selection and
model deployment process is very important. We propose a framework for
context-based model selection strategies for crop price forecasting. We also
demonstrate the utility of inferring the context by analyzing the variations
in recent crop prices along with issues related to model stability and data
quality. Fig. 6 illustrates a set of different model selection strategies for
crop price forecasting.

Figure 6: A set of different context-based model selection strategies for crop
price forecasting.

  1. 1.

Continuous Retraining: The model deployment can be treated as a continuous
process rather than deploying a model once. One of the most important factors
is to enable continuous model enrichment such that the model captures the
recent crop price variations while forecasting long-term crop prices. However,
this continuous model enrichment process requires extra processing for model
retraining. Furthermore, continuous retraining may get impacted because of
data quality issues if there is no supervision.

  2. 2.

Model Stability: To address the limitation of the continuous retraining
process, we automatically analyze the model performance after performing model
retraining. This is achieved by creating a model catalog that stores the set
of models along with model performance-related attributes. The best performing
crop price forecasting model is identified as
$\arg\max_{m_{i}\in\mathbf{M_{c}}}\phi^{acc}(m_{i},D^{val})$ where $m_{i}$
represents the a model from the model catalog ($M_{c}$). $\phi^{acc}$ computes
the performance metrics on the validation dataset ($D^{val}$). To capture the
recent price variations in the model, we put a constraint on the model catalog
such that it stores only recently trained models.

  3. 3.

Data Quality Metrics: The data quality check is very important for model
deployment and the model selection process. We analyze the data quality by
identifying outliers, consecutive missing values present in the recent time-
series, and decide whether to use this data for retraining the model. This way
a continuous condition is enabled to captures the data quality aspects first,
and then perform the continuous retraining. This step could also help in
reducing the number of continuous model enrichment steps and thereby reducing
the computational cost overall in an automated manner.

  4. 4.

Trend Analysis: There is a significant body of work in the space of time-
series forecasting using trend, seasonality, seasonal variations, random or
irregular movements for modeling time-series data. In this work, we determine
trend in crop prices to infer the context. We analyze recent crop prices
($CP_{1,...,k}$) for $k$ days and determine whether there is a positive trend
($T^{pos}$) or a negative trend ($T^{neg}$) by computing the trend score
using:

$\small\begin{split}T(CP_{1,...,k})=\begin{cases}T^{pos}&\sum_{i=1}^{k-1}\frac{CP_{i+1}-CP_{i}}{CP_{i}}>0\\\
\\\ T^{neg}&\sum_{i=1}^{k-1}\frac{CP_{i+1}-CP_{i}}{CP_{i}}<=0\\\
\end{cases}\end{split}$ (2)

Two different model catalogs are maintained to capture the positive trend and
the negative trend related information. To predict crop prices, a recently
trained model is retrieved from the catalog based on the context as shown in
Fig. 7 and its effectiveness is discussed in Sec. V-D. The model catalogs are
updated based on the trend analysis of the recent time-series data.

Figure 7: An example of model selection using positive and negative trend
scores. (a) shows a sample crop price time-series. (b) shows a context-based
model selection strategy using trend analysis.

In the next section, we evaluate and compare the different feature
representations using continuous retraining strategy. Furthermore, we also
show the importance of different context-based model selection strategies such
as Model Stability, Data Quality Metrics, and Trend Analysis.

##  V Experiments

We evaluate our crop price forecasting algorithm for 7 marketplaces of Tomato
and 7 of Maize using the Agmarknet dataset. Table I shows the train-test split
of the datasets for Tomato and Maize. To evaluate the robustness of the crop
price forecasting algorithms we first build the model using the historical
data for 997 days from 01-JAN-2016 to 03-FEB-2019. The model is evaluated for
128 days from 04-FEB-2019 to 02-JUL-2019 and compared against the ground truth
values.

TABLE I: Distribution of Agmarknet datasets.  Crops | Marketplaces | Total Days | Train (Days) | Test (Days)
---|---|---|---|---
Tomato | 7 | 1125 | 997 | 128
Maize | 7 | 1125 | 997 | 128

###  V-A Experimental Setup

To show the effectiveness of proposed features and context-based model
selection strategies, we conduct experiments for multiple marketplaces for
Tomato. For experimentation, we consider multiple factors such as model
characteristics \- univariate (ARIMA, SARIMA, and Prophet) vs multivariate
(MLP), features used \- only crop price vs additional features, model
selection for retraining \- continuous vs context-based. Following is the list
of experiments conducted:

  * •

Baseline Models: To establish baselines, we consider widely used univariate
models such as ARIMA [32], SARIMA [33], and FB-PROPHET [21]. These models only
take the crop price as input to make the forecast.

  * •

Importance of Proposed Features: To understand the effect of additional
features such as AG, WD, DQ we consider multivariate models. We use feature
concatenation method proposed in Sec IV-C(1) to prepare the feature and use
MLP to conduct the experiments using continuous model retraining strategy.

  * •

Importance of Context-based Model Selection: To show the effectiveness of
context-based model selection over continuous model retraining, we conduct
multiple experiments. We evaluate different context-based model selection
strategies as mentioned in Sec. IV-D such as model selection based on data
quality ($M^{d}$), model stability ($M^{s}$), and trend-based model selections
either at marketplace level ($T^{m}$) or at crop level ($T^{c}$). In these
experiments, we use two different types of feature representations namely,
feature concatenation and time-series dependent feature representation as
mentioned in Sec IV-C.

To show the generalization capability of the proposed method, we also perform
similar experiments for multiple marketplaces for Maize. The metrics used to
evaluate the model performance and model robustness are discussed in the
following section.

###  V-B Evaluation Metrics

The performance of forecasting models is measured using Root Mean Square Error
(RMSE) and Mean Absolute Percentage Error (MAPE). In addition to measuring
forecasting model performance, measuring the robustness and the reliability of
the deployed system over time is also a very important criteria.

As mentioned in Table I, we initially use 997 days data for training the model
and everyday we forecast 30 days ahead crop prices. For each following day, we
add the new data point and follow the training and forecasting procedure.
Evaluation is done over a period of 128 days and the metrics such as average
RMSE and average MAPE are computed to understand the model performance over
longer period of time. The average RMSE (AR) and average MAPE (AM) are
computed over $p$ days as:

$AR=\frac{1}{p}\sum_{j=1}^{p}{\sqrt{\frac{1}{h}\sum_{i=1}^{h}(\hat{y}_{i}^{(j)}-y_{i}^{(j)})^{2}}}$
(3)
$AM=\frac{100\%}{p}\sum_{j=1}^{p}{\frac{1}{h}\sum_{i=1}^{h}\left|\frac{y_{i}^{(j)}-\hat{y}_{i}^{(j)}}{y_{i}^{(j)}}\right|}$
(4)

where $\hat{y}_{i}^{(j)}$ and $y_{i}^{(j)}$ represent the prediction and the
ground truth for $j^{th}$ test data point of $i^{th}$ day respectively. The
values of $h$ and $p$ are used as $30$ and $128$ respectively in our
experiments. While computing the evaluation metrics, we ignore the forecasted
values when there is no ground truth data available because of missing value.

To compare the reliability and robustness of different models graphically, we
show the error variations and cumulative error distribution (CED) curves along
with the average RMSE (AR) and average MAPE (AM) values for the different
models. The error variation graph shows the variation of error for the
forecasts, where high fluctuations in the graph including high peaks suggest
that a model is not reliable. CED curve of error values help in comparing the
percentage of test data points whose prediction error falls within a
particular error threshold value. A higher percentage value suggests that the
model is more robust.

###  V-C Importance of Agmarknet, Weather and Data Quality related Features

Most of the existing techniques such as ARIMA, SARIMA, and Prophet use only
historical time-series data. However, crop prices are highly dependent on the
local weather conditions and market arrival in addition to the historical crop
prices. Our multivariate feature representation captures marketplace specific
characteristics such as weather parameters (WD) which capture the variation in
the avg. temperature, avg. humidity, and the total rainfall on a daily level,
along with historical crop prices and historical market place crop arrival
data (AG). We compare our feature concatenation based representation (Sec.
IV-C(1)) with existing techniques which only use the historical crop prices.

The comparative average RMSE and average MAPE evaluation metrics of the models
mentioned above are shown in Table II for several marketplaces for Tomato
crop. It can be observed that the multivariate models have a lower average
error for all the marketplaces when compared to the baseline models. It can
also be observed that the addition of data quality related features has
improved the performance of the model as compared to using only the Agmarknet
and weather-based feature representation.

To qualitatively analyse the effectiveness of the proposed features, we
graphically represent the error variation and CED curves in Fig.8. From Fig.
8(a), it can be observed that for most of the forecasts, AG+WD and AG+WD+DQ
models have lower errors when compared to baseline models indicating that
models build using proposed features are more reliable. From the CED curve in
Fig. 8(b), it can be observed that the AG+WD model is robust when compared to
baseline models since the forecast errors fall in lower MAPE range. Further,
it can also be observed that AG+WD+DQ model is better than the AG+WD model
indicating that considering data quality information is helpful.

In the current setup, models are continiously retrained over time. Next, we
evaluate various context-based model selection strategies using two different
feature representations such as feature concatenation and time-series
dependent feature representation.

TABLE II: Comparison between univariate and multivariate models for Tomato.
AR: Average RMSE, AM: Average MAPE, AG: Agmarknet data, WD: Weather data, DQ:
Data quality-based features.

Marketplace Name Prophet[21] ARIMA [32] SARIMA [33] AG+WD (MLP) AG+WD+DQ (MLP)
AR AM AR AM AR AM AR AM AR AM Kolar 598.48 32.71 404.28 22.82 389.42 21.51
350.51 19.52 276.62 14.7 Mulabagilu 568.11 31.37 413.82 20.87 417.35 21.48
361.87 16.79 292.4 15.39 Chikballapur 690.06 45.56 350.43 20.7 350.43 20.7
310.19 18.08 277.79 15.02 Srinivasapur 788.45 45.23 528.1 25.57 534.67 25.68
520.73 23.35 318.57 16.16 Chintamani 716.98 34.71 539.08 31.0 550.6 32.39
602.29 39.45 462.87 29.53 Bangarpet 575.39 31.65 468.56 26.97 460.37 26.7
382.55 20.15 323.17 20.15 Mysore 895.51 42.34 652.3 26.91 661.1 27.28 666.5
25.23 398.69 17.23

(a) Error variation for daily forecast

(b) Cumulative error distribution curve

Figure 8: Comparative evaluation metrics for different feature representations
including univariate and multivariate models for Kolar marketplace for Tomato.

###  V-D Importance of Context-based Model Selection

Continuous retraining strategy may get adversely affected due to the presence
of data quality issues such as outliers in the crop prices. To deal with this,
in data quality based model selection $M^{d}$, we dynamically retrieve the
best performing model with respect to Avg RMSE from the model catalog when
there is an outlier present in the recent data. Due to high fluctuations in
the factors affecting crop prices, updating model daily can impact the model
stability adversely. To address this issue, we enable stability based model
selection ($M^{s}$), where best performing model (described in Sec. IV-D(2))
is retrieved from the catalog daily. The catalog is updated when the new model
outperforms previous best performing model. Trend-based model selection
happens at marketplace level $T^{m}$ and crop level $T^{c}$. In $T^{m}$, we
build separate $T^{pos}$ and $T^{neg}$ models for each marketplace whereas in
$T^{c}$ we just build one set of $T^{pos}$ and $T^{neg}$ models on the
accumulated data of all the marketplaces and forecast. In our experiments, for
trend-based model selection we use 7-day price window in Eq. 2.

TABLE III: Result for context-based model selection strategies for Tomato. AR:
Average RMSE, AM: Average MAPE, $M^{d}$: data quality metric based model
selection, $M^{s}$: Model stability based model selection, $T^{c}$: Trend-
based modeling at crop level, $T^{m}$: Trend-based modeling at marketplace
level.

Marketplace Name $M^{d}$ (MLP) $M^{s}$ (MLP) $T^{m}$ (MLP) $T^{c}$ (MLP)
$T^{c}$ (LSTM) AR AM AR AM AR AM AR AM AR AM Kolar 276.62 14.7 279.78 14.82
273.07 14.74 267.75 14.23 271.99 15.22 Mulabagilu 291.93 15.36 286.06 15.69
312.98 16.88 289.52 14.39 302.82 15.74 Chikballapur 277.79 15.02 306.77 17.44
287.16 16.28 262.75 14.46 246.77 14.65 Srinivasapur 318.49 16.15 336.37 17.97
346.76 17.93 323.77 16.36 394.43 18.56 Chintamani 462.85 29.54 446.04 27.27
438.22 28.64 399.14 24.61 443.52 25.08 Bangarpet 323.3 20.16 330.22 20.73
279.19 17.71 235.63 13.43 199.06 12.54 Mysore 398.85 17.25 397.65 16.14 437.82
17.85 384.41 15.9 461.47 18.25

(a) Error variation for daily forecast

(b) Cumulative error distribution curve

Figure 9: Comparative evaluation metrics for different context-based model
selection strategies for Kolar marketplace for Tomato.

Tab. III compares the evaluation metrics for different context-based model
selection strategies using the best performing AG+WD+DQ model. It can be
observed that context-based model selection strategies provide robust and
reliable price forecasting when compared to Tab. II. From Table III, it can be
observed that $T^{c}$ performs better than $T^{m}$ indicating that the model
built on crop level data can better capture the variation in prices across
marketplaces and provide better forecasting. We also evaluate the performance
of crop level trend-based model selection strategy using time-series dependent
feature representation ($T^{c}$ (LSTM)) and observe that though it performs
better than $M^{d}$ and $M^{s}$, it is unable to outperform $T^{c}$ (MLP).

Fig. 9 illustrates the detailed comparative error analysis of different
strategies for Kolar marketplace. We can see from Fig. 9(a) that $M^{s}$ and
$M^{d}$ have a relatively uniform error variations, while $T^{c}$ is observed
to provide relatively lower MAPE% for most of the forecasts. Fig. 10(a) gives
the CED curve for the aggregated errors of all the marketplaces for Tomato. It
can be observed that context-based model selection techniques using trend
analysis ($T^{m}$ (MLP), $T^{c}$ (MLP), $T^{c}$ (LSTM)) have a lower AOC (Area
over curve) indicating a lower expected error[34]. Similarly, multivariate
model settings (AG+WD+DQ, AG+WD) have lower AOC when compared to baseline
models.

Techniques such as ARIMA, SARIMA, and Prophet require the entire time-series
data to perform auto-regression or seasonal decomposition to build a
regressor. These models have to be fit for every new data point to make new
forecasts which is the same as continuous retraining strategy, hence they do
not allow model management.

TABLE IV: Comparative results of our proposed approach for Maize.

Marketplace Name Prophet[21] ARIMA [32] SARIMA [33] AG+WD+DQ (MLP)
$T\textsuperscript{m}$ (MLP) $T\textsuperscript{c}$ (MLP)
$T\textsuperscript{c}$ (LSTM) AR AM AR AM AR AM AR AM AR AM AR AM AR AM
Davangere 201.34 8.93 184.23 8.02 184.23 8.02 175.49 7.66 135.86 5.72 140.08
5.95 143.33 6.23 Hanagal 218.08 9.12 237.74 9.02 239.14 9.04 242.12 9.23
215.88 8.27 205.59 7.88 203.66 7.72 Harappanahalli 147.56 5.92 142.3 5.7 142.1
5.7 133.87 5.4 109.74 4.35 103.65 4.12 124.76 5.06 Harihara 85.31 3.87 114.09
5.37 113.73 5.33 113.79 5.11 91.01 4.21 95.33 4.5 121.53 5.59 Haveri 95.41
3.51 112.03 4.11 112.65 4.15 101.85 3.84 90.85 3.28 79.3 2.78 102.97 3.78
Honnali 96.03 4.03 80.74 3.33 80.74 3.33 83.17 3.48 80.56 3.34 74.14 3.03
99.04 4.16 Shiggauv 149.22 7.32 113.95 5.76 113.95 5.76 96.73 4.62 90.31 3.93
87.44 4.11 126.41 5.49

(a) Tomato

(b) Maize

Figure 10: Cumulative error distribution curve for aggregate result for all
marketplaces for Tomato and Maize.

###  V-E Generalization

To show the generalization capabilities of the proposed approach, we performed
crop price prediction for Maize as well. From Sec. IV-A, it can be noted that
the residual component in Maize has a lower deviation than Tomato and this can
be attributed to the fact that Maize is a cereal crop with a more regulated
market than Tomato, which is primarily a cash crop. Even though the baseline
models perform reasonably well, we show that proposed approach is helpful even
in such scenarios where scope of improvement is less. From Tab. IV, it can be
observed that except for Harihara, trend-based model selection strategies have
the lowest error followed by AG+WD+DQ model with continuous retraining.
Further, CED curves for aggregated error of all the marketplaces for Maize
shown in Fig. 10(b) also suggests that the trend-based model selection
strategy results in lower forecasting errors.

##  VI Conclusions & Future Work

Crop price forecasting has been a well-studied problem in the time-series
analysis domain over the years. In our experimentation, it was identified that
the widely used time-series forecasting approaches (ARIMA, SARIMA, and
Prophet) are affected significantly by the data quality issues, which is a
predominant factor in emerging economies such as India. To address these
shortcomings, we introduced a novel feature representation that captures the
weather condition, historical marketplace arrival, and data quality
information for robust crop price forecasting. Furthermore, we have also
proposed a framework for model selection based on the context for robust crop
price forecasting. Experiments indicate that the trend-based model selection
strategy is useful compared to existing techniques especially in the case of
highly fluctuating crop prices. In the future work, we want to focus on two
aspects – efficient data quality improvement and enhanced context-based model
selection. To mitigate the data quality issues efficiently, we plan to explore
techniques such as leveraging information from nearby market place to impute
missing values as mentioned in [23]. Similarly, we plan to explore more
context-based rules and usage of meta-learning techniques like model stacking
to choose the best possible strategy from the proposed strategies and obtain
better performance.

## References

  * [1] Y. Bao, Y. Lu, and J. Zhang, “Forecasting stock price by svms regression,” in _ICOAI_ , 2004.
  * [2] K. Amarasinghe, D. L. Marino, and M. Manic, “Deep neural networks for energy load forecasting,” 2017.
  * [3] Y. Li, R. Yu, C. Shahabi, and Y. Liu, “Diffusion convolutional recurrent neural network: Data-driven traffic forecasting,” in _ICLR_ , 2017.
  * [4] M. Shahhosseini, G. Hu, and S. V. Archontoulis, “Forecasting corn yield with machine learning ensembles,” _arXiv:2001.09055_ , 2020.
  * [5] H. Qiu, S. Xu, F. Han, H. Liu, and B. Caffo, “Robust estimation of transition matrices in high dimensional heavy-tailed vector autoregressive processes,” in _ICML’15_ , 2015.
  * [6] I. Melnyk and A. Banerjee, “Estimating structured vector autoregressive models,” in _ICML_ , 2016.
  * [7] K.-j. Kim, “Financial time series forecasting using support vector machines,” _Neurocomputing_ , 2003.
  * [8] J. Li and W. Chen, “Forecasting macroeconomic time series: Lasso-based approaches and their forecast combinations with dynamic factor models,” _International Journal of Forecasting_ , 2014.
  * [9] S. Roberts, M. Osborne, M. Ebden, S. Reece, N. Gibson, and S. Aigrain, “Gaussian processes for time-series modelling,” _PHILOS T R SOC A_ , 2013\.
  * [10] S. Siami-Namini and A. S. Namin, “Forecasting economics and financial time series: Arima vs. lstm,” _arXiv preprint arXiv:1803.06386_ , 2018.
  * [11] M. Oliveira and L. Torgo, “Ensembles for time series forecasting,” in _ACML_ , 2014.
  * [12] V. Cerqueira, L. Torgo, F. Pinto, and C. Soares, “Arbitrated ensemble for time series forecasting,” in _ECML PKDD_ , 2017.
  * [13] W. Shen, V. Babushkin, Z. Aung, and W. L. Woon, “An ensemble model for day-ahead electricity demand time series forecasting,” in _Proceedings of the Fourth International Conference on Future energy systems_ , 2013.
  * [14] A. Dieng, “Alternative forecasting techniques for vegetable prices in senegal,” _Senegalese journal of agricultural research_ , 2008.
  * [15] M. Yercan and H. Adanacioglu, “An analysis of tomato prices at wholesale level in turkey: An application of sarima model,” _Custos e Agronegocio_ , 2012\.
  * [16] G. Martin-Rodriguez and J. Caceres-Hernandez, “Canary tomato export prices: comparison and relationships between daily seasonal patterns,” _SJAR_ , 2013\.
  * [17] G. M. Nasira and N. Hemageetha, “Vegetable price prediction using data mining classification technique,” _PRIME_ , 2012.
  * [18] N. Hemageetha and G. Nasira, “Radial basis function model for vegetable price prediction,” in _PRIME_ , 2013.
  * [19] H. Ouyang, X. Wei, and Q. Wu, “Agricultural commodity futures prices prediction via long-and short-term time series network,” _Journal of Applied Economics_ , 2019.
  * [20] T. Xiong, C. Li, and Y. Bao, “Seasonal forecasting of agricultural commodity price using a hybrid stl and elm method: Evidence from the vegetable market in china,” _Neurocomputing_ , 2018.
  * [21] S. J. Taylor and B. Letham, “Forecasting at scale,” _The American Statistician_ , 2018.
  * [22] S. Chakraborty, A. Venkataraman, S. Jagabathula, and L. Subramanian, “Predicting socio-economic indicators using news events,” in _KDD_ , 2016\.
  * [23] W. Ma, K. Nowocin, N. Marathe, and G. H. Chen, “An interpretable produce price forecasting system for small and marginal farmers in india using collaborative filtering and adaptive nearest neighbors,” in _ICTD ’19_ , 2018\.
  * [24] L. Madaan, A. Sharma, P. Khandelwal, S. Goel, P. Singla, and A. Seth, “Price forecasting & anomaly detection for agricultural commodities in india,” in _COMPASS_ , 2019.
  * [25] D. Zhang, S. Chen, L. Liwen, and Q. Xia, “Forecasting agricultural commodity prices using model selection framework with time series features and forecast horizons,” _IEEE Access_ , 2020.
  * [26] N. Kantanantha, N. Serban, and P. Griffin, “Yield and price forecasting for stochastic crop decision planning,” _JABES_ , 2010.
  * [27] H. Junninen, H. Niska, K. Tuppurainen, J. Ruuskanen, and M. Kolehmainen, “Methods for imputation of missing values in air quality data sets,” _Atmospheric Environment_ , 2004.
  * [28] G. Barbato, E. Barini, G. Genta, and R. Levi, “Features and performance of some outlier detection methods,” _Journal of Applied Statistics_ , 2011.
  * [29] G. Schlitzer, “Testing the stationarity of economic time series: further monte carlo evidence,” _Ricerche Economiche_ , 1995.
  * [30] A. Fumi, A. Pepe, L. Scarabotti, and M. M. Schiraldi, “Fourier analysis for demand forecasting in a fashion company,” _IJEBM_ , 2013.
  * [31] K. Thomas, “Time series prediction for stock price and opioid incident location,” Ph.D. dissertation, Arizona State University, 2019.
  * [32] K. Yunus, T. Thiringer, and P. Chen, “Arima-based frequency-decomposed modeling of wind speed time series,” _IEEE Trans. on Power Syst._ , 2015\.
  * [33] S. I. Vagropoulos, G. Chouliaras, E. G. Kardakos, C. K. Simoglou, and A. G. Bakirtzis, “Comparison of sarimax, sarima, modified sarima and ann-based models for short-term pv generation forecasting,” in _ENERGYCON 2016_.
  * [34] J. Bi and K. P. Bennett, “Regression error characteristic curves,” in _ICML-03_ , 2003.