huggingface / neuralcoref

✨Fast Coreference Resolution in spaCy with Neural Networks
https://huggingface.co/coref/
MIT License
2.85k stars 477 forks source link

Detected mentions decrease during training #264

Closed FabianKaiser closed 2 years ago

FabianKaiser commented 4 years ago

Hello,

I am currently trying to train a german neuralcoref model (with the dataset supplied in other issues). I got the training process started and am able to load the model afterwards, but while the model finds about 2/5 of the mentions in the first step, it decreases a lot during training. Meanwhile, the F1_conll score is increasing. I had some issues with differences in german and english pos tags, but I think I included all relevant ones. What am I missing?

Edit: I am aware that there might also be issues with dependency tags etc, but it would be nice if somebody could tell me what is needed for what

# NO_COREF_LIST = ["i", "me", "my", "you", "your"]
NO_COREF_LIST = ["ich", "mein", "meins", "du", "dein", "deins"]
MENTION_TYPE = {"PRONOMINAL": 0, "NOMINAL": 1, "PROPER": 2, "LIST": 3}
MENTION_LABEL = {0: "PRONOMINAL", 1: "NOMINAL", 2: "PROPER", 3: "LIST"}
# KEEP_TAGS = ["NN", "NNP", "NNPS", "NNS", "PRP", "PRP$", "DT", "IN"]
KEEP_TAGS = ["NE", "NN", "PDAT", "PDS", "PIAT", "PIS", "PPER", "PPOSAT", "PRELS", "PRF", "PWAT", "APPR", "APPRART", "KOUS"]
# CONTENT_TAGS = ["NN", "NNS", "NNP", "NNPS"]
CONTENT_TAGS = ["NE", "NN"]
# PRP_TAGS = ["PRP", "PRP$"]
PRP_TAGS = ["PDAT", "PDS", "PIAT", "PIS", "PPER", "PPOSAT", "PRELS", "PRF", "PWAT"]
# CONJ_TAGS = ["CC", ","]
CONJ_TAGS = ["KON", ","]
# PROPER_TAGS = ["NNP", "NNPS"]
PROPER_TAGS = ["NE"]
NSUBJ_OR_DEP = ["nsubj", "dep"]
CONJ_OR_PREP = ["conj", "prep"]
LEAVE_DEP = ["det", "compound", "appos"]
KEEP_DEP = ["nsubj", "dobj", "iobj", "pobj"]
REMOVE_POS = ["CCONJ", "INTJ", "ADP"]
LOWER_NOT_END = ["'s", ',', '.', '!', '?', ':', ';']
PUNCTS = [".", "!", "?"]
ACCEPTED_ENTS = ["PERSON", "NORP", "FACILITY", "ORG", "GPE", "LOC", "PRODUCT", "EVENT", "WORK_OF_ART", "LANGUAGE"]
Mention identification recall 0.4 <= Detected mentions 202.0 True mentions 505.0
Mention identification recall 0.31485148514851485 <= Detected mentions 159.0 True mentions 505.0
Mention identification recall 0.0 <= Detected mentions 0.0 True mentions 76503.0
Mention identification recall 0.0 <= Detected mentions 0.0 True mentions 505.0
Mention identification recall 0.06930693069306931 <= Detected mentions 35.0 True mentions 505.0
Mention identification recall 0.01032639242905507 <= Detected mentions 790.0 True mentions 76503.0
Mention identification recall 0.10495049504950495 <= Detected mentions 53.0 True mentions 505.0
Mention identification recall 0.10495049504950495 <= Detected mentions 53.0 True mentions 505.0
Mention identification recall 0.00731997438008967 <= Detected mentions 560.0 True mentions 76503.0
Mention identification recall 0.04950495049504951 <= Detected mentions 25.0 True mentions 505.0
Mention identification recall 0.07326732673267326 <= Detected mentions 37.0 True mentions 505.0
Mention identification recall 0.014653020143000928 <= Detected mentions 1121.0 True mentions 76503.0
Mention identification recall 0.0891089108910891 <= Detected mentions 45.0 True mentions 505.0
Mention identification recall 0.0891089108910891 <= Detected mentions 45.0 True mentions 505.0
Mention identification recall 0.016992797668065305 <= Detected mentions 1300.0 True mentions 76503.0
Mention identification recall 0.09306930693069307 <= Detected mentions 47.0 True mentions 505.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.016300014378521105 <= Detected mentions 1247.0 True mentions 76503.0
Mention identification recall 0.0594059405940594 <= Detected mentions 30.0 True mentions 505.0
Mention identification recall 0.06336633663366337 <= Detected mentions 32.0 True mentions 505.0
Mention identification recall 0.01845679254408324 <= Detected mentions 1412.0 True mentions 76503.0
Mention identification recall 0.07722772277227723 <= Detected mentions 39.0 True mentions 505.0
Mention identification recall 0.053465346534653464 <= Detected mentions 27.0 True mentions 505.0
Mention identification recall 0.018600577755120713 <= Detected mentions 1423.0 True mentions 76503.0
Mention identification recall 0.061386138613861385 <= Detected mentions 31.0 True mentions 505.0
Mention identification recall 0.07722772277227723 <= Detected mentions 39.0 True mentions 505.0
Mention identification recall 0.019567860083918278 <= Detected mentions 1497.0 True mentions 76503.0
Mention identification recall 0.07722772277227723 <= Detected mentions 39.0 True mentions 505.0
Mention identification recall 0.08316831683168317 <= Detected mentions 42.0 True mentions 505.0
Mention identification recall 0.0188489340287309 <= Detected mentions 1442.0 True mentions 76503.0
Mention identification recall 0.06534653465346535 <= Detected mentions 33.0 True mentions 505.0
Mention identification recall 0.0594059405940594 <= Detected mentions 30.0 True mentions 505.0
Mention identification recall 0.06930693069306931 <= Detected mentions 35.0 True mentions 505.0
Mention identification recall 0.008078114583741814 <= Detected mentions 618.0 True mentions 76503.0
Mention identification recall 0.08118811881188119 <= Detected mentions 41.0 True mentions 505.0
Mention identification recall 0.0594059405940594 <= Detected mentions 30.0 True mentions 505.0
Mention identification recall 0.011332888906317399 <= Detected mentions 867.0 True mentions 76503.0
Mention identification recall 0.053465346534653464 <= Detected mentions 27.0 True mentions 505.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.017999294145327634 <= Detected mentions 1377.0 True mentions 76503.0
Mention identification recall 0.08118811881188119 <= Detected mentions 41.0 True mentions 505.0
Mention identification recall 0.07326732673267326 <= Detected mentions 37.0 True mentions 505.0
Mention identification recall 0.019411003490059215 <= Detected mentions 1485.0 True mentions 76503.0
Mention identification recall 0.07920792079207921 <= Detected mentions 40.0 True mentions 505.0
Mention identification recall 0.10297029702970296 <= Detected mentions 52.0 True mentions 505.0
Mention identification recall 0.01952864593545351 <= Detected mentions 1494.0 True mentions 76503.0
Mention identification recall 0.061386138613861385 <= Detected mentions 31.0 True mentions 505.0
Mention identification recall 0.053465346534653464 <= Detected mentions 27.0 True mentions 505.0
Mention identification recall 0.019358717958772857 <= Detected mentions 1481.0 True mentions 76503.0
Mention identification recall 0.07524752475247524 <= Detected mentions 38.0 True mentions 505.0
Mention identification recall 0.047524752475247525 <= Detected mentions 24.0 True mentions 505.0
Mention identification recall 0.019384860724416034 <= Detected mentions 1483.0 True mentions 76503.0
Mention identification recall 0.041584158415841586 <= Detected mentions 21.0 True mentions 505.0
Mention identification recall 0.0891089108910891 <= Detected mentions 45.0 True mentions 505.0
Mention identification recall 0.019790073591885286 <= Detected mentions 1514.0 True mentions 76503.0
Mention identification recall 0.08118811881188119 <= Detected mentions 41.0 True mentions 505.0
Mention identification recall 0.05742574257425743 <= Detected mentions 29.0 True mentions 505.0
Mention identification recall 0.019711645294955754 <= Detected mentions 1508.0 True mentions 76503.0
Mention identification recall 0.053465346534653464 <= Detected mentions 27.0 True mentions 505.0
Mention identification recall 0.06930693069306931 <= Detected mentions 35.0 True mentions 505.0
Mention identification recall 0.019790073591885286 <= Detected mentions 1514.0 True mentions 76503.0
Mention identification recall 0.0594059405940594 <= Detected mentions 30.0 True mentions 505.0
Mention identification recall 0.03762376237623762 <= Detected mentions 19.0 True mentions 505.0
Mention identification recall 0.039603960396039604 <= Detected mentions 20.0 True mentions 505.0
Mention identification recall 0.01984235912317164 <= Detected mentions 1518.0 True mentions 76503.0
Mention identification recall 0.10693069306930693 <= Detected mentions 54.0 True mentions 505.0
Mention identification recall 0.08712871287128712 <= Detected mentions 44.0 True mentions 505.0
Mention identification recall 0.02005150124831706 <= Detected mentions 1534.0 True mentions 76503.0
Mention identification recall 0.07524752475247524 <= Detected mentions 38.0 True mentions 505.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.01996000156856594 <= Detected mentions 1527.0 True mentions 76503.0
Mention identification recall 0.06336633663366337 <= Detected mentions 32.0 True mentions 505.0
Mention identification recall 0.07722772277227723 <= Detected mentions 39.0 True mentions 505.0
Mention identification recall 0.01994693018574435 <= Detected mentions 1526.0 True mentions 76503.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.019973072951387526 <= Detected mentions 1528.0 True mentions 76503.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.07128712871287128 <= Detected mentions 36.0 True mentions 505.0
Mention identification recall 0.01994693018574435 <= Detected mentions 1526.0 True mentions 76503.0
Mention identification recall 0.07128712871287128 <= Detected mentions 36.0 True mentions 505.0
Mention identification recall 0.07128712871287128 <= Detected mentions 36.0 True mentions 505.0
Mention identification recall 0.01992078742010117 <= Detected mentions 1524.0 True mentions 76503.0
Mention identification recall 0.07128712871287128 <= Detected mentions 36.0 True mentions 505.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.01992078742010117 <= Detected mentions 1524.0 True mentions 76503.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.01994693018574435 <= Detected mentions 1526.0 True mentions 76503.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.019907716037279585 <= Detected mentions 1523.0 True mentions 76503.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.06732673267326733 <= Detected mentions 34.0 True mentions 505.0
Mention identification recall 0.06930693069306931 <= Detected mentions 35.0 True mentions 505.0

