This repository contains the underlying code for the paper "Consistent and Replicable Estimation of Bilateral Climate Finance" by Toetzke, M.; A. Stünzi; and F. Egli.
Jupyter Notebook
14
18 commits
updated Oct 24, 2022
Estimating the relevance of development assistance projects for climate finance based on textual project descriptions via ClimateFinanceBERT. The repository represents the underlying code for the scientific paper "Consistent and replicable estimation of bilateral climate finance" by Malte Toetzke, Anna Stünzi, Florian Egli.
How to work with this repository
Python Interpreter: Python3.8
Install required packages:
pip install -r requirements.txt
Data used for analyses presented in the paper can be found in the Data directory. Climate finance categorizations represent outputs from classifying project descriptions with ClimateFinanceBERT (see Methods in the paper). The raw data from the OECD including the project descriptions can be retrieved from here. Note that all non-English texts must be translated to English (e.g., via GoogleTranslate).
train_set.csv: Annotated training dataset used to train the relevance classifier and the multilabel classifier. Details about the labels are provided in the Methods of the paper.
timeline.csv: Aggregated USD disbursements (in million USD) for all projects and contributors/recipients grouped by year.
descriptives_all_years: Descriptives stats by climate finance category summed up from 2000-2019.
descriptives_2016: Descriptives stats by climate finance category summed up from 2016-2019 (see Supplementary Table SI. 2 in the paper).
All data used for analysing climate finance provided by contributing countries (all disbursements are provided in million USD).
All data used for analysing climate finance received by contributing countries (all disbursements are provided in million USD).
All data used for comparing classifications from ClimateFinanceBERT with the Rio Marker annotations.
Outcomes from comparison between annotations by Weikmans et al., Rio Markers, and ClimateFinanceBERT.
Results from the user study comparing annotations by Rio Markers and ClimateFinanceBERT to evaluations of human respondents.
Scipts used to train the relevance classifier and the multilabel classifier of ClimateFinanceBERT. Trained weights are stored in the directory Code/saved_weights/.
python Code/Relevance/Relevance_classifier.py
python Code/Multiclass/multi-classifier.py
Use the saved weigths from model training to classify new project descriptions regarding climate finance relevance and corresponding climate finance category.
python Code/predict_texts/classify_projects.py
# creates output dataframe climate_finance_total.csv
Create the datasets (in the Data folder) to analyse climate finance flows based on classifications by ClimateFinanceBERT (form Model prediction).
Postprocess the long dataframe (on project level) for subsequent data analyses by grouping data by contributor, recipient, climate finanance categories, years, etc.
Creating the meta-categories (Adaptation, Mitigation, Environment) from the output from the model prediction (classify_projects.py).
python Code/Analysis_data/Postprocess_after_classification/Postprocess_full_data.py
# overwrites output dataframe climate_finance_total.csv
Grouping the data from long output dataframe (dataframe climate_finance_total.csv) based on targeted analysis.
python Code/Analysis_data/Postprocess_after_classification/postprocess_descriptives.py # creates general descriptives dataframes in the data folder (Data/)
python Code/Analysis_data/Postprocess_after_classification/postprocess_recicipients.py # creates data for analysing recipients in thefolder Data/Recipients/
python Code/Analysis_data/Postprocess_after_classification/postprocess_donors.py # creates data for analysing contributors in thefolder Data/Donors/
Scripts to plot main figures (Fig. 1 & Fig.2 in the paper) as Jupyter markdown files.
Scripts for comparisons between ClimateFinanceBERT data and the Rio Marker annotations (from Supplementary Discussion 2 in the paper).
To create Supplementary Table SI. 3 & 4:
python Code/Rio_markers/analyze_shares_rio.py
# creates output dataframes used for Supplemantary Table SI. 3 & 4 (/Data/Analysis/Rio_markers/Precision_aggregated.csv & /Data/Analysis/Rio_markers/Recall_aggregated.csv)
Comparison between annotations for adaptation projects by Weikmans et al and ClimateFinanceBERT (see Methods in the paper).
To classify project descriptions from Weikmans et al via ClimateFinanceBERT:
python Code/Validation/Adaptation_Weikmans.py
# creates output dataframe Data/Validation/Weikmans_validated.csv
User study to compare classifications by ClimateFinanceBERT and annotations by the Rio Markers with results from a user study with human respondents.
To create Extended Data Fig. 8:
python Code/User_Study/plot_user_study_results.py
This repository contains the underlying code for the paper "Consistent and Replicable Estimation of Bilateral Climate Finance" by Toetzke, M.; A. Stünzi; and F. Egli.
Jupyter Notebook
14
18 commits
updated Oct 24, 2022
Estimating the relevance of development assistance projects for climate finance based on textual project descriptions via ClimateFinanceBERT. The repository represents the underlying code for the scientific paper "Consistent and replicable estimation of bilateral climate finance" by Malte Toetzke, Anna Stünzi, Florian Egli.
How to work with this repository
Python Interpreter: Python3.8
Install required packages:
pip install -r requirements.txt
Data used for analyses presented in the paper can be found in the Data directory. Climate finance categorizations represent outputs from classifying project descriptions with ClimateFinanceBERT (see Methods in the paper). The raw data from the OECD including the project descriptions can be retrieved from here. Note that all non-English texts must be translated to English (e.g., via GoogleTranslate).
train_set.csv: Annotated training dataset used to train the relevance classifier and the multilabel classifier. Details about the labels are provided in the Methods of the paper.
timeline.csv: Aggregated USD disbursements (in million USD) for all projects and contributors/recipients grouped by year.
descriptives_all_years: Descriptives stats by climate finance category summed up from 2000-2019.
descriptives_2016: Descriptives stats by climate finance category summed up from 2016-2019 (see Supplementary Table SI. 2 in the paper).
All data used for analysing climate finance provided by contributing countries (all disbursements are provided in million USD).
All data used for analysing climate finance received by contributing countries (all disbursements are provided in million USD).
All data used for comparing classifications from ClimateFinanceBERT with the Rio Marker annotations.
Outcomes from comparison between annotations by Weikmans et al., Rio Markers, and ClimateFinanceBERT.
Results from the user study comparing annotations by Rio Markers and ClimateFinanceBERT to evaluations of human respondents.
Scipts used to train the relevance classifier and the multilabel classifier of ClimateFinanceBERT. Trained weights are stored in the directory Code/saved_weights/.
python Code/Relevance/Relevance_classifier.py
python Code/Multiclass/multi-classifier.py
Use the saved weigths from model training to classify new project descriptions regarding climate finance relevance and corresponding climate finance category.
python Code/predict_texts/classify_projects.py
# creates output dataframe climate_finance_total.csv
Create the datasets (in the Data folder) to analyse climate finance flows based on classifications by ClimateFinanceBERT (form Model prediction).
Postprocess the long dataframe (on project level) for subsequent data analyses by grouping data by contributor, recipient, climate finanance categories, years, etc.
Creating the meta-categories (Adaptation, Mitigation, Environment) from the output from the model prediction (classify_projects.py).
python Code/Analysis_data/Postprocess_after_classification/Postprocess_full_data.py
# overwrites output dataframe climate_finance_total.csv
Grouping the data from long output dataframe (dataframe climate_finance_total.csv) based on targeted analysis.
python Code/Analysis_data/Postprocess_after_classification/postprocess_descriptives.py # creates general descriptives dataframes in the data folder (Data/)
python Code/Analysis_data/Postprocess_after_classification/postprocess_recicipients.py # creates data for analysing recipients in thefolder Data/Recipients/
python Code/Analysis_data/Postprocess_after_classification/postprocess_donors.py # creates data for analysing contributors in thefolder Data/Donors/
Scripts to plot main figures (Fig. 1 & Fig.2 in the paper) as Jupyter markdown files.
Scripts for comparisons between ClimateFinanceBERT data and the Rio Marker annotations (from Supplementary Discussion 2 in the paper).
To create Supplementary Table SI. 3 & 4:
python Code/Rio_markers/analyze_shares_rio.py
# creates output dataframes used for Supplemantary Table SI. 3 & 4 (/Data/Analysis/Rio_markers/Precision_aggregated.csv & /Data/Analysis/Rio_markers/Recall_aggregated.csv)
Comparison between annotations for adaptation projects by Weikmans et al and ClimateFinanceBERT (see Methods in the paper).
To classify project descriptions from Weikmans et al via ClimateFinanceBERT:
python Code/Validation/Adaptation_Weikmans.py
# creates output dataframe Data/Validation/Weikmans_validated.csv
User study to compare classifications by ClimateFinanceBERT and annotations by the Rio Markers with results from a user study with human respondents.
To create Extended Data Fig. 8:
python Code/User_Study/plot_user_study_results.py