Sentiment analysis on bank customer reviews translated into Malagasy, comparing classical ML (TF‑IDF + Logistic Regression) with transformer models (mBERT, DistilBERT) on a balanced dataset. Highlights challenges of low‑resource languages and insights into cross‑lingual transfer learning.
# malagasy-sentiment-analysis
Sentiment analysis on bank customer reviews translated into Malagasy, comparing classical ML (TF‑IDF + Logistic Regression) with transformer models (mBERT, DistilBERT) on a balanced dataset. Highlights challenges of low‑resource languages and insights into cross‑lingual transfer learning.
# Sentiment Analysis on Bank Reviews (Malagasy Language)
## Overview
This project investigates sentiment analysis for bank customer reviews translated into Malagasy, a low-resource language. It compares classical machine learning methods with transformer-based models to evaluate performance on both translated and native datasets.
## Objectives
- Build a balanced dataset of 1,000 Malagasy sentences (500 positive, 500 negative).
- Preprocess text to handle noise, emojis, and special characters.
- Train and evaluate models:
- TF-IDF + Logistic Regression (baseline)
- bert-base-multilingual-cased (mBERT)
- distilbert-base-multilingual-cased (DistilmBERT)
- Test generalization on an external set of 200 native Malagasy sentences.
## Methodology
- Preprocessing: lowercasing, URL/HTML removal, emoji conversion, normalization.
- Train-validation split: 80:20, stratified by label.
- External test set: HuggingFace `malagasy-sentiments-corpus`.
- Models trained with AdamW optimizer and weighted loss functions.
## Results
| Model | Accuracy | Precision | Recall | F1-Score |
|-------------------------------|----------|-----------|--------|----------|
| TF-IDF + Logistic Regression | 0.5764 | 0.6548 | 0.5609 | 0.6042 |
| mBERT | 0.5514 | 0.5901 | 0.7261 | 0.6511 |
| DistilmBERT | 0.4612 | 0.6056 | 0.1870 | 0.2857 |
- Baseline performed well on validation but dropped on external test.
- mBERT achieved higher recall, favoring positive sentiment detection.
- DistilmBERT underperformed, biased toward negatives.
## Challenges
- Morphological complexity of Malagasy.
- Limited availabi …