Crop Planning using Stochastic Visual Optimization

Crop Planning using Stochastic Visual Optimization

With increasing world population and decreasing arable land, optimizing the productivity of land is the need of the hour. To meet the growing food demand [5] farmers need to take critical decisions like on what(soil), which (variety), and how much(proportion) in order to maximize the yield. However, a seed variety highly desired by a farmer may be unavailable or in short supply. Therefore, it is critical to evaluate which variety is more likely to be chosen by farmers from a growing region in order to meet demand. As the production varies due to differences in weather conditions [7] and soil quality [3], there cannot be a single seed variety that will yield high production across regions. Hence, predicting the appropriate mix of proportions of different seed varieties is desirable.

While a standalone solution with predicted seed variety or mix of varieties for a region is very helpful, but in the real world, where the number of regions and varieties both can be large, it is very crucial to have visualization based platform to analyze all possible solutions. In this paper, we present a machine learning and optimization based approach to predict seed variety or mix of varieties in appropriate proportions which is more likely to be chosen by farmers from a growing region. We also present our visual analytics tool to understand and analyse the solutions generated by our approach. This tool helps in the decision making process and also provides insightful visualizations.

We use Syngenta Crop Challenge 2016 dataset which requires computation of an optimal combination of upto five soybean varieties for the given region using historical sub-region data and experiment data from a few experiment locations. Our approach to the challenge comprises of (a) machine learning and optimization techniques to compute the solution, as well as (b) a geo-spatial visual analytics tool, ViSeed, to understand the given data and analyse the solutions.

As the production of soybean varies due to differences in weather conditions and soil quality and there is no single variety that will yield high production across the region, we have experimented with two possible solutions to the challenge. The first, global solution, required by the challenge and defined as a combination of upto five varieties to be grown over the entire region. The second, a differentiated solution, consisting of individual optimal combinations for each sub-region. We also compute a spatial cohesion score for each subregion which measures the similarity of the solutions for the sub-region with those of its neighbors. Finally, we show that the differentiated solution performs marginally better and has lower variance than the global solution.

Rest of the paper is organized as follows. In Section 1, we present the problem statement along with out approach to predict the optimal set of varieties and in Section 2, we present our visual analytics tool ViSeed and showcase it for the Syngenta data challenge 2016. In Section 3, we present our results of prediction accuracies and predicted soyabean varieties and conclude in Section 4.

1Methodology and theory

1.1Problem Statement:

Let be the soybean varieties and let be a region with sub-regions . Each of the sub-region has different soil and weather conditions associated with it. Our goal is to find which soybean seed variety, or mix of up to five varieties in appropriate proportions, will best meet the demands of farmers in each sub-region and for whole region . In order to find such mix of seed varieties, we predict the top five varieties for each sub-region in terms of maximum yield and then find the optimal proportion of these five varieties in order to maximize yield and minimize variance in the yield.

Our approach to predict the mix of soybean varieties in appropriate proportion for each subregion and for whole region consists of three steps: 1) Prediction of Weather and Soil attributes, 2) Yield Prediction given the soybean variety, and weather and soil conditions, and 3) Yield Optimization. We also present our visual analytic tool to understand and analyses the solutions generated by our approach. This tool helps in decision making process and also provide insightful visualizations.

1.2Weather and Soil Prediction

For each subregion , let be the weather condition and be the soil condition attributes at time . Given these attributes from initial time to the current time , we use Deep learning based approach LSTM [6] to predict the value of these attributes for time . For each attribute separately, say , we prepare a sequence of its values from time to , and use it as an input to train LSTM with the target of predicting value of at time and then we use the trained LSTM to predict the value for time .LSTM based neural networks are competitive with the traditional methods and are considered a good alternative to forecast general weather conditions [9] . Figure 1 shows an architecture used for the prediction of weather and soil attributes.

Figure 1: LSTM architecture used to predict weather and soil attributes
Figure 1: LSTM architecture used to predict weather and soil attributes
ViSeed: (i) Main Data Exploration Screen (ii) Common Solution Exploration ViSeed: (i) Main Data Exploration Screen (ii) Common Solution Exploration
(i) (ii)

1.3Yield Prediction

