wikillm

Paper · 2021-05-04 · cs.LG

Winter wheat yield prediction using convolutional neural networks from environmental and phenological data

A 1-D convolutional network predicts winter wheat yield for 271 German counties from weekly weather, soil and phenology inputs. On three time-ordered test years (2017 to 2019) it beats eight baselines on RMSE, MAE and correlation, and SHAP is used to rank the inputs. Author-reported; no official code found.

Convolutional neural networkGradient-boosted decision treesShapley valueFeature scalingagriculturecrop-yieldinterpretability

arXivPDFMarkdown17 min read

AI-compiled by claude-haiku-5-5 on 2026-11-22, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

Farmers, agronomists and planners would like to know how much wheat a region will bring in before the harvest. This paper tries to predict the winter wheat yield of each of Germany's 271 counties for each year from 1999 to 2019. The inputs are the weather week by week, the soil of each county, and the dates on which the wheat was sown, flowered and was harvested.

The core idea is a neural network that reads the weekly weather as a sequence. A convolutional network slides small filters along that sequence, much as an image network slides filters across pixels, so it can pick up patterns such as a hot or dry spell at a particular stage of the season. Its output is joined with the soil and date inputs, and a few more layers turn everything into one yield number.

The authors compare this network with eight standard machine learning methods, among them random forests, gradient boosting and a plain feed-forward network. Their network comes out ahead in all three test years. They also use SHAP, a method that splits each prediction among the inputs, to see which inputs drive the predictions. The inputs they name as most important are a soil water measure, and wind speed and radiation in particular weeks.

TL;DR

  • A 1-D convolutional network predicts winter wheat yield per county and year from 45 weekly values per weather variable, plus soil and phenology inputs § Acquisition (Data acquisition) fig. 3.
  • Trained on 1999 to 2016, 1999 to 2017 and 1999 to 2018, and tested on 2017, 2018 and 2019, it has the lowest RMSE and MAE and the highest correlation of the nine models in each test year tab. 1. These are author-reported single runs.
  • In 2019 its RMSE is 0.64 t/ha against 0.74 for the best baseline, a DNN tab. 1.
  • SHAP rankings are used to drop features; the retrained models lose accuracy on some metrics, which the text does not fully acknowledge tab. 2.
  • No official code was found. Several training details (optimiser, learning rate, epochs, batch size, loss) are not stated, so a reimplementation will differ.

Problem

Crop yield depends on genotype, weather, soil and management, which interact in complicated ways § Introduction. Process-based crop models need parameter data that is often unavailable, and statistical methods are offered as a complement § Introduction. The paper sets three goals: benchmark modern machine learning for winter wheat in Germany, propose a CNN with a 1-D convolution that outperforms the baselines, and evaluate how weather, soil and phenology features affect the predictions over the season § Introduction.

Method

Convention. The paper's sections have no numbers, so they are cited by title: § Acquisition (Data acquisition), § Methods (subsection), § Results (subsection), § Analysis, § Conclusions. The opening text has no heading and is cited § Introduction. The version used is the published Scientific Reports article (2022, 12:3215); the arXiv record is v2 and was not compared to it.

Data. The unit of analysis is a county (NUTS3 level) and a year § Acquisition (Data acquisition).

  • Target: winter wheat yield from the regional database, in t/ha, for 271 counties and 1999 to 2019 § Acquisition (Data acquisition) fig. 6.
  • Weather: daily maximum and minimum temperature, radiation, precipitation, relative humidity and wind speed from the German weather service, interpolated to a 1 km grid. They are averaged to NUTS3 by land-use weights (CORINE 2006 at 250 m) and then averaged per week § Acquisition (Data acquisition). The text gives a 365:52 reduction in the number of time steps.
  • Soil: four variables (LL, DUL, SAT and BD) from the soil map at 1:1,000,000, taken to 1.3 m depth § Acquisition (Data acquisition). LL is crop-available water at permanent wilting point, DUL at field capacity, SAT at saturation, and BD is bulk density fig. 7.
  • Phenology: sowing, flowering and harvest day of year, from the phenology database, mapped to the grid. For each county, 50 random weather and soil samples are drawn and averaged § Acquisition (Data acquisition).
  • Size: 5,692 instances and 277 columns, from weekly data plus phenology and soil § Methods (Input combinations and parameter calibration). The growing season from sowing to harvest runs about 290 to 320 days in 2019 fig. 2.

