boapps commited on
Commit
63bfdac
·
verified ·
1 Parent(s): fecad43

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +27 -0
README.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Klasszifikációs modell a [kmdb_classification](https://huggingface.co/datasets/boapps/kmdb_classification) adathalmazon tanítva. A klasszifikáció cím és leírás (lead) alapján történik.
2
+
3
+ ### Használat:
4
+
5
+ ```python
6
+ import torch
7
+ import torch.nn.functional as F
8
+ from transformers import BertForSequenceClassification, BertTokenizer
9
+ from datasets import load_dataset
10
+
11
+ model = BertForSequenceClassification.from_pretrained('boapps/kmdb_classification_model')
12
+ tokenizer = BertTokenizer.from_pretrained('SZTAKI-HLT/hubert-base-cc')
13
+
14
+ article = {'title': '400 milliós luxusvillába vette be magát Matolcsy és családja', 'description': 'Matolcsy György fiának cége megvette, Matolcsy György unokatestvérének bankja meghitelezte, Matolcsy György pedig használja a 430 millióért hirdetett II. kerületi luxusrezidenciát.'}
15
+
16
+ tokenized_article = tokenizer(article['title']+'\n'+article['description'], return_tensors="pt")
17
+
18
+ logits = model(**tokenized_article).logits
19
+ probabilities = F.softmax(logits[0], dim=-1)
20
+
21
+ print(probabilities)
22
+ ```
23
+
24
+ ### Eredmények
25
+ precision: 0.739
26
+ recall: 0.950
27
+ accuracy: 0.963