Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,41 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
1 |
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- text-classification
|
5 |
+
- fake-news-detection
|
6 |
+
---
|
7 |
+
|
8 |
+
# Fake News Detection Model
|
9 |
+
|
10 |
+
This model is trained to detect fake news articles using DistilBERT.
|
11 |
+
|
12 |
+
## Training Data
|
13 |
+
|
14 |
+
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.
|
15 |
+
|
16 |
+
## Performance
|
17 |
+
|
18 |
+
The model was evaluated using 5-fold cross-validation. The average metrics across all folds are as follows:
|
19 |
+
|
20 |
+
| Metric | Value |
|
21 |
+
|-----------|-------|
|
22 |
+
| Accuracy | 0.973 |
|
23 |
+
| Precision | 0.962 |
|
24 |
+
| Recall | 0.986 |
|
25 |
+
| F1 | 0.973 |
|
26 |
+
| ROC AUC | 0.973 |
|
27 |
+
|
28 |
+
## Usage
|
29 |
+
|
30 |
+
```python
|
31 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
32 |
+
|
33 |
+
tokenizer = AutoTokenizer.from_pretrained("HugMi/M3-Assignment2")
|
34 |
+
model = AutoModelForSequenceClassification.from_pretrained("HugMi/M3-Assignment2")
|
35 |
+
|
36 |
+
def classify_text(text):
|
37 |
+
inputs = tokenizer(text, return_tensors="pt")
|
38 |
+
outputs = model(**inputs)
|
39 |
+
predicted_class = outputs.logits.argmax().item()
|
40 |
+
return predicted_class # 0 for fake, 1 for real
|
41 |
---
|