Feature scaling. Each feature is z-scored, using its own mean and standard deviation eq. 1 § Acquisition (Data acquisition).

x^{\text{scaled}}_{i,j} = \frac{x_{i,j} - \mu_j}{\sigma_j} eq. 1

Proposed CNN. The network has three parts fig. 3 § Methods (Description of ML models).

  1. Weather branches. Each of the six weather variables is a sequence of 45 weekly values. Each goes through the same stack of layers: convolution with 16 filters, kernel 9, stride 1; average pooling 2 with stride 2; convolution with 32 filters, kernel 3; pooling; convolution with 48 filters, kernel 3; pooling; convolution with 64 filters, kernel 3 fig. 3. Padding is "valid", and ReLU is used in all layers except the last ones fig. 3. Each branch yields a 64-value code, and the six codes are concatenated into 384 values fig. 3. The text says the variables go into "the same CNN model separately" § Methods (Description of ML models). Whether the branches share weights is not stated.
  2. Phenology and soil branch. Those inputs pass through two dense layers of 10 units each fig. 3.
  3. Head. The 384 weather values and the 10 static values are concatenated into 394 values. Dense layers of 128 and 32 units follow, then a single output unit for yield fig. 3.

The layer lengths follow from the settings in fig. 3 with valid padding. They are derived here, not stated by the paper: 45 to 37 to 18 to 16 to 8 to 6 to 3 to 1 weekly steps.

Pseudocode
# Proposed CNN forward pass  [fig. 3]
# Input:  weather (B, 6, 45) weekly values; phenology (B, 3); soil (B, 4)
# Output: predicted yield (B, 1), in t/ha  [fig. 6]

def predict_yield(weather, phenology, soil):
    # One branch per weather variable, same layer settings  [fig. 3]
    # Weight sharing across branches is not stated
    # Valid padding; ReLU after each layer except the last  [fig. 3]
    codes = []
    for variable in range(6):
        x = weather[:, variable, :]              # (B, 45)
        x = conv1d(x, 16, kernel=9, stride=1)    # (B, 16, 37)
        x = avg_pool(x, kernel=2, stride=2)      # (B, 16, 18)
        x = conv1d(x, 32, kernel=3, stride=1)    # (B, 32, 16)
        x = avg_pool(x, kernel=2, stride=2)      # (B, 32, 8)
        x = conv1d(x, 48, kernel=3, stride=1)    # (B, 48, 6)
        x = avg_pool(x, kernel=2, stride=2)      # (B, 48, 3)
        x = conv1d(x, 64, kernel=3, stride=1)    # (B, 64, 1)
        codes.append(flatten(x))                 # (B, 64)

    # Concatenate the six codes  [fig. 3]
    weather_code = concat(codes)                 # (B, 384)

    # Phenology and soil: two dense layers of 10 units  [fig. 3]
    static = concat([phenology, soil])           # (B, 7)
    static = relu(dense(static, 10))
    static = relu(dense(static, 10))

    # Merge, then three dense layers  [fig. 3]
    merged = concat([weather_code, static])      # (B, 394)
    h = relu(dense(merged, 128))
    h = relu(dense(h, 32))
    # Activation of the last layer: not stated, caption is unclear  [fig. 3]
    return dense(h, 1)

Baselines. Eight methods are compared: K-nearest neighbours, random forest, XGBoost, Lasso, Ridge, a regression tree, support vector regression and a DNN § Methods (Description of ML models) tab. 1. The Euclidean distance used by the nearest-neighbour method is

d(p,q) = \sqrt{\sum_{i=1}^{n}(q_i - p_i)^2} eq. 2

