Artificial intelligence for crop prediction
Online Master. First Edition. 2021 Crop yields are not exempt from suffering from the multiple harmful effects for which climate change is responsible. Extreme weather is more common now than it was centuries ago,…
A learning project shared by the community. The article documents its team, methods and results; it does not establish that the prototype is ready for real-world use.

Production trend from 1940 to 2020
Máster Online. First Edition. 2021
Harvests are sensitive to weather conditions. Droughts, floods and extreme temperatures can affect yields, which led us to explore models linking environmental data with production.
The initial hypothesis of the project focused on the prediction of harvests over a region within Spain. After making sure of the little information about the harvests that is currently available and the non-existent standardization in the data format, it was decided to choose Illinois as the location for our project.
To put the project in context, Illinois has generally flat terrain and a substantial agricultural sector, particularly maize and soybeans. Climate variability and extreme weather can affect its harvests.
It can be seen in the graph shown that the yield of corn production has increased over the years, at the same time we can see that there have been drops in production caused by extreme weather events.
This very particular context of the production trend in Illinois helped us understand that carrying out a project based on the understanding and categorization of the data as well as the subsequent treatment of the same with a prediction model would result in the possibility of predicting the distribution of production in Illinois in the future and with this we could help the entire territory to prevent and counteract low production peaks caused by climatic catastrophes or other climatic factors.
Project steps
To predict crop yields, we prioritised data cleaning and preparation. We mainly used two historical series: temperature two metres above the ground and the EVI vegetation index. We also took the first difference of the yield series, subtracting each observation from the next to reduce the trend and producing a series with one fewer observation.
The next step is the alignment of the samples since the temperature and vegetation index samples were not carried out on the same day. To align both information captures we interpolate the EVI series in this way we generate a new set of captures so that both series coincide.
After carrying out all these steps, essential to be able to create the prediction model, we have managed to have the data now clean to proceed with it. At this point we have explored several linear models (LinearRegression, Lasso, Ridge) and the result has not been what we expected since we have encountered a lot of overfitting. In the end we have selected a RandomForestRegressor because we considered that it was the most appropriate model for this case, finally for the selection of the hyperparameters we use the RandomizedSearchCV.
Conclusion
This project is a starting point for monitoring, evolving and improving the production performance of corn crops in Illinois. We are pleased to have found some interesting insights from the data sets provided: a relationship between crop yield and time, temperature and EVI value.
In the results, the absolute size of the error varied little with production volume, so its relative impact was smaller at higher yields. Adding variables such as rainfall, soil characteristics and frost is a possible improvement that would need to be evaluated.


As a point of improvement of the project we could highlight the optimization in the interpolation calculation to improve the code processing speed. It is an example that with optimal data and variables, useful prediction models can be developed for geographically equivalent locations.
Finally, we would like to thank Saturdays AI for giving us the opportunity to do this project and meet other people involved in the field of AI, as well as test our skills in ML and expand our horizons on new topics previously unknown to us.
Members
- Paco Murcia
- Luis Muñoz
- Fernando Romera
- Marta Mateu
Project presentation: DemoDay
More Artificial Intelligence!
Saturdays.AI makes AI more accessible through shared learning and projects with a social purpose. Our motto is AI4ALL IS AI4GOOD.
A story from the Saturdays.AI community. Originally published on March 9, 2022.
← More community stories


