Fine-tuned mBERT for Luganda news classification across 5 categories (Politics, Business, Sports, Health, Religion) — advancing NLP for low-resource African languages.
# GandaBERT: Luganda News Classification using Fine-tuned mBERT
A final-year project that fine-tunes **multilingual BERT (mBERT)** for **Luganda news topic classification** across five categories: business, health, politics, religion, and sports.
## Overview
This project builds a Luganda-language news classifier by:
1. **Combining multiple data sources** — MasakhaNEWS Luganda corpus, BBC News articles translated to Luganda via Google Cloud Translation API, and GPT-4o-generated synthetic articles translated to Luganda.
2. **Fine-tuning mBERT** (`bert-base-multilingual-cased`) on the combined dataset using Hugging Face Transformers.
3. **Evaluating** the model on a stratified held-out test set with per-category precision, recall, and F1-score.
4. **Running inference** on unlabeled Luganda news articles to classify them.
## Project Structure
```
FYP_2026/
├── gandabert_complete.ipynb # Complete pipeline notebook (Colab)
├── news_classifier_model/ # Saved model artifacts
│ ├── config.json # Model architecture config
│ ├── label_mapping.json # Label-to-ID mapping
│ ├── tokenizer.json # Tokenizer vocabulary
│ └── tokenizer_config.json # Tokenizer settings
├── combined_final.tsv # Combined training dataset
├── split_train.tsv # Training split
├── split_val.tsv # Validation split
├── split_test.tsv # Test split
├── new_train_split.tsv # MasakhaNEWS train split
├── new_test_split.tsv # MasakhaNEWS test split
├── new_train_luganda.tsv # MasakhaNEWS Luganda training data
├── train_Luganda.tsv # Original Luganda training set
├── test_Luganda.tsv # Original Luganda test set
├── generated_news_articles.csv # GPT-4o generated articles (English)
├── translated_generated.csv # Translated synthetic articles (Luganda)
├── training_curves.png # Training/validation …