Views
No views yet
| Property | Value |
|---|---|
| Base Model | bert-base-uncased |
| Task | Text Classification |
| Framework | PyTorch + Transformers |
| Dataset | AG News |
| Classes | 4 |
| Test Accuracy | 94.7% |
| Macro F1 | 0.94 |
| ID | Label |
|---|---|
| 0 | World |
| 1 | Sports |
| 2 | Business |
| 3 | Sci/Tech |
| Parameter | Value |
|---|---|
| Epochs | 3 |
| Batch Size | 16 |
| Learning Rate | 2e-5 |
| Max Sequence Length | 128 |
| Warmup Steps | 500 |
| Optimizer | AdamW |
| Weight Decay | 0.01 |
| LR Scheduler | Linear Warmup + Linear Decay |
| Gradient Clipping | Max Norm = 1.0 |
| Split | Samples |
|---|---|
| Train | 120,000 |
| Test | 7,600 |
| Class | Precision | Recall | F1-Score |
|---|---|---|---|
| World | 0.97 | 0.95 | 0.96 |
| Sports | 0.98 | 0.99 | 0.99 |
| Business | 0.92 | 0.91 | 0.92 |
| Sci/Tech | 0.91 | 0.93 | 0.92 |
pip install transformers torch1from transformers import pipeline
2
3classifier = pipeline(
4 "text-classification",
5 model="theshekslaw/ag_news_bert_full"
6)
7
8result = classifier(
9 "Apple announces new MacBook Pro with M3 chip"
10)
11
12print(result)[{'label': 'Sci/Tech', 'score': 0.9895}]| Text | Prediction |
|---|---|
| Apple announces new MacBook Pro with M3 chip | Sci/Tech |
| Federal Reserve raises interest rates | Business |
| UN calls for ceasefire in ongoing conflict | World |
| Real Madrid wins Champions League final | Sports |
Trainer API.DataCollatorWithPadding1@misc{ag_news_bert_classifier,
2 title={AG News BERT Classifier},
3 author={Abhishek Pandey},
4 year={2026},
5 publisher={Hugging Face}
6}