Leveraging AI to Enhance Food Security and Access in Africa and Asia

TEAM JUKEBOX, Spring ’24 Cohort

HamoyeHQ

--

Grace Kenneth-Obasi, Micah Okpara, Betty Igbukan, Abdulwahab Olalekan Lukman, Sam Ayodeji, Tomiwa Tokode, Mahlogonolo Mathekga, Dorcas Idio, Mercy-Shalom Adedayo, Ayomide Iluyomade, Ajayi John, Chidubem Onwuchuluba, Sowmya Vara, Thoyaja Vishwanatha, Reginald Azuatalam

Introduction

Food security is a condition where all people, at all times, have physical, social, and economic access to sufficient, safe, and nutritious food that meets their dietary needs and food preferences for an active and healthy life. Artificial intelligence (AI) plays a pivotal role in enhancing food security initiatives in Asia and Africa, offering innovative solutions to address agricultural challenges. In East Africa, locust infestations, coupled with climate change and political instability, have severely disrupted agricultural productivity (FAO, 2020). Similarly, in India, the second wave of COVID-19 saw rural areas struggling with both health crises and food shortages (Indian Express, 2021). These instances highlight the pressing need for innovative solutions to ensure food security and access in these regions. It comprises four key components: availability, accessibility, utilisation, and stability. Ensuring sustainability is also crucial, involving the long-term provision of sufficient food for everyone while promoting a healthy life. By leveraging AI to enhance food security and access in Africa and Asia, this project aims to create a sustainable and resilient food system capable of withstanding the challenges of climate change, economic instability, and political unrest. As Dr. Shenggen Fan aptly stated, “The lack of food security in Africa and Asia is not just a question of hunger; it threatens the very foundation of stability and development in these regions. Without urgent and sustained efforts to address food insecurity, we face dire consequences, including increased malnutrition, stunted economic growth, and a heightened risk of social unrest.

Problem Statement

This study addressed the uneven agricultural yields across Africa and Asia, influenced by factors such as climate change, political instability, weather conditions, soil quality, and socio-economic disparities. These variations led to a lack of food availability in some areas. The study identified regions with diverse agricultural outputs and investigated the underlying causes using predictive analysis and generative AI. By enhancing agricultural practices, the project sought to improve food security and promote economic development. Failure to address these challenges could result in increased food insecurity, economic instability, and heightened vulnerability to climate change, potentially leading to widespread malnutrition.

Aims & Objectives

The aim of this project was to develop and implement AI-based solutions tailored to the specific challenges of these regions in Africa and Asia, ultimately leading to increased food production, reduced waste, and improved access to nutritious food.

Objectives include :

  • Conduct a comprehensive assessment of food security across diverse regions in Africa and Asia.
  • Create machine learning models to predict crop yields, monitor soil health, and forecast weather patterns to assist farmers in making informed decisions.
  • Implement precision agriculture techniques to optimise farming practices, enhance crop yields, and minimise waste, thereby promoting sustainable food production.
  • Develop a user-friendly AI-driven chatbot to provide policymakers with accessible resources for implementing sustainable and productive agricultural strategies, thereby promoting long-term food security and economic growth in Africa and Asia.

Data Collection

The change in temperature, production indices, and crop yield datasets were obtained from FAOSTAT (Food and Agricultural Organization of the United Nations). FAOSTAT offers data on land use and land cover and also plays a vital role in facilitating global agricultural research and trend analysis. The precipitation dataset was obtained from the World Bank Group.

Temperature: The change in temperature dataset comprises variables such as the country, country code, and years. The FAOSTAT temperature change on land domain disseminates statistics of mean surface temperature change by country, with annual updates. The current dissemination covers the period 1961–2023. Statistics are available for monthly, seasonal and annual mean temperature anomalies, i.e., temperature change with respect to a baseline climatology, corresponding to the period 1951–1980

Production Indices: contains variables such as country, country code, crop (produce), and years. The FAO indices of agricultural production show the relative level of the aggregate volume of agricultural production for each year in comparison with the base period 2014–2016. Indices for meat production are computed based on data for production from indigenous animals.

Crop Yield: contains crops and Livestock products such as ‘Fruits’, ‘Barley’, ‘Maize’, ‘Vegetables’, ‘Rice’, ‘Millets’, ‘Sorghum’ — Yield — 100g/ha ; ‘Livestock and Animal Products’ — Yield/Carcass Weight — 100 g/An

Data Preparation

The data processing workflow handles datasets from 98 countries in Asia and Africa, focusing on crop yield, production indices, and environmental factors. The process includes loading and inspecting data for missing values, categorising crop yield data, consolidating multiple CSV files, and removing irrelevant categories. Mean production indices are calculated, and precipitation and temperature datasets are cleaned for missing years. All datasets are merged based on country codes, followed by rearranging columns and saving the merged dataset as a CSV file. This approach ensures a clean, consistent dataset for further analysis of agricultural and environmental factors.

Exploratory Data Analysis

In the initial stages of our analysis, we performed exploratory data analysis (EDA) on the `temperature_data` and `crop_data` datasets. For `temperature_data`, we used descriptive statistics and the `.info()` method to ensure data integrity, transformed the data to a long format with `pd.melt()`, and categorised temperatures into ‘Low’, ‘Moderate’, and ‘High’. We visualised trends using a colour-coded palette and an interactive dropdown widget for country-specific analysis. A detailed profiling report was generated using `ProfileReport`.

For `crop_data`, we computed descriptive statistics, aggregated yearly crop yields by country, and visualised trends with bar plots. A function was developed to annotate bar plots with precise yield values. Finally, we integrated temperature and crop yield datasets to explore correlations between temperature fluctuations and agricultural productivity, using scatter plots for visualisation. This comprehensive approach laid a solid foundation for further analysis of climate impacts on crop yields.

  • Temperature trend showing the low, moderate and high categories of every nation

To calculate the average yield for each crop, we grouped the data by crop and calculated the mean yield.

  • Average Yield of each Crop category by countries

Average Yield for Each Crop over the years

  • Average Yield of Fruits over the years
  • Average Yield of Livestock and Animal Products over the years
  • Average Yield of Barley over the years
  • Average Yield of Rice over the years
  • Average Yield of Maize over the years
  • Average Yield of Sorghum over the years
  • Average Yield of Vegetables over the years
  • Average Yield of Millets over the years
  • The overall average yield for each crop across all countries and years.
  • Top 10 Highest Yielding Crops
  • Countries Producing the Highest Yielding Crops

Next, we identified the countries producing the highest yielding crops by grouping the data by country and crop, then calculating the mean yield and sorting. We calculated the total crop yield for each year by summing the yields across all countries and crops for each year. To visualise the yearly crop yield trend, we plotted a line chart of the total yields per year. Line Chart: Displayed crop yield indices trends over the years.

  • Displayed crop yield indices trends over the years.
  • Correlation between Temperature and Crop Yield

We calculated the correlation between temperature and crop yields to understand their relationship. Correlation Matrix: Provided insights into the strength and direction of the relationship.

Highest Performing Crop Yields Over the Years– We went further to identify which crops performed well over the years by using the highest yield of the crops and the countries in which they were planted.

  • Top 5 Crops yielded more over the years

Crop Yields by Country

It was necessary to check for the countries that had good yields of crops. This gave us a vivid insight on the dataset. Since we are dealing with two continents; Africa and Asia, visualisations were divided into two parts based on the countries found in each continent.

  • Crop Production in Africa
  • Crop Production in Asia
  • Average Crop Yield across Africa and Asia using FOLIUM (Interactive)
  • Average Precipitation by Country
  • Average Precipitation across Africa and Asia using FOLIUM (Interactive)

Modelling & Evaluation

Six distinct models were implemented: Linear Regression, Lasso Regression (Least Absolute Shrinkage and Selection Operator), Support Vector Regression (SVR), Decision Tree Regressor and Random Forest Regressor.

The models were selected based on the desire to identify and quantify the underlying factors contributing to food insecurity, and develop predictive models capable of forecasting food shortages and predicting crop failures.

1) Linear Regression: In the context of food security, Linear Regression was employed to model the relationship between crop yields and climatic factors such as temperature and rainfall. By identifying trends and quantifying the impact of these factors, it helped in predicting future crop yields and assessing how changes in climate might affect agricultural productivity.

2) Ridge Regression: Ridge Regression was applied to predict crop yields and manage multicollinearity in datasets with highly correlated features. It helped in stabilising the estimates and improving model performance, especially when dealing with datasets where features were interrelated.

3) Lasso Regression: Lasso Regression was particularly useful when dealing with datasets with many features, where some might not have been relevant for predicting crop yields. It helped in identifying the most significant factors affecting crop production, leading to more interpretable models and potentially better insights for targeted interventions in agricultural practices.

4) Support Vector Regression (SVR): SVR was used to predict crop yields or temperature fluctuations where the relationship between the input features and the target variable was not linear. It was useful for capturing complex relationships and interactions between various environmental factors and crop productivity.

5) Decision Tree Regressor: Decision trees split the data into subsets based on the value of input features. They are easy to interpret and can capture nonlinear relationships. Predicting crop yields by creating a model that makes decisions based on different climatic and soil conditions. It handles complex interactions between variables and provides a clear visualisation of decision paths.

6) Random Forest Regressor: Random Forest used to predict crop yields by considering multiple factors simultaneously and reducing overfitting compared to individual decision trees. This model also highlighted the importance of different features in determining crop productivity.

To assess the Prediction performance of all the models, Mean Absolute Error (MAE), Mean Squared Error (MSE), and R-squared were used as the evaluation metrics to understand each model’s accuracy, precision. RandomForestRegressor had the best accuracy which is 0.97 and it was chosen. The `n_estimators` hyperparameter and `RandomizedSearchCV` were utilised to optimise the performance of the `RandomForestRegressor`. This approach ensures the model strikes a balance between underfitting and overfitting, thereby enhancing its predictive accuracy. Ultimately, `n_estimators` was identified as the optimal parameter through this tuning process.

Feature importance

Results

Recommendations

It is recommended that further study be carried out focusing on how other factors affecting food security in Africa and Asia, such as populations, policies, political instability and economic situation, can be addressed with artificial intelligence and with the leverage of generative AI. Additionally, further machine learning models and generative AI tools can be explored to enhance accuracy of predictions and user experience of the end users.

Conclusion

This project underscores the transformative potential of artificial intelligence (AI) in addressing food security challenges in Africa and Asia. By leveraging AI technologies, such as predictive analytics, precision agriculture, and generative AI, the project demonstrated significant improvements in crop yield predictions, resource optimization, and food production sustainability. The research highlights that AI can revolutionise food security in Africa and Asia by fostering resilient and sustainable agricultural systems. Continued investment in AI technologies, coupled with collaborative efforts among governments, NGOs, and the private sector, is essential to realise the full potential of AI in securing a future where all individuals have access to sufficient, safe, and nutritious food in these regions.

References

Ahmad A., Liew A. X. W., Venturini F., Kalogeras A., Candiani A., Di Benedetto G., Ajibola S., Cartujo P., Romero P., Lykoudi A., De Grandis M. M., Xouris C., Lo Bianco R., Doddy I., Elegbede I., D’Urso Labate G. F., García del Moral L. F. and Martos V. (2024), AI can empower agriculture for global food security: challenges and prospects in developing nations. Front. Artif. Intell. 7:1328530. Link.

Azizi J. (2024). The Prospect of Food Security with Artificial Intelligence. Available at link.

Food and Agriculture Organization of the United Nations. FAOSTAT data. Crops and livestock products. Link.

--

--

HamoyeHQ

Our mission is to develop an army of creative problem solvers using an innovative approach to internships.