Using Machine Learning to Make Government Spending Greener

The global community is facing a trio of urgent and interlinked planetary crises: climate change, biodiversity loss, and pollution. Fiscal policies that countries implement in this crucial super decade for action on climate and biodiversity will play a vital role in the transition towards solving these crises and the creation of an Inclusive Green Economy, if designed and targeted well.

Fiscal policies and public finance are the most direct and impactful levers for supporting socio-economic activities and trajectories today and for the medium- and long-term. As calls for green recoveries from COVID-19 grow, there is mounting evidence that some of the most rewarding policies with regards to impact on key social and economic indicators are the very same policies that will lead us towards deep decarbonization and improvements in pollution and nature loss.

We need to leverage data and technology to transform our financial and economic decision making.

The Challenge: Public Finance Limits

Public finance is finite. During the COVID crisis especially, government spending priorities have been stretched thin by rescue and recovery stimulus efforts. Our project seeks to show how ML models can help policy makers and researchers design data-driven policies that allocate precious government resources at home and abroad.

For policy- and decision-makers in many countries, one of the key impediments to designing well-targeted green transition policies is a lack of data and intelligence on the causal chains from a policy to its impact on the socio-economy and the environment. It is difficult to manage if you can’t measure.

Our ability to better inform and monitor the investments made by countries is key to a green, inclusive recovery on track. Expanding access to such resources will help to increase the transparency, accountability, and effectiveness of public spending and its impact on our sustainable future.

The Solution: Machine Learning to Forecast Green Spending Impacts

Properly trained machine learning (ML) models can enable rapid, quantitative predictions of policy impacts. Combining advanced statistics, good quality data, and processing power allows ML models to find patterns that connect inputs and outputs. Such models are ideally suited for cases when there is no clear definition and direct discernable connection between inputs and outputs.

Despite its potential, the impact of ML in the field of economic policy has been largely exploratory in nature thus far. However, ML modelling is within the grasp of researchers and policy makers without data science expertise thanks to the development of simple to use, open-source libraries. For example, UNCTAD recently produced a study nowcasting international trade using an artificial neural network, accompanied by publicly available Python and R libraries.

Machine Learning is better at identifying causal mechanisms with more data. If governments integrate ML modeling into their budgeting and statistical processes, they can build powerful models capable of accurately forecasting the impact of their spending decisions. Accurate impact forecasting will allow governments to confidently allocate spending in ways that promote specific sustainability outcomes.

This exploratory research venture between UNEP and UNCTAD showcases how machine learning has the potential to transform the measurement of policy impacts on SDGs, NDCs and NBSAPs and enable targeted and efficient decision making for underpinning green and inclusive transitions.

Country Case Studies

For this project, we created models and analyses for six countries in total:

  1. Liberia
  2. Madagascar
  3. Zambia
  4. Haiti
  5. Democratic Republic of the Congo
  6. Solomon Islands

For each country, the yearly growth rate of tree cover loss was taken as the target variable. OECD datasets on Official Development Assistance by sector and Aid activities targeting Global Environmental Objectives were used as explanatory variables. Five different ML techniques were used to train models on data from 2005-2015 and tested on data from 2016-2019.

Highlights of country-level contextualization and selected modelling results for Liberia and Madagascar are presented below. All six country case studies and detailed descriptions of the ML techniques we used will soon be available on the Green Fiscal Policy Network Blog.



Natural forest covered over 9 million hectares, or 97%, of Liberia in 2010. Liberia’s economy is largely dependent on extractive industries, and natural resources are thus central to its current economic growth. However, sustainable use of such resources is key to the country’s long-term prosperity.

Figure 1: Liberia: Percent of Year 2000 Tree Cover Lost, 2001 – 2020

Percent of Year 2000 Tree Cover Lost, 2001 – 2020

Official Development Assistance (ODA)

Figure 2: Liberia: Net ODA Received as a % of GNI, 2001 – 2019

Net ODA Received as a % of GNI, 2001 – 2019

Hypothetically, a higher Official Development Assistance (ODA) to Gross National Income (GNI) ratio suggests that ODA will have a stronger influence on economic activity and its externalities – such as deforestation. The ODA to GNI ratio in Liberia illustrates that ODA has comprised a substantial portion of the country’s public finance allocations. Since 2003, Liberia has dramatically exceeded the average ODA to GNI ratio among low-income countries.

Using Machine Learning to Predict Deforestation

Figure 3: Liberia: Predicting Deforestation with ODA, 2008 – 2019

Predicting Deforestation with ODA, 2008 – 2019

The LSTM model performed exceptionally well in Liberia when taking sector-disaggregated ODA as an input. Error in the model’s predictions on the test data subset is very low, allowing the model to predict an increase in tree cover loss rates in 2017 as well as a subsequent decline in following years.

There is a strong potential for this model to be considered in ODA decision making for Liberia. Officials in Liberia could use this model as scientific grounds to advocate for aid packages that prioritize certain sectors. Donor countries interested in the preservation of Liberia’s vital natural capital could take this model into account when assessing which sectors to support via ODA.



Madagascar is massively biodiverse - between 80 and 90% of the animal and plant species in Madagascar are exclusive to the country. The country is also a crucial carbon sink, with over 16 million hectares of tree cover. But by 2070, the combined effects of deforestation and anthropogenic climate change could eliminate the entirety of Madagascar’s eastern rainforest.

Figure 4: Madagascar: Percent of Year 2000 Tree Cover Lost, 2001 – 2020

Percent of Year 2000 Tree Cover Lost, 2001 – 2020

Official Development Assistance (ODA)

Figure 5: Madagascar: Net ODA Received as a % of GNI, 2001 – 2019

Net ODA Received as a % of GNI, 2001 – 2019

Madagascar’s ODA to GNI ratio spiked at 25% in 2004 and has hovered around 5% since 2009. While this is below the average among low-income countries, it is still substantial.

Using Machine Learning to Predict Deforestation

Figure 6: Madagascar: Predicting Deforestation with ODA, 2006 – 2019

Predicting Deforestation with ODA, 2006 – 2019

The gradient boosted decision trees model trained on Principal Rio Marker disaggregated ODA was able to predict forest cover loss rates fairly accurately in Madagascar between 2016 and 2019.

Given the urgency of protecting Madagascar’s priceless biodiversity, carbon stocks, and natural capital, this model could play a critical role in determining both how much environmental ODA countries should provide to Madagascar and how such ODA should be prioritized.

Conclusion and Next Steps

Exploratory models with only 10 years of annual training data were able to produce, in the case of some countries, surprisingly accurate predictions of yearly deforestation growth. In others, despite higher errors in actual predictions, trends in deforestation growth rates were still able to be captured. Crucially, models such as these could be used to better inform policymakers and budget planners.

While the predictions of a machine learning model should never be taken as fact, they could prove immensely useful in running scenario analyses, where different provisionary budgets could be run through a model trained on historical budgets to gain insights on the directionality and magnitude of effects on various environmental indicators. Machine learning could become yet another tool in policy-makers’ arsenal to make better informed decisions on how spending decisions could impact the environment.

About the Authors

Ryan Maia
Fiscal Policy Intern
Economics and Trade Policy Unit, UN Environment Program

Daniel Hopp
Associate Statistician
Division on Globalization and Development Strategies, UNCTAD

Himanshu Sharma
Manager, Green Fiscal Policy Network
Economics and Trade Policy Unit, UN Environment Program