and support vector regression minimises

\min \; \tfrac{1}{2}\lVert w\rVert^2 + C \sum_{i=1}^{n} \lvert \epsilon_i \rvert eq. 3

with C a trade-off parameter and epsilon a margin § Methods (Description of ML models). The DNN is described only as a feed-forward network with several hidden layers and nonlinear activations. Its layer sizes are not stated in the text. Software: Python, scikit-learn and TensorFlow § Methods (Description of ML models). Hardware is not stated.

Splits and tuning. Three train and test pairs are used, so that each model is always tested on later years § Results (Prediction results).

Pseudocode
# Three time-ordered train/test pairs  [§ Results] (Prediction results)
# Standardisation scope: not stated. Tuning: see Hyperparameters.
for test_year in [2017, 2018, 2019]:
    train = rows with year from 1999 to test_year - 1
    test = rows with year == test_year
    model = fit(train)
    rmse, mae, r = evaluate(model, test)     # [eq. 4] [eq. 5] [eq. 6]

Hyperparameters were tuned by grid or randomized search with cross-validation. The text states 1,000 iterations on a 3-fold setting, which it calls 3,000 trials for each model. The validation years are chosen randomly by cross-validation within 1999 to 2016, and the search is said to aim at the lowest error on the test data § Methods (Input combinations and parameter calibration). The search ranges and the chosen baseline values are in SI Table S4, which is not in the source used for this card.

Metrics. MAE, RMSE and correlation are reported § Methods (Model evaluation).

\mathrm{MAE} = \frac{1}{n}\sum_{i=1}^{n} \lvert y_i - \hat{y}_i \rvert eq. 4

\mathrm{RMSE} = \sqrt{\frac{1}{n}\sum_{i=1}^{n} (y_i - \hat{y}_i)^2} eq. 5

r = \sqrt{1 - \frac{\sum_{i=1}^{n}(y_i - \hat{y}_i)^2}{\sum_{i=1}^{n}(y_i - \bar{y})^2}} eq. 6

Here y_i is the ground-truth yield, y-hat_i the prediction, y-bar the mean of the ground truth, and n the number of data points § Methods (Model evaluation).

Interpretation. Shapley values are computed post hoc with Kernel SHAP (KernelExplainer). Each feature's value is its average marginal contribution over feature orderings § Methods (Model interpretability). The per-feature importance is the mean absolute Shapley value over the data § Analysis (Feature importance explanation). Features are ranked by it, and the top 75% and top 50% are used to retrain the CNN § Results (Feature selection).

Residuals and errors. Residuals of the top three models are checked for normality with Shapiro–Wilk and Anderson–Darling tests fig. 5. Per-county percentage error is computed as follows eq. 7 fig. 6.

\text{Percentage error}_i = \left|\frac{A_i - P_i}{A_i}\right| \times 100\% eq. 7

Here A_i is the actual yield and P_i the predicted yield for county i.

Hyperparameters

NameValueWhereNotes
Weather variables6: precipitation, min and max temperature, radiation, relative humidity, wind speed§ Acquisition (Data acquisition)
Weekly steps per weather variable45fig. 3Week indexing and start not stated; see Pitfalls
Phenology inputs3: sowing, flowering, harvest day of year§ Acquisition (Data acquisition)
Soil inputs4: LL, DUL, SAT, BD§ Acquisition (Data acquisition)Fig. 3 draws S1 to S7; see Pitfalls
Conv layer 116 filters, kernel 9, stride 1fig. 3valid padding
Poolingaverage, kernel 2, stride 2fig. 3after conv layers 1 to 3 of the weather branch
Conv layers 2 to 432 / 48 / 64 filters, kernel 3, stride 1fig. 3
Weather code length64 per variable, 384 concatenatedfig. 3
Static dense layers10 units, 10 unitsfig. 3
Head dense layers128, 32, then 1 outputfig. 3
ActivationReLU except the last layersfig. 3which layers count as last is not stated
Feature scalingz-score per featureeq. 1fit on training years only? not stated
Optimiser, learning rate, batch size, epochs, loss, initialisation, regularisationnot stated—the text gives no training details for the CNN
Train / test pairs1999–2016 → 2017; 1999–2017 → 2018; 1999–2018 → 2019§ Results (Prediction results)
Validationrandom cross-validation within 1999–2016§ Methods (Input combinations and parameter calibration)
Search budget (baselines)1,000 iterations, 3-fold CV, 3,000 trials per model§ Methods (Input combinations and parameter calibration)whether the CNN was tuned this way: not stated
Baseline hyperparametersin SI Table S4§ Methods (Input combinations and parameter calibration)not in the source used for this card
Feature selectiontop 75% and top 50% by mean absolute Shapley value§ Results (Feature selection)
SHAP methodKernel SHAP (KernelExplainer)§ Methods (Model interpretability)background data and sample count not stated
Random seedsnot stated—single run per model and split