F1_conll 0.06862934236000345
F1_conll 0.040502746963101084
F1_conll 0.0
|| min/train evaluation 13.29 | F1_conll  0.00
F1_conll 0.0
F1_conll 0.06893977699120445
F1_conll 0.01297019255223894
|| min/train evaluation 12.99 | F1_conll  0.01
F1_conll 0.08623859167690458
F1_conll 0.09523427313822064
F1_conll 0.009466894712434512
|| min/train evaluation 13.22 | F1_conll  0.01
F1_conll 0.04759194492317375
F1_conll 0.06944493495788123
F1_conll 0.021631286506705972
|| min/train evaluation 13.18 | F1_conll  0.02
F1_conll 0.07744756134381892
F1_conll 0.07732079799991481
F1_conll 0.026728993691593057
|| min/train evaluation 12.22 | F1_conll  0.03
F1_conll 0.08829586752815387
F1_conll 0.06623235258046839
F1_conll 0.025831973419138943
|| min/train evaluation 14.03 | F1_conll  0.03
F1_conll 0.06050293529766604
F1_conll 0.05688260536384634
F1_conll 0.030036572295921826
|| min/train evaluation 12.90 | F1_conll  0.03
F1_conll 0.07216304945531364
F1_conll 0.05691836845951731
F1_conll 0.03036827305477409
|| min/train evaluation 12.35 | F1_conll  0.03
F1_conll 0.06199639506920466
F1_conll 0.07959686695602375
F1_conll 0.03225952030604779
|| min/train evaluation 12.36 | F1_conll  0.03
F1_conll 0.06813314478955307
F1_conll 0.07211451513319107
F1_conll 0.030537208642016794
|| min/train evaluation 12.41 | F1_conll  0.03
F1_conll 0.06565125740608246
F1_conll 0.060363693651152496
F1_conll 0.0574112384166637
F1_conll 0.009662769155477235
|| min/train evaluation 14.00 | F1_conll  0.01
F1_conll 0.07484146587968322
F1_conll 0.06549320101939989
F1_conll 0.016023191219575624
|| min/train evaluation 13.78 | F1_conll  0.02
F1_conll 0.05729516620709577
F1_conll 0.07671557179241763
F1_conll 0.028563404271835503
|| min/train evaluation 13.40 | F1_conll  0.03
F1_conll 0.09141873908323479
F1_conll 0.08093871203683502
F1_conll 0.031350026418913705
|| min/train evaluation 13.33 | F1_conll  0.03
F1_conll 0.08679857946326318
F1_conll 0.10531108189572069
F1_conll 0.032028297443043856
|| min/train evaluation 13.42 | F1_conll  0.03
F1_conll 0.06518551613940421
F1_conll 0.05629415183164843
F1_conll 0.031681781937953325
|| min/train evaluation 13.38 | F1_conll  0.03
F1_conll 0.0803707459598277
F1_conll 0.05127219305621474
F1_conll 0.031864333138818264
|| min/train evaluation 13.27 | F1_conll  0.03
F1_conll 0.05070151215467964
F1_conll 0.09324491728994926
F1_conll 0.03219899269853135
|| min/train evaluation 14.28 | F1_conll  0.03
F1_conll 0.09491993189163177
F1_conll 0.062334099114061216
F1_conll 0.03246125968338142
|| min/train evaluation 12.61 | F1_conll  0.03
F1_conll 0.053792555301940694
F1_conll 0.07147720379186746
F1_conll 0.03253411264583341
|| min/train evaluation 12.63 | F1_conll  0.03
F1_conll 0.07186513177845351
F1_conll 0.04958579525185921
F1_conll 0.040598896378093836
F1_conll 0.03222805459358293
|| min/train evaluation 13.18 | F1_conll  0.03
F1_conll 0.10618903791542218
F1_conll 0.08772808868606763
F1_conll 0.03279383563096349
|| min/train evaluation 13.27 | F1_conll  0.03
F1_conll 0.07469503831947723
F1_conll 0.07414113244839415
F1_conll 0.03269295176733961
|| min/train evaluation 13.22 | F1_conll  0.03
F1_conll 0.0681186280069319
F1_conll 0.08109546567885391
F1_conll 0.03280279585185842
|| min/train evaluation 13.88 | F1_conll  0.03
F1_conll 0.07059702587256776
F1_conll 0.07059702587256776
F1_conll 0.03271535006336866
|| min/train evaluation 13.36 | F1_conll  0.03
F1_conll 0.0706616945331741
F1_conll 0.07555761008942476
F1_conll 0.0327637372547856
|| min/train evaluation 13.45 | F1_conll  0.03
F1_conll 0.07528069532114516
F1_conll 0.07555761008942476
F1_conll 0.032729671411982096
|| min/train evaluation 13.39 | F1_conll  0.03
F1_conll 0.07555761008942476
F1_conll 0.0706616945331741
F1_conll 0.03269875818378095
|| min/train evaluation 13.39 | F1_conll  0.03
F1_conll 0.07119014067935335
F1_conll 0.07092475947989914
F1_conll 0.03271418382122945
|| min/train evaluation 13.33 | F1_conll  0.03
F1_conll 0.07092475947989914
F1_conll 0.0706616945331741
F1_conll 0.03269103963877381
|| min/train evaluation 13.24 | F1_conll  0.03
F1_conll 0.07119014067935335
F1_conll 0.0710046008297051
F1_conll 0.07401697603948099
FabianKaiser commented 4 years ago

