megantosh commited on
Commit
753842c
1 Parent(s): 8a630b2

Model Card

Browse files
Files changed (1) hide show
  1. README.md +118 -0
README.md ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: ar, en
3
+ license: apache-2.0
4
+ datasets:
5
+ - AQMAR
6
+ - ANERcorp
7
+ thumbnail: https://www.informatik.hu-berlin.de/en/forschung-en/gebiete/ml-en/resolveuid/a6f82e0d7fa446a59c902cac4cafa9cb/@@images/image/preview
8
+ tags:
9
+ - flair
10
+ - Text Classification
11
+ - token-classification
12
+ - sequence-tagger-model
13
+ metrics:
14
+ - f1
15
+ widget:
16
+ - text: "اختارها خيري بشارة كممثلة، دون سابقة معرفة أو تجربة تمثيلية، لتقف بجانب فاتن حمامة في فيلم «يوم مر ويوم حلو» (1988) وهي ما زالت شابة لم تتخطَ عامها الثاني"
17
+ ---
18
+ # Arabic NER Model for AQMAR dataset
19
+ Training was conducted over 86 epochs, using a linear decaying learning rate of 2e-05, starting from 0.3 and a batch size of 48 with fastText and Flair forward and backward embeddings.
20
+
21
+
22
+ ## Original Dataset:
23
+ - [AQMAR](http://www.cs.cmu.edu/~ark/ArabicNER/)
24
+
25
+ ## Results:
26
+ - F1-score (micro) 0.9323
27
+ - F1-score (macro) 0.9272
28
+
29
+ | | True Posititves | False Positives | False Negatives | Precision | Recall | class-F1 |
30
+ |------|-----|----|----|---------|--------|----------|
31
+ | LOC | 164 | 7 | 13 | 0.9591 | 0.9266 | 0.9425 |
32
+ | MISC | 398 | 22 | 37 | 0.9476 | 0.9149 | 0.9310 |
33
+ | ORG | 65 | 6 | 9 | 0.9155 | 0.8784 | 0.8966 |
34
+ | PER | 199 | 13 | 13 | 0.9387 | 0.9387 | 0.9387 |
35
+
36
+ ---
37
+
38
+ # Usage
39
+ ```python
40
+ from flair.data import Sentence
41
+ from flair.models import SequenceTagger
42
+ import pyarabic.araby as araby
43
+ from icecream import ic
44
+
45
+ arTagger = SequenceTagger.load('megantosh/flair-arabic-MSA-aqmar')
46
+
47
+ sentence = Sentence('George Washington went to Washington .')
48
+ arSentence = Sentence('عمرو عادلي أستاذ للاقتصاد السياسي المساعد في الجامعة الأمريكية بالقاهرة .')
49
+
50
+
51
+ # predict NER tags
52
+ tagger.predict(sentence)
53
+ arTagger.predict(arSentence)
54
+
55
+ # print sentence with predicted tags
56
+ ic(sentence.to_tagged_string)
57
+ ic(arSentence.to_tagged_string)
58
+
59
+ ```
60
+
61
+ # Example
62
+ see an example from a [similar NER model in Flair](https://huggingface.co/megantosh/flair-arabic-multi-ner)
63
+
64
+ # Model Configuration
65
+ ```python
66
+ (embeddings): StackedEmbeddings(
67
+ (list_embedding_0): WordEmbeddings('ar')
68
+ (list_embedding_1): FlairEmbeddings(
69
+ (lm): LanguageModel(
70
+ (drop): Dropout(p=0.1, inplace=False)
71
+ (encoder): Embedding(7125, 100)
72
+ (rnn): LSTM(100, 2048)
73
+ (decoder): Linear(in_features=2048, out_features=7125, bias=True)
74
+ )
75
+ )
76
+ (list_embedding_2): FlairEmbeddings(
77
+ (lm): LanguageModel(
78
+ (drop): Dropout(p=0.1, inplace=False)
79
+ (encoder): Embedding(7125, 100)
80
+ (rnn): LSTM(100, 2048)
81
+ (decoder): Linear(in_features=2048, out_features=7125, bias=True)
82
+ )
83
+ )
84
+ )
85
+ (word_dropout): WordDropout(p=0.05)
86
+ (locked_dropout): LockedDropout(p=0.5)
87
+ (embedding2nn): Linear(in_features=4396, out_features=4396, bias=True)
88
+ (rnn): LSTM(4396, 256, batch_first=True, bidirectional=True)
89
+ (linear): Linear(in_features=512, out_features=14, bias=True)
90
+ (beta): 1.0
91
+ (weights): None
92
+ (weight_tensor) None
93
+ )"
94
+ 2021-03-31 22:19:50,654 ----------------------------------------------------------------------------------------------------
95
+ 2021-03-31 22:19:50,654 Corpus: "Corpus: 3025 train + 336 dev + 373 test sentences"
96
+ 2021-03-31 22:19:50,654 ----------------------------------------------------------------------------------------------------
97
+ 2021-03-31 22:19:50,654 Parameters:
98
+ 2021-03-31 22:19:50,654 - learning_rate: "0.3"
99
+ 2021-03-31 22:19:50,654 - mini_batch_size: "48"
100
+ 2021-03-31 22:19:50,654 - patience: "3"
101
+ 2021-03-31 22:19:50,654 - anneal_factor: "0.5"
102
+ 2021-03-31 22:19:50,654 - max_epochs: "150"
103
+ 2021-03-31 22:19:50,654 - shuffle: "True"
104
+ 2021-03-31 22:19:50,654 - train_with_dev: "False"
105
+ 2021-03-31 22:19:50,654 - batch_growth_annealing: "False"
106
+ 2021-03-31 22:19:50,655 ------------------------------------
107
+ ```
108
+ Due to some formatting errors, your code might appear like [this](https://ibb.co/ky20Lnq).
109
+
110
+ # Citation
111
+ *if you use this model in your work, please consider citing this work:*
112
+ ```latex
113
+ @unpublished{MMHU21
114
+ author = "M. Megahed",
115
+ title = "Sequence Labeling Architectures in Diglossia",
116
+ note = "In Review",
117
+ }
118
+ ```