English and isiXhosa news classification using PyTorch, TF-IDF, and multinomial logistic regression.
# Multilingual English–isiXhosa News Classification
A multilingual natural language processing project for classifying English and isiXhosa news articles using traditional text features and multinomial logistic regression implemented with PyTorch.
The project uses the MasakhaNEWS dataset and investigates how preprocessing, feature extraction, hyperparameters, regularisation, and class imbalance affect classification performance across two languages.
## Project Overview
The pipeline performs the following steps:
- loads and cleans English and isiXhosa news data
- normalises text using language-agnostic preprocessing
- extracts count, binary, and TF-IDF features
- compares unigram and bigram representations
- encodes news categories as numerical labels
- trains a multinomial logistic regression classifier
- applies mini-batch optimisation and early stopping
- tunes learning rates and batch sizes
- investigates L1 and L2 regularisation
- evaluates imbalance-handling approaches for isiXhosa
- produces confusion matrices and class-level metrics
## Languages and Classes
The project evaluates news classification for:
- English
- isiXhosa
News categories include areas such as business, entertainment, health, politics, sports, and technology, depending on the language split.
## Repository Structure
```text
multilingual-news-classification/
├── notebook/
│ └── multilingual-news-classification.ipynb
├── data/
│ └── README.md
├── report/
│ └── project-report.pdf
├── README.md
├── requirements.txt
└── .gitignore