CoolFace
Modelpublic

AfroLogicInsect/topic-model-analysis-model

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes9downloads
Model Card

Model Card for Topic Classification Model

A fine-tuned DistilBERT model for multi-class topic classification. This model predicts the most relevant topic label from a predefined set based on input text. It was trained using ๐Ÿค— Transformers and PyTorch on a custom dataset derived from academic and news-style corpora.

Model Details

Model Description

This model was developed by Daniel (@AfroLogicInsect) to classify text into one of several predefined topics. It builds on the distilbert-base-uncased architecture and was fine-tuned for multi-class classification using a softmax output layer.

  • โ€”Developed by: Daniel ๐Ÿ‡ณ๐Ÿ‡ฌ (@AfroLogicInsect)
  • โ€”Model type: DistilBERT-based multi-class sequence classifier
  • โ€”Language(s): English
  • โ€”License: MIT
  • โ€”Finetuned from: distilbert-base-uncased

Model Sources

Uses

Direct Use

  • โ€”Classify academic or news-style text into topics such as AI, finance, sports, climate, etc.
  • โ€”Embed in dashboards or content moderation tools for automatic tagging

Downstream Use

  • โ€”Can be extended to hierarchical topic classification
  • โ€”Useful for building recommendation engines or content filters

Out-of-Scope Use

  • โ€”Not suitable for sentiment or emotion classification
  • โ€”May not generalize well to informal or slang-heavy text

Bias, Risks, and Limitations

  • โ€”Trained on curated corpora โ€” may reflect biases in source material
  • โ€”Topics are predefined and static โ€” emerging topics may be misclassified
  • โ€”Confidence scores are probabilistic, not definitive

Recommendations

  • โ€”Use top_k=5 with return_all_scores=True to retrieve multiple topic predictions
  • โ€”Consider fine-tuning on domain-specific data for improved accuracy

How to Get Started

python
from transformers import pipeline

classifier = pipeline(
    "text-classification",
    model="AfroLogicInsect/topic-model-analysis-model",
    tokenizer="AfroLogicInsect/topic-model-analysis-model",
    return_all_scores=True
)

text = "New AI breakthrough in natural language processing"
results = classifier(text)
top_5 = sorted(results[0], key=lambda x: x['score'], reverse=True)[:5]
for i, res in enumerate(top_5):
    print(f"Top {i+1}: {res['label']} ({res['score']:.3f})")

Training Details

Dataset

  • โ€”Custom multi-class topic dataset based on arXiv abstracts and news articles
  • โ€”Labels include domains like AI, finance, sports, climate, etc.

Hyperparameters

  • โ€”Epochs: 3
  • โ€”Batch size: 16
  • โ€”Learning rate: 2e-5
  • โ€”Evaluation every 200 steps
  • โ€”Metric: F1 score

Trainer Setup

Used Hugging Face Trainer API with TrainingArguments configured for early stopping and best model selection.

Evaluation

Model achieved strong performance across multiple topic categories. Evaluation metrics include:

  • โ€”Accuracy: ~90.8%
  • โ€”F1 Score: ~0.91
  • โ€”Precision: ~0.89
  • โ€”Recall: ~0.93

Environmental Impact

  • โ€”Hardware: Google Colab (NVIDIA T4 GPU)
  • โ€”Training Time: ~2.5 hours
  • โ€”Carbon Emitted: ~0.3 kg COโ‚‚eq (estimated via ML Impact Calculator)

Citation

bibtex
@misc{afrologicinsect2025topicmodel,
  title = {AfroLogicInsect Topic Classification Model},
  author = {Akan Daniel},
  year = {2025},
  howpublished = {\url{https://huggingface.co/AfroLogicInsect/topic-model-analysis-model}},
}

Contact

  • โ€”Name: Daniel (@AfroLogicInsect)
  • โ€”Location: Lagos, Nigeria
  • โ€”Contact: GitHub / Hugging Face / email (danielamahtoday@gmail.com)