BSc Computer Science — COMP5122M Data Science – Coursework Parts I & II University of Leeds, School of Computing, 2025/26
This repository contains the complete data analysis pipeline for the UNDP Peoples’ Climate Vote 2024 dataset. The work is divided into two coursework components:
- Part I (Exploratory Data Analysis) – Investigates age‑group differences in support for renewable energy transition using descriptive statistics, heatmaps, and grouped bar charts.
- Part II (Predictive Modelling & Clustering) – Builds supervised models (logistic regression, random forest) to predict support for strengthening climate commitments, and applies unsupervised clustering (k‑means, PCA) to create a country typology.
The UNDP Peoples’ Climate Vote 2024 is the largest public opinion survey on climate change, covering 73 countries and more than half of the global population. The dataset is aggregated by country, age group, and education level, capturing attitudes toward:
- urgency of replacing fossil fuels with renewable energy,
- trust in governments, businesses, and international organisations,
- personal experience of extreme weather events,
- support for strengthening national climate commitments.
This project answers two central research questions:
- Is there a consistent age gap across countries in the desire to transition away from fossil fuels? (Part I)
- Which demographics and attitudes best predict support for stronger climate commitments, and how can countries be grouped into meaningful typologies? (Part II)
All analyses are reproducible and follow best practices for code quality, version control, and dependency management.
project-root/
├── data/ # Raw CSV
├── docs/ # Final PDF reports (Part I and Part II)
│ ├── Report_PartI.pdf
│ └── Report_PartII.pdf
├── notebooks/ # Jupyter Notebooks with full analysis
│ ├── PartI.ipynb # Data cleaning, EDA, visualisations
│ └── PartII.ipynb # Preprocessing, modelling, clustering
├── .pre-commit-config.yaml # Pre‑commit hooks (formatting, linting)
├── pyproject.toml # Project metadata and uv dependencies
└── README.md # This file
Note: You can download the raw dataset from the official data centre.
# Install pyenv if not already installed
curl https://pyenv.run | bash
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
source ~/.bashrc
# Install Python version 3.12 and set locally
pyenv install 3.12.12
pyenv local 3.12.12
# Sync all dependencies from the pyproject.toml file without cache
uv sync --all-groups -n
# Install pre‑commit hooks
uv run pre-commit install
uv run pre-commit autoupdate
# (Optional) Upgrade the lock file
uv lock --upgrade
uv lock --check
# Activate the virtual environment
source .venv/bin/activate
# Install the kernel for the uv environment
python -m ipykernel install --user --name=comp5122m --display-name="Python (uv-env)"
# Verify kernels
jupyter kernelspec list
jupyter lab # or jupyter notebook --autoreload
Recommended JupyterLab shortcuts (add via Settings → Advanced Settings Editor → Keyboard Shortcuts):
Shift C, Shift C→ clear all cell outputsShift J, Shift J→ clear current cell output
See JSON
"shortcuts": [
{
"command": "notebook:clear-all-cell-outputs",
"keys": [
"Shift C",
"Shift C"
],
"selector": ".jp-Notebook:focus"
},
{
"command": "notebook:clear-cell-output",
"keys": [
"Shift J",
"Shift J"
],
"selector": ".jp-Notebook:focus"
},
]
- Download the dataset from peoplesclimate.vote/data-center and place the CSV file(s) inside the
data/folder. - Open
notebooks/PartI.ipynband run all cells – this performs data cleaning, exploratory analysis, and generates figures for the age‑gap investigation. - Open
notebooks/PartII.ipynband run all cells – this builds predictive models, evaluates them (accuracy, F1, balanced accuracy), and applies clustering to identify country typologies. - Generated reports are saved as PDF in the
docs/folder (these are the final submissions).
All dependencies are managed via uv and pinned in pyproject.toml. The main libraries used:
pandas,numpy– data manipulationmatplotlib,seaborn,plotly– visualisationscikit‑learn– preprocessing, models (logistic regression, random forest, clustering), metricsimbalanced-learn– handling class imbalance (SMOTE)jupyter– interactive notebooks
See pyproject.toml for the complete list.
This work was completed as part of the COMP5122M Data Science module at the University of Leeds. GenAI tools are strictly prohibited for both coursework components (RED status per the assessment briefs). All code, analyses, and written interpretations are original and produced by the named group members.
Distributed under the Mozilla Public License Version 2.0.