How machine learning could help make government spending greener

18 octubre 2021

By Daniel Hopp, UNCTAD, and Ryan Maia and Himanshu Sharma, UNEP


The global community is facing a trio of urgent and interlinked planetary crises: climate change, biodiversity loss and pollution.

Fiscal policies implemented in this crucial decade for action on climate and biodiversity will play a vital role in solving these crises and transitioning to an inclusive green economy – if designed and targeted well.

That’s because fiscal policies and public finance are the most direct and impactful levers for supporting socioeconomic activities and trajectories.

As calls for green recoveries from COVID-19 grow, there is mounting evidence that some of the most rewarding policies with regard 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.

Our ability to better inform and monitor public spending is therefore key to promoting a green, inclusive recovery. Expanding access to such resources will increase the transparency, accountability and effectiveness of public spending and its effects on our future.

However, there are two major, interlinked challenges to green government spending:

  1. Public finance is finite. And during the COVID-19 crisis, government spending priorities have been stretched thin by rescue and recovery stimulus efforts.
  2. Many countries lack data and causal analysis on the environmental impacts of spending policies. This makes it difficult for policymakers and decision-makers to design and advocate for green spending.

In the face of these challenges, we must leverage data and technology to enable effective, efficient and environmentally conscious economic systems.

An exploratory research venture between the UN Environment Programme (UNEP) and UNCTAD's statistics team showcases how machine learning can provide a data-driven approach to designing green government spending plans.

What does machine learning have to do with policymaking?

Properly trained machine learning (ML) models can enable rapid, evidence-based 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 policymakers without data science expertise thanks to the development of simple to use, open-source libraries.

For example, the UNCTAD statistics team recently produced a study nowcasting international trade using an artificial neural network, accompanied by publicly available Python and R libraries.

As shown through our country case studies, if governments integrate ML modeling into their budgeting processes, they can build powerful models capable of accurately forecasting the green impacts of their spending decisions.

This would allow governments to confidently allocate spending in ways that promote specific sustainability outcomes.

Country case studies

For this project, we created models and analyses for six countries – the Democratic Republic of the Congo, Haiti, Madagascar, Liberia, Solomon Islands and Zambia.

For each country, the yearly growth rate of tree cover loss was taken as the target variable. Organisation for Economic Co-operation and Development datasets on Official Development Assistance (ODA) 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 to 2015 and tested on data from 2016 to 2019. All six country case studies and detailed descriptions of the ML techniques we used are available on the Green Fiscal Policy Network Blog.


Madagascar is massively biodiverse – between 80% and 90% of the animal and plant species in the island nation are exclusive to the country. It 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.


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 policymakers’ arsenal to make better informed decisions on how spending decisions could impact the environment.

Daniel Hopp is an associate statistician at UNCTAD, Ryan Maia is a fiscal policy intern at UNEP and Himanshu Sharma is the manager of the Green Fiscal Policy Network at UNEP. Read the full article on the Green Fiscal Policy Network Blog.