Once we predict the weather and soil attributes for the time , we use these attributes as a feature set to predict the yield in every sub-region for each soybean variety , where . We divide the yield value into equally sized bins by taking maximum and minimum from historical data and we treat the prediction problem as a classification problem, where our goal is to predict the bin value of yield. More formally, for each sub-region , we compute probability distributions of yield, one for every soybean variety , where , using Random Forest Classifier (RFC) [2]. RFC is an ensemble learning method that operates by constructing a multitude of decision trees at training time and outputting the class that is the mode of the classes (classification) of the individual trees. As an output, we get the count of each class which represents the number of trees outputting the class. Further, we convert these counts into probabilities by diving each count by the sum of all counts.

1.4Yield Optimization

Given probability distributions of the yield for sub-region , we use an optimization approach to obtain weighted combination of varieties in order to maximize yield and minimize standard variation or variability. Steps to obtain combination of varieties in an appropriate proportion are given as follows:

  1. Given n probability distributions of yield for every soybean variety , where , we calculate expected value and variance of each distribution, represented by , and respectively.

  2. We choose top distributions out of having maximum score calculated as:

    where and are the normalized values between to of and respectively.

  3. We use an optimization technique with objective function of maximizing yield using combination of upto five varities out of chosen top in an appropriate proportion. The objective function and constraints of optimization are given as follows:

    The term is called variability. We ran above optimization for ten thresholds of variability, i.e., ten values of from to with the step size of . For every value of , we get the optimal solution. Therefore, for a sub-region , we get 10 solutions and out of these 10 solutions, we choose the solution having maximum yield and minimum variability and it is called default solution for sub-region

Spatial Cohesion(SC) Score:

For every solution obtained from optimization approach, we calculate SC Score which is calculated as follows: Let for a sub-region , the optimized solution at contains five varieties in some proportion. Let be the set of neighboring sub-regions of which are having maximum distance of miles from the centroid of it. For every in the solution of , we calculate variety score as:

where is the proportion with which variety exist in the solution of neighboring sub-region at . Further, SC score of sub-region is calculated as the average of all variety scores in the solution:

2Visual analytics using ViSeed

We now describe, ViSeed, our visual analytics tool to understand the given data and analyse the solution generated by our analytics methodology.This tool differentiates our work from other related works [1] [8] as it lets the retailer explore varieties performing well in local as well as global areas. As agricultural yields vary widely around the world due to climate and the mix of crops grown [4],ViSeed lets the farmer explore the quality of soil and climatic variations region wise intuitively to take the planting decisions accordingly.

The main screen of ViSeed is divided into two parts. The first part displays a map of the United States over which various sub-region attributes can be visualized, Figure ? (i) A. The second (right hand panel) part, B, contains a tabbed control panel, to switch between various visualizations of the solution data.

Getting Started

A data attribute such as precipitation or solar radiation may be visualized by selecting it from the attribute menu and a year from the timeline as shown in Figure ? (i). Further, as described in the previous section, we first compute the top varieties for each sub-region, based on high expected yield and low variance and from them, an optimal solution with up to five varieties. As a variety may occur in the optimal solution of multiple sub-regions, we compute a distribution of weights for each variety across sub-regions and the expected value of this distribution. The varieties are ranked in decreasing order of expected value which is an indicator of prevalence of the variety across sub-regions and displayed in the right panel when the visualization tool starts up, Figure ? (i), C. Thus, the user is provided a starting point to begin exploring the possible solutions.

The histogram of weights for each variety across sub-regions, using a colour map, is shown alongside its expected value. Selection of a range on the histogram of a variety highlights those sub-regions for which the variety has weight or proportion in the selected range. Clicking on a variety name highlights those sub-regions on the map for which the variety occurs in the optimal solution. Clicking multiple varieties highlights the regions for all, thus allowing the user to visualize cumulative prevalence of varieties.

Common Solution

A user may explore various solutions, for the entire region, by selecting up to five varieties from this list, 1 in Figure ? (ii). On pressing the query button, 2, proportions of each of the selected varieties are computed, 3, and the total yield for the region is predicted, 4.

Differentiated Solution

Each sub-region has a precomputed default solution from among its top varieties. Clicking on a sub-region in the map, Figure ?, 1, brings up the top varieties for that sub-region, 2, along with their weights in the optimal solution, count of sub-regions in which the variety is in the top and the predicted yield distribution for the variety. The sub-regions for which a variety is in the top list can be seen by clicking on the red count bar.

