Text Classification
Transformers
English
sentiment-analysis
twitter
nigeria
fiscal-policy
roberta
Eval Results (legacy)
Instructions to use Godwithus/nigeria-tax-reform-sentiment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Godwithus/nigeria-tax-reform-sentiment with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Godwithus/nigeria-tax-reform-sentiment")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Godwithus/nigeria-tax-reform-sentiment", device_map="auto") - Notebooks
- Google Colab
- Kaggle
π³π¬ Nigeria 2025 Tax Reform β Sentiment Classifier
A fine-tuned cardiffnlp/twitter-roberta-base-sentiment-latest model for classifying public sentiment toward Nigeria's 2025 Tax Reform Act as expressed on Twitter (X).
This model is the primary artefact of the research paper:
Twitter Sentiment Analysis of Nigeria's 2025 Tax Reform Act: A Transformer-Based Comparative Study of Public Fiscal Policy Discourse
Ezerioha Ifeanyi Emmanuel β 2026
π Model Performance
| Model | Macro-F1 | F1-Negative | F1-Neutral | F1-Positive |
|---|---|---|---|---|
| RoBERTa (this model) | 0.6073 | 0.9436 | 0.2857 | 0.5926 |
| BiLSTM (baseline) | 0.4763 | 0.9078 | 0.1000 | 0.4211 |
| Logistic Regression (baseline) | 0.4376 | 0.9199 | 0.0000 | 0.3929 |
Evaluated on a held-out stratified test set of 330 tweets (Negative: 288, Neutral: 12, Positive: 30).
RoBERTa significantly outperforms BiLSTM (Welch's t-test, p = 0.0000).
ποΈ Dataset
| Property | Detail |
|---|---|
| Source | Nigerian Twitter (X) β manually collected |
| Collection period | July 1 β September 30, 2025 |
| Total tweets (post-cleaning) | 2,197 |
| Labels | Positive / Neutral / Negative |
| Class distribution | Negative: 87.9% Β· Positive: 8.7% Β· Neutral: 3.4% |
| Train / Val / Test split | 70% / 15% / 15% (stratified, seed=42) |
π Quick Start
from transformers import AutoModelForSequenceClassification, AutoTokenizer, AutoConfig
import numpy as np
from scipy.special import softmax
MODEL = "Godwithus/nigeria-tax-reform-sentiment"
tokenizer = AutoTokenizer.from_pretrained(MODEL)
config = AutoConfig.from_pretrained(MODEL)
model = AutoModelForSequenceClassification.from_pretrained(MODEL)
def preprocess(text):
tokens = []
for t in text.split():
t = "@user" if t.startswith("@") and len(t) > 1 else t
t = "http" if t.startswith("http") else t
tokens.append(t)
return " ".join(tokens)
def predict(text):
encoded = tokenizer(preprocess(text), return_tensors="pt",
truncation=True, max_length=128)
output = model(**encoded)
scores = softmax(output[0][0].detach().numpy())
labels = {config.id2label[i]: float(scores[i]) for i in range(len(scores))}
return labels
# Example
print(predict("This development levy will kill businesses in Nigeria!"))
# β {'Negative': 0.94, 'Neutral': 0.03, 'Positive': 0.03}
βοΈ Fine-Tuning Details
| Hyperparameter | Value |
|---|---|
| Base model | cardiffnlp/twitter-roberta-base-sentiment-latest |
| Learning rate | 2e-5 (AdamW, linear warmup 10%) |
| Batch size | 16 |
| Max epochs | 8 (early stopping, patience=3) |
| Max sequence length | 128 tokens |
| Imbalance handling | WeightedTrainer + 1.5Γ Neutral boost |
| Random seed | 42 |
| Hardware | NVIDIA Tesla T4 (Google Colab) |
π·οΈ Label Mapping
| ID | Label | Description |
|---|---|---|
| 0 | Negative | Critical, opposed, or concerned reaction |
| 1 | Neutral | Informational or non-evaluative commentary |
| 2 | Positive | Supportive or optimistic reaction |
β οΈ Limitations
- Trained on Nigerian Twitter discourse from a specific 3-month window (JulβSep 2025). Sentiment patterns may shift as implementation progresses.
- The Neutral class is severely under-represented (3.4% of corpus); Neutral F1 (0.2857) should be interpreted cautiously.
- The model handles English and code-mixed English/Nigerian Pidgin; purely non-English tweets may produce unreliable results.
- Twitter demographic skew (urban, younger, digitally engaged) means findings may not represent broader Nigerian public opinion.
π Citation
If you use this model or dataset, please cite:
@article{ezerioha2026nigeria,
title = {Twitter Sentiment Analysis of Nigeria's 2025 Tax Reform Act:
A Transformer-Based Comparative Study of Public Fiscal Policy Discourse},
author = {Ezerioha, Ifeanyi Emmanuel},
year = {2026},
note = {Fine-tuned model available at HuggingFace}
}
π Links
- π Research Notebook (Google Colab)
- π€ Live Demo (Hugging Face Space)
- π§ Contact: [email protected]
Evaluation results
- Macro-F1 (held-out test set) on Nigeria 2025 Tax Reform Tweetsself-reported0.607
- F1-Negative on Nigeria 2025 Tax Reform Tweetsself-reported0.944
- F1-Positive on Nigeria 2025 Tax Reform Tweetsself-reported0.593
- F1-Neutral on Nigeria 2025 Tax Reform Tweetsself-reported0.286