Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- text-classification
|
| 4 |
+
- spam-detection
|
| 5 |
+
- transformers
|
| 6 |
+
- bert
|
| 7 |
+
datasets:
|
| 8 |
+
- codesignal/sms-spam-collection
|
| 9 |
+
- url
|
| 10 |
+
metrics:
|
| 11 |
+
- accuracy
|
| 12 |
+
- f1
|
| 13 |
+
- precision
|
| 14 |
+
- recall
|
| 15 |
+
base_model:
|
| 16 |
+
- google-bert/bert-base-cased
|
| 17 |
+
pipeline_tag: text-classification
|
| 18 |
+
library_name: transformers
|
| 19 |
+
---
|
| 20 |
+
# π Spam Classifier (BERT Fine-Tuned)
|
| 21 |
+
|
| 22 |
+
## Introduction
|
| 23 |
+
This is my first fine-tuned model on Hugging Face π.
|
| 24 |
+
It is a spam vs ham (not spam) classifier built using a BERT model fine-tuned on SMS spam data.
|
| 25 |
+
The goal is to help detect unwanted spam messages while keeping normal communications intact.
|
| 26 |
+
I created and uploaded this model as part of my learning journey into NLP and Transformers.
|
| 27 |
+
The model was trained on a spam/ham dataset with high accuracy and strong F1 performance.
|
| 28 |
+
It can be used for SMS filtering, email pre-screening, or any application requiring spam detection.
|
| 29 |
+
## π Model Details
|
| 30 |
+
- **Architecture**: BERT base (bert-base-cased)
|
| 31 |
+
- **Task**: Binary Text Classification
|
| 32 |
+
- **Labels**: `0 = ham`, `1 = spam`
|
| 33 |
+
- **Dataset**: Custom spam/ham dataset (e.g., SMS Spam Collection)
|
| 34 |
+
- **Fine-tuned epochs**: 3
|
| 35 |
+
- **Framework**: Hugging Face Transformers
|
| 36 |
+
## π§ͺ Evaluation Results
|
| 37 |
+
| Metric | Score |
|
| 38 |
+
|-------------|--------|
|
| 39 |
+
| Accuracy | 99.3% |
|
| 40 |
+
| F1 Score | 97.5% |
|
| 41 |
+
| Precision | 100% |
|
| 42 |
+
| Recall | 95.1% |
|
| 43 |
+
## π How to Use
|
| 44 |
+
```python
|
| 45 |
+
from transformers import pipeline
|
| 46 |
+
|
| 47 |
+
classifier = pipeline("text-classification", model="Sathya77/spam-ham-classifier")
|
| 48 |
+
|
| 49 |
+
classifier("Congratulations! You won a free gift card!")
|
| 50 |
+
# β [{'label': 'spam', 'score': 0.99}]
|
| 51 |
+
```
|
| 52 |
+
## π Limitations and Future Work
|
| 53 |
+
- May not generalize perfectly to domains outside SMS/email.
|
| 54 |
+
- Some borderline spam messages may still be misclassified.
|
| 55 |
+
- Future improvements: larger training data, multilingual support.
|
| 56 |
+
## Thank You For Supporting me....
|