File size: 1,096 Bytes
cfcac12
45d27c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cfcac12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
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
---