Results

Author-reported. Setup: 271 German counties, 1999 to 2019, 5,692 instances and 277 features; the proposed CNN fig. 3; eight baselines tab. 1; hardware not stated § Methods (Input combinations and parameter calibration).

The abstract and conclusions claim that the CNN has 7 to 14% lower RMSE, 3 to 15% lower MAE and 4 to 50% higher correlation than the best baseline across the test years § Conclusions. See Pitfalls for how these ranges compare to the table.

Table 1: training and test results tab. 1. Rows labelled "Training" are the fit on the training years. Rows labelled "Test" are the held-out years. The caption calls them "training and validation results". Columns are the nine methods, with RF for random forest and DNN for the feed-forward network.

SettingKNNRFXGBoostLassoRidgeRegression TreeSVRDNNProposed CNN
Training 1999 to 2016 (RMSE)0.330.180.450.570.560.460.330.410.48
Test on 2017 (RMSE)0.880.790.731.190.910.850.860.800.66
Training 1999 to 2017 (RMSE)0.380.320.450.610.590.540.380.440.47
Test on 2018 (RMSE)1.060.901.051.231.320.951.041.000.84
Training 1999 to 2018 (RMSE)0.440.420.520.670.650.590.440.430.50
Test on 2019 (RMSE)1.070.810.771.271.380.981.020.740.64
Training 1999 to 2016 (MAE)0.250.140.350.440.440.350.240.320.38
Test on 2017 (MAE)0.670.640.591.030.750.690.710.660.52
Training 1999 to 2017 (MAE)0.270.230.380.470.460.410.270.350.37
Test on 2018 (MAE)0.880.730.841.031.090.780.820.810.71
Training 1999 to 2018 (MAE)0.300.290.410.510.500.440.290.340.39
Test on 2019 (MAE)0.840.660.591.001.080.810.850.590.50
Training 1999 to 2016 (r)0.940.990.890.810.820.890.940.910.90
Test on 2017 (r)0.300.620.630.410.400.570.350.600.65
Training 1999 to 2017 (r)0.920.950.880.780.800.830.920.900.88
Test on 2018 (r)0.300.520.460.150.120.480.280.390.78
Training 1999 to 2018 (r)0.890.910.840.730.750.800.900.900.87
Test on 2019 (r)0.490.670.710.440.440.570.450.730.81

Source: tab. 1. The table is transcribed from the page image in the PDF. Check any value against the PDF before relying on it. The paper's text reports the same test-year values.

Table 2: feature subsets with the proposed CNN tab. 2. Retrained on the top 75% and top 50% of features ranked by Shapley value, and on weekly weather alone.

Test set (metric)CNN (full model)CNN (top 75%)CNN (top 50%)CNN (weather only)
Test on 2017 (RMSE)0.660.710.701.20
Test on 2018 (RMSE)0.840.750.961.11
Test on 2019 (RMSE)0.640.800.811.15
Test on 2017 (MAE)0.520.570.561.04
Test on 2018 (MAE)0.710.610.770.90
Test on 2019 (MAE)0.500.630.630.95
Test on 2017 (r)0.650.510.550.35
Test on 2018 (r)0.780.710.430.10
Test on 2019 (r)0.810.670.630.50

