M3-Assignment2 / README.md
HugMi's picture
Update README.md
45d27c4 verified
---
license: apache-2.0
tags:
- text-classification
- fake-news-detection
---
# Fake News Detection Model
This model is trained to detect fake news articles using DistilBERT.
## Training Data
The model was trained on a dataset of fake and real news articles. The dataset was preprocessed to remove irrelevant information and to balance the classes.
## Performance
The model was evaluated using 5-fold cross-validation. The average metrics across all folds are as follows:
| Metric | Value |
|-----------|-------|
| Accuracy | 0.973 |
| Precision | 0.962 |
| Recall | 0.986 |
| F1 | 0.973 |
| ROC AUC | 0.973 |
## Usage
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("HugMi/M3-Assignment2")
model = AutoModelForSequenceClassification.from_pretrained("HugMi/M3-Assignment2")
def classify_text(text):
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
predicted_class = outputs.logits.argmax().item()
return predicted_class # 0 for fake, 1 for real
---