For every solution, we show the Average Yield and Average Standard Deviation and Average offset in % of entire region . The standard deviation and offset of each sub-region is calculated as:

where is the variance of variety and is its proportion in the solution.

Changing Variability

Our tool also allows the user to analyse solutions by playing with different variability thresholds. This can be done by first clicking on the Variance tab. The user can set a variability threshold by moving the slider, Figure 3, 1. On pressing the query button, the list of varieties, with variability below the chosen threshold is displayed, along with their histograms of weights across sub-regions and expected values as before. A new optimal solution is computed for each sub-region and its similarity with the solutions of neighboring sub-regions is calculated as a spatial cohesion score. This score is visualized on the map. The user may also interact with this list of varieties and compute a global solution for the entire region, as described earlier.

Figure 2: Changing Solution Variability
Figure 2: Changing Solution Variability
Figure 3: Changing Solution Variability
Figure 3: Changing Solution Variability

3Quantitative results

In this section, we present our results of LSTM and RFC model used for weather and yield prediction. We used keras, scikit-learn and cvxpy respectively to implement LSTM, RFC and optimization.

Available Data:

We were provided with the following two datasets:

  1. Experiment Dataset:

    It consists of 82000 experiments, in 583 sub-regions, between 2009 and 2015 using 174 varieties. It has three weather and three soil condition attributes for every sub-region.

  2. Region Dataset:

    It consists of 6490 sub-regions with the given three soil and three weather condition attributes from the year 2000 to 2015.

We predict three attributes of weather conditions, temperature, precipitation, and solr radiation for every sub-region of Region dataset. For an attributes say in sub-region , we prepare the sequence of 14 values from year 2000 to 2014 as an input to train LSTM with a target of predicting value of year 2015. We validate and test the LSTM model by dividing Region dataset into training, validation, and test data in the ratio of 70:15:15 respectively. Table 1, shows the normalized root mean square error (N-RMSE) for all three weather attributes on validation and test set. Here, N-RMSE is defined for an attribute say, as

where and are the actual and predicted values, and are maximum and minimum values, of attribute for sub-region . The value of is in our case.

Common Solution: (i) Areas in which Varieties are optimal (ii) Cumulative area in which varieties are optimal
Common Solution: (i) Areas in which Varieties are optimal (ii) Cumulative area in which varieties are optimal

N-RMSE in Table 1 indicating that the prediction of weather attributes using LSTM have less than 1% error for temperature and precipitation and less than 3% error for Solr radiation. We use this trained LSTM model to predict weather attributes for year 2016. Note, we did not predict soil condition parameters as they did not change over time in experiment dataset.

We use experiment dataset to train RFC model by dividing it into three parts train, valid and test dataset in the ratio of 70:15:15 respectively. Soil and weather condition attributes in each experiment has been used as a feature set in RFC and discretized yield as a target variable. N-RMSE of yield predicted on validation and test set using RFC is 6.01% and 6.25% respectively. We use the trained RFC model to predict the yield for 6490 sub-regions in Region dataset with weather and soil attributes for year 2016 as input, predicted using LSTM(as explained above).

Table 1: N-RMSE of three weather attributes on validation and test set using LSTM
Attributes Validation Set Test Set
0.69% 0.78%
0.73% 0.83%
2.6% 2.8%

3.1Insights from ViSeed

Common Solution

In order to compute the common solution, we used ViSeed to check multiple combinations of the top ten growing varieties based on expected value and arrived at the reported solution. The areas in which these varieties are in the optimal differentiated solution are shown in figure ? (i), and the cumulative area for all five is shown in figure ? (ii).

Differentiated Solution: (i) High Yield Areas and Spatial Cohesion (ii) Validation of Spatial Cohesion Differentiated Solution: (i) High Yield Areas and Spatial Cohesion (ii) Validation of Spatial Cohesion
(i) (ii)

Differentiated Solution

Analysing the predicted yield for the differentiated solution, we find two areas with high yield as highlighted in figure ? (i). The spatial cohesion score is also visualised in the same figure and observers to be high for the areas with high yield. We validate this in figure ? (ii), by visualizing the sub-regions in which a variety from a high yield, high spatial cohesion score sub-region is grown. We may conclude that high yield varieties are localized to certain regions, and so they do not occur in the optimal common solution.

Figure 4: Differentiated solutions at different Variability thresholds
Figure 4: Differentiated solutions at different Variability thresholds

Experiments with Variability

In Figure 4, we show the changes in spatial cohesion and yield for different variability thresholds. We find that with a low variability threshold of 0.3, there is no optimal solution for most of the sub-regions (dark-grey areas in the map). Increasing the threshold, results in solutions for most of the sub-regions along with an increase in the average yield per sub-region and the spatial cohesion score. However, beyond a certain threshold, the gain in yield and spatial cohesion is very small.

Our submission to the Syngenta challenge comprised of two parts. We use (a) machine learning and stochastic optimisation to compute solutions and (b) have developed a visual analytics tool, ViSeed, to analyse the results. In particular, we predict weather and soil attributes of each sub-region through time-series regression using LSTMs. For each sub-region and seed variety, a Random Forest classifier is trained on experiment data to predict yield distributions. Next, we compute weights of varieties through stochastic optimization, maximizing expected yield and minimizing variance, for each subregion, followed by visual analytics to choose an optimal global solution based on the spread of each variety across locally optimal combinatios.. Our combination of soybean varieties is as follows - (i) V156774: 48.1%, (ii) V156806: 15.2%, (iii) V152312: 13.5%, (iv) V114565: 11.8% and (v) V152322: 11.4%. We provide a second solution to the challenge consisting of individual optimal solutions for each sub-region which performs marginally better than the first reported above. Our geo-spatial visual analytics tool ViSeed, is designed to explore the raw data as well as aid in optimization. Our entry was not among the top 5 final entries selected from 600 registered teams and as the details of the winning entries have not been made public, we cannot compare our approach with theirs.


In this paper, we propose an approach for crop planning based on machine learning models (RFC and LSTM), stochastic optimization and a visual analytics platform. We have given 2 different solution sets; i) Common solution for entire region, ii) Differentiated solutions at sub-region level. We use expected yield based on a model using sub-region wise predictions of weather and soil conditions, standard deviation of expected yield as the criteria to select seed varieties. We give the spatial cohesion score for each solution which helps to find the similar solutions in the neigbouring sub-regions. We also present a geo-spatial visual analytics tool which has the capability of exploring raw data and helps the retailer in decision making by allowing exploration of solutions at sub-region as well as global level.


  1. Multiobjective optimization of crop-mix planning using generalized differential evolution algorithm.
    O. Adekanmbi and O. O. Olugbara. 2015.
  2. Random forests.
    L. Breiman. Machine learning, 45(1):5–32, 2001.
  3. Statistical and neural methods for site–specific yield prediction.
    S. Drummond, K. Sudduth, A. Joshi, S. Birrell, and N. Kitchen.
  4. Solutions for a cultivated planet.
    J. A. Foley, N. Ramankutty, K. A. Brauman, E. S. Cassidy, J. S. Gerber, M. Johnston, N. D. Mueller, C. O’Connell, D. K. Ray, P. C. West, et al. Nature, 478(7369):337–342, 2011.
  5. Food security: the challenge of feeding 9 billion people.
    H. C. J. Godfray, J. R. Beddington, I. R. Crute, L. Haddad, D. Lawrence, J. F. Muir, J. Pretty, S. Robinson, S. M. Thomas, and C. Toulmin. science, 327(5967):812–818, 2010.
  6. Long short-term memory.
    S. Hochreiter and J. Schmidhuber. Neural computation, 9(8):1735–1780, 1997.
  7. How do weather and climate influence cropping area and intensity?
    T. Iizumi and N. Ramankutty. Global Food Security, 4:46–50, 2015.
  8. Soybean varieties portfolio optimisation based on yield prediction.
    O. Marko, S. Brdar, M. Panic, P. Lugonja, and V. Crnojevic. Computers and Electronics in Agriculture, 127:467–474, 2016.
  9. Sequence to sequence weather forecasting with long short-term memory recurrent neural networks.
    M. A. Zaytar and C. El. 143:7–11, 06 2016.
Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minumum 40 characters
Add comment
Loading ...
This is a comment super asjknd jkasnjk adsnkj
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test description