Source: tab. 2. The full-model column matches the proposed-CNN column of tab. 1.

Other reported results.

  • The CNN's 2019 correlation with ground truth is 0.78 in the hexbin plot, against 0.71 for XGBoost and 0.70 for DNN fig. 4 § Results (Prediction results). This disagrees with tab. 1; see Pitfalls.
  • Residual tests on the 2019 test year, Shapiro–Wilk and Anderson–Darling p-values: DNN 0.12 and 0.09, CNN 0.05 and 0.39, XGBoost 0.10 and 0.43. The authors treat residuals as approximately normal fig. 5 § Analysis (Feature importance explanation).
  • Per-county percentage error for the CNN in 2019 ranges from 0.1% to 77.6%, with the highest errors in the east and north-east fig. 6 eq. 7 § Analysis (Feature importance explanation).
  • Most important features for 2019 by mean absolute Shapley value fig. 7: DUL first, then wind speed in week 10, radiation in week 7, and SAT. The abstract names DUL, wind speed in week 10 and radiation in week 7 as the most critical features § Conclusions.
  • Mean normalised Shapley values of the six weather variables, as reported: wind speed 13.20, minimum temperature 12.03 and radiation 9.56 § Analysis (Feature importance explanation).
  • Force plots explain the minimum, median and maximum predicted yields of 2019 fig. 8.

Paper vs code

No official code.

The paper and its abstract name no code repository, project page or arXiv comment link. I ran these searches on GitHub: "winter wheat yield prediction", "winter wheat yield CNN", "crop yield convolutional SHAP Germany", "wheat yield 1D-CNN SHAP", "wheat yield Germany NUTS3" and "yield prediction weekly phenology soil weather". I also searched GitHub users for the names Saeed Khaki, Nima Safaei and Jaber Rahimi. None of the repository hits belong to the authors. The account of Saeed Khaki has no repository for this paper. Its repositories include a CNN-RNN crop yield project, which is code for a different paper. The Nima Safaei accounts hold no crop repositories.

Pitfalls

  • Test data used for choosing hyperparameters. The text says the setting with the lowest error on the test data was kept § Methods (Input combinations and parameter calibration). Read literally, this selects on the 2017 to 2019 test years. Select on a validation period before 2017 only, and report the test years once.
  • Random validation within the training period. The validation years are drawn at random from 1999 to 2016 § Methods (Input combinations and parameter calibration). Adjacent years of the same county can then land in training and validation. This works against the time-ordered split the paper uses for testing § Results (Prediction results). Use a blocked or time-ordered validation split.
  • CNN training details are missing. The text gives the layer layout fig. 3 but no optimiser, learning rate, batch size, epochs, loss, weight initialisation, regularisation or early-stopping rule. It also does not say whether the CNN got the same tuning budget as the baselines. A reimplementation will not match the numbers without guessing these.
  • Weight sharing across weather branches. The text says the six variables "go into the same CNN model separately" § Methods (Description of ML models). Fig. 3 draws six branches with identical layer settings. Whether the weights are shared, and whether the weather branches are shared across time, is not stated.
  • Soil input count. The text lists four soil variables, LL, DUL, SAT and BD § Acquisition (Data acquisition). Fig. 3 labels seven soil inputs, S1 to S7 fig. 3. The 277 columns in the text equal 6 × 45 + 3 + 4, so four is consistent with the count. Implement four unless the authors say otherwise.
  • Instance count. 271 counties over 21 years (1999 to 2019) gives 5,691 instances, not the 5,692 stated § Methods (Input combinations and parameter calibration). The text does not explain the difference.
  • Week indexing conflict. Fig. 7 says the number after each weather variable is "the week of the year the information was recorded" fig. 7. The analysis text instead refers to "week seven after wheat planting" § Analysis (Feature importance explanation). Which one is right is not resolved, and the week at which the 45-week window starts is not stated. Derived, not stated: 45 weeks is 315 days, inside the roughly 290 to 320 day sowing-to-harvest span in fig. 2.
  • Scaling scope. Eq. 1 uses a mean and standard deviation per feature eq. 1. The text does not say whether they come from the training years only. Using all years would leak test information. The yield target's scaling is not stated.
  • Eq. 6 is not the usual Pearson correlation. As printed, r is the square root of 1 minus the ratio of residual to total sum of squares eq. 6. That is a function of the coefficient of determination, not of covariance. It is undefined when the residual sum exceeds the total sum, and it cannot be negative. The text calls it "correlation coefficient" and reports R² = 0.61 for the CNN, which equals 0.78² fig. 4. Implement the Pearson correlation and check what the authors computed.
  • Figure 4 and Table 1 disagree on 2019 correlations. Fig. 4 gives CNN 0.78, DNN 0.70, SVR 0.51, regression tree 0.47, Lasso 0.47 and KNN 0.48 for 2019 fig. 4. Table 1's 2019 test row gives CNN 0.81, DNN 0.73, SVR 0.45, regression tree 0.57, Lasso 0.44 and KNN 0.49 tab. 1. XGBoost (0.71) and RF (0.67) agree. Which set is correct is not stated. This card uses Table 1, which matches Table 2's full-model column.
  • Abstract ranges against the table. Using the two-decimal values in tab. 1, the RMSE range of 7 to 14% lower reproduces (2018: about 7%, 2019: about 14%). The MAE range of 3 to 15% lower also reproduces (2018: about 3%, 2019: about 15%). The correlation lower bound of 4% does not: 2017 gives 0.65 against 0.63 for XGBoost, about 3%. Unrounded values may explain this.
  • Feature selection is not a clean test. Shapley values are computed on the test data § Conclusions, and the retrained models are evaluated on the same test years § Results (Feature selection). The text says the CNN's performance "did not drop significantly" and "slightly improved" § Results (Feature selection). Table 2 does not support that for every metric: the top 50% model has 2018 correlation 0.43 against 0.78 for the full model, and 2019 RMSE 0.81 against 0.64 tab. 2.
  • Single runs. Each model is trained once per split. No seeds, variances or confidence intervals are reported tab. 1. Small gaps, such as the CNN's 2018 RMSE of 0.84 against 0.90 for random forest, are not shown to be significant.
  • SHAP details are missing. The background data for Kernel SHAP and the number of explained instances are not stated § Methods (Model interpretability). The "normalised" Shapley values for the weather variables § Analysis (Feature importance explanation) are not defined in the text. The authors acknowledge that SHAP is a post hoc method and not a causal explanation § Conclusions.
  • Relative error near zero. Eq. 7 divides by the actual yield eq. 7, so counties with small actual yields can show very large percentages. The reported maximum of 77.6% is from this formula fig. 6.
  • Weekly precipitation. All weather variables are averaged per week, and the text says "taking the average" for precipitation too § Acquisition (Data acquisition). A weekly total is more common for precipitation. The paper does not discuss the choice.
  • Data and supplement. Data sources and the baseline hyperparameters are in the supplement § Acquisition (Data acquisition) § Methods (Input combinations and parameter calibration). The supplement was not available for this card. Check it before using the baseline numbers for anything beyond these tables.

Lineage

  • Builds on: none stated. The baselines are standard methods; the paper cites nearest neighbours § Methods (Description of ML models), XGBoost § Methods (Description of ML models) and the Euclidean-distance formula.
  • Compared against: KNN, random forest, XGBoost, Lasso, Ridge, regression tree, SVR and a DNN tab. 1.
  • Superseded by: not known from content in this wiki.

Source and license

Adapted from “Winter wheat yield prediction using convolutional neural networks from environmental and phenological data” by Amit Kumar Srivastava, Nima Safaei, Saeed Khaki, Gina Lopez, Wenzhi Zeng, Frank Ewert, Thomas Gaiser, Jaber Rahimi (arXiv:2105.01282), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors.