Downloads · 30 days
12
10% of all-time downloads
furkankarakuz/turkish-news-classifier
turkish-news-classifier is a text classification model from furkankarakuz. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
A fine-tuned version of dbmdz/bert-base-turkish-cased for multi-class news category classification of Turkish text.
Downloads · 30 days
12
10% of all-time downloads
All-time downloads
115
Public
Parameters
111M
8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors443 MB · 100%
From the Hugging Face model README
A fine-tuned version of dbmdz/bert-base-turkish-cased
for multi-class news category classification of Turkish text.
The model takes a Turkish news article (or headline) and predicts one of twelve
category labels. It is a standard BertForSequenceClassification head fine-tuned
on top of the cased Turkish BERT (BERTurk) encoder.
dbmdz/bert-base-turkish-casedtr)The label ids follow model.config.id2label:
| id | label |
|---|---|
| 0 | dunya |
| 1 | ekonomi |
| 2 | genel |
| 3 | guncel |
| 4 | kultur-sanat |
| 5 | magazin |
| 6 | saglik |
| 7 | siyaset |
| 8 | spor |
| 9 | teknoloji |
| 10 | turkiye |
| 11 | yasam |
Intended use: classifying the primary topic of Turkish news articles or headlines (e.g. for tagging, routing, or filtering a news feed).
The model expects raw text — no special preprocessing is required. Just pass the headline and/or article body directly; the tokenizer (shipped with the model) handles everything.
Limitations / out of scope:
genel/guncel/turkiye
cover similar "general domestic news" ground) — this is a property of the labeling
scheme, not something the model can resolve on its own.from transformers import pipeline
pipe = pipeline("text-classification", model="furkankarakuz/turkish-news-classifier")
print(pipe("Galatasaray, derbi maçında rakibini 3-1 mağlup etti."))
# [{'label': 'spor', 'score': 0.97}]
Or load the model and tokenizer directly:
from transformers import AutoModelForSequenceClassification, AutoTokenizer
model = AutoModelForSequenceClassification.from_pretrained("furkankarakuz/turkish-news-classifier")
tokenizer = AutoTokenizer.from_pretrained("furkankarakuz/turkish-news-classifier")
Trained on the 42000 Turkish News Texts in 13 Classes
corpus (YTÜ KEMİK NLP Group), approximately 40,000 raw Turkish news articles.
The original corpus's planet category was dropped before training — its content
overlapped with dunya (both cover world/international news) — leaving the 12
categories listed above. The data was split with stratification so the class
balance is preserved across splits:
Labels were integer-encoded with LabelEncoder, fit on the training split only.
No lossy text cleaning was applied beyond whitespace normalization; the model is
trained on raw article text. Classes are imbalanced (spor is the largest
category, kultur-sanat/saglik among the smallest), so training used a
class-weighted loss (see below).
Fine-tuned with the 🤗 Transformers Trainer, using a class-weighted
cross-entropy loss to handle class imbalance. Training ran for 8 epochs (early
stopping, patience 2) before stopping; the metrics below correspond to that final
checkpoint.
| Hyperparameter | Value |
|---|---|
| Base model | dbmdz/bert-base-turkish-cased |
| Max sequence length | 256 (dynamic padding) |
| Train batch size | 32 |
| Eval batch size | 64 |
| Learning rate | 2e-5 |
| LR scheduler | linear, warmup ratio 0.1 |
| Optimizer | AdamW (torch fused), betas=(0.9, 0.999), eps=1e-8 |
| Epochs | 10 (early stopping, patience 2) |
| Loss | class-weighted cross-entropy |
| Best-model metric | f1_macro (validation) |
| Mixed precision | native AMP |
| Seed | 42 |
Training stopped after epoch 8 (early stopping, patience 2). Note validation macro-F1 peaked slightly earlier, at epoch 6 (0.7056) — epoch 8 is shown as final since that's the checkpoint that was evaluated and pushed.
| Epoch | Training Loss | Validation Loss | Accuracy | F1 (macro) | Precision (macro) | Recall (macro) |
|---|---|---|---|---|---|---|
| 1 | 0.9734 | 0.9423 | 0.6390 | 0.5638 | 0.5559 | 0.6768 |
| 2 | 0.7492 | 0.7610 | 0.6895 | 0.6395 | 0.6284 | 0.7519 |
| 3 | 0.5725 | 0.7801 | 0.7253 | 0.6770 | 0.6479 | 0.7458 |
| 4 | 0.4216 | 0.8668 | 0.7378 | 0.6917 | 0.6718 | 0.7360 |
| 5 | 0.3235 | 0.9657 | 0.7461 | 0.7047 | 0.6867 | 0.7361 |
| 6 | 0.2118 | 1.1156 | 0.7433 | 0.7056 | 0.6940 | 0.7204 |
| 7 | 0.1654 | 1.2525 | 0.7434 | 0.6992 | 0.6963 | 0.7143 |
| 8 | 0.1482 | 1.3213 | 0.7453 | 0.7042 | 0.6990 | 0.7161 |
The model reflects the distribution and any biases of its training data (Turkish
news from ~2010–2013) and may underperform on current events, entities, or
writing styles not well represented in it. Macro-F1 (~0.70) is noticeably lower
than typical short-text classification tasks (e.g. emotion classification on this
same base model reaches ~0.97), reflecting genuine ambiguity and overlap between
some of the 12 news categories (e.g. genel vs. guncel vs. turkiye) rather
than a modeling shortfall alone. Predictions should be treated as a "most likely
category" signal rather than a ground-truth label, especially near these
overlapping category boundaries.