So I changed more tags which differed in english and german. However, I feel like some of the tags cannot be directly translated into other tags.


# NO_COREF_LIST = ["i", "me", "my", "you", "your"]
NO_COREF_LIST = ["ich", "mein", "meins", "du", "dein", "deins"]
MENTION_TYPE = {"PRONOMINAL": 0, "NOMINAL": 1, "PROPER": 2, "LIST": 3}
MENTION_LABEL = {0: "PRONOMINAL", 1: "NOMINAL", 2: "PROPER", 3: "LIST"}
# KEEP_TAGS = ["NN", "NNP", "NNPS", "NNS", "PRP", "PRP$", "DT", "IN"]
KEEP_TAGS = ["NE", "NN", "PDAT", "PDS", "PIAT", "PIS", "PPER", "PPOSAT", "PRELS", "PRF", "PWAT", "APPR", "APPRART", "KOUS"]
# CONTENT_TAGS = ["NN", "NNS", "NNP", "NNPS"]
CONTENT_TAGS = ["NE", "NN"]
# PRP_TAGS = ["PRP", "PRP$"]
PRP_TAGS = ["PDAT", "PDS", "PIAT", "PIS", "PPER", "PPOSAT", "PRELS", "PRF", "PWAT"]
# CONJ_TAGS = ["CC", ","]
CONJ_TAGS = ["KON", ","]
# PROPER_TAGS = ["NNP", "NNPS"]
PROPER_TAGS = ["NE"]
# NSUBJ_OR_DEP = ["nsubj", "dep"]
NSUBJ_OR_DEP = ["sb", "sbp", "sp"]
# CONJ_OR_PREP = ["conj", "prep"]
CONJ_OR_PREP = ["cj", "mo"]
# LEAVE_DEP = ["det", "compound", "appos"]
LEAVE_DEP = ["app"]
# KEEP_DEP = ["nsubj", "dobj", "iobj", "pobj"]
KEEP_DEP = ["nk", "sb", "sbp", "sp", "oa", "oa2", "oc", "og", "op"]
REMOVE_POS = ["CCONJ", "INTJ", "ADP"]
LOWER_NOT_END = ["'s", ',', '.', '!', '?', ':', ';']
PUNCTS = [".", "!", "?"]
# ACCEPTED_ENTS = ["PERSON", "NORP", "FACILITY", "ORG", "GPE", "LOC", "PRODUCT", "EVENT", "WORK_OF_ART", "LANGUAGE"]
ACCEPTED_ENTS = ["PER", "LOC", "ORG", "MISC"]

