detre's picture
Update README.md
82a5d18 verified
|
Raw
History Blame Contribute Delete
2.94 kB
---
license: apache-2.0
language:
- en
pipeline_tag: text-classification
model-index:
- name: DistilBERT Political Bias Detector
results:
- task:
type: text-classification
name: Text Classification
dataset:
type: custom
name: Political Bias Dataset
metrics:
- name: Accuracy
type: accuracy
value: 0.85
verified: false
- name: AUC (Left)
type: roc_auc
value: 0.95
verified: false
- name: AUC (Center)
type: roc_auc
value: 0.96
verified: false
- name: AUC (Right)
type: roc_auc
value: 0.97
verified: false
---
# DistilBERT Political Bias Detector
This is a fine-tuned **DistilBERT** model designed to classify English text (such as news articles, opinion pieces, or social media posts) into three categories of political leaning: **Left**, **Center**, or **Right**.
The model was trained with class weights and label smoothing to ensure highly calibrated, reliable probability scores across all three political spectrums.
## How to Use
You can easily use this model in your own applications using the Hugging Face `pipeline` for text classification.
### Installation
First, ensure you have the `transformers` library installed:
```bash
pip install transformers torch
```
```
from transformers import pipeline
# Initialize the bias classifier
# Note: Replace 'your_username/your_model_name' with your actual repository path
bias_classifier = pipeline(
"text-classification",
model="your_username/your_model_name",
return_all_scores=True
)
# Test it with a sample sentence
text = "The new tax policy heavily favors corporate interests while ignoring the working class."
predictions = bias_classifier(text)
print(predictions)
```
**This model is highly suitable for:**
Media Analysis: Automatically auditing news sources or aggregators to analyze the spread of left/right-leaning content.
Content Moderation/Tagging: Tagging articles or forum posts in political discussion boards for balanced reading feeds.
Academic Research: Tracking political polarization trends over time in digital media.
Browser Extensions: Building tools that notify readers of potential bias in the article they are currently reading.
**Limitations & Bias:**
Subjectivity of "Center": The line between "Center" and slight "Left/Right" is highly subjective. The model may occasionally struggle with nuanced or purely factual reporting, misclassifying it if it contains politically charged keywords.
Context Length: The model uses DistilBERT, which truncates text after 512 tokens (roughly 350-400 words). For very long articles, it only analyzes the text passed to it (we recommend passing the first 200 and last 200 words for long-form articles).
Language: The model is trained exclusively on English text and US-centric political datasets. It may not accurately reflect political spectrums in other countries.