##########################################################
##### UTILITIES TO CONVERT STRINGS IN SPACY HASHES #######

cdef set_hashes_list(Hashes* hashes, py_list, StringStore store, Pool mem):
    hashes.length = len(py_list)
    hashes.arr = <hash_t*>mem.alloc(hashes.length, sizeof(hash_t))
    for i, st in enumerate(py_list):
        hashes.arr[i] = store.add(st)

cdef HashesList get_hash_lookups(StringStore store, Pool mem):
    cdef HashesList hashes
    set_hashes_list(&hashes.no_coref_list, NO_COREF_LIST, store, mem)
    set_hashes_list(&hashes.keep_tags, KEEP_TAGS, store, mem)
    set_hashes_list(&hashes.PRP_tags, PRP_TAGS, store, mem)
    set_hashes_list(&hashes.leave_dep, LEAVE_DEP, store, mem)
    set_hashes_list(&hashes.keep_dep, KEEP_DEP, store, mem)
    set_hashes_list(&hashes.nsubj_or_dep, NSUBJ_OR_DEP, store, mem)
    set_hashes_list(&hashes.conj_or_prep, CONJ_OR_PREP, store, mem)
    set_hashes_list(&hashes.remove_pos, REMOVE_POS, store, mem)
    set_hashes_list(&hashes.lower_not_end, LOWER_NOT_END, store, mem)
    set_hashes_list(&hashes.conj_tags, CONJ_TAGS, store, mem)
    set_hashes_list(&hashes.proper_tags, PROPER_TAGS, store, mem)
    set_hashes_list(&hashes.proper_tags, PROPER_TAGS, store, mem)
    set_hashes_list(&hashes.puncts, PUNCTS, store, mem)
    hashes.POSSESSIVE_MARK = store.add("'s")
    # hashes.NSUBJ_MARK = store.add("nsubj")
    hashes.NSUBJ_MARK = store.add("nk")
    # hashes.IN_TAG = store.add('IN')
    hashes.IN_TAG = store.add('KOUS')
    hashes.MARK_DEP = store.add("mark")
    hashes.unknown_word = store.add("UNKNOWN")
    hashes.missing_word = store.add("missing")
    hashes.digit_word = store.add("0")
    return hashes
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.