数据集:
- tner/tweetner7
评估指标:
- f1值
- 精确率
- 召回率
模型索引:
- 名称:tner/twitter-roberta-base-dec2021-tweetner7-all
结果:
- 任务:
名称:标记分类
类型:标记分类
数据集:
名称:tner/tweetner7
类型:tner/tweetner7
参数:tner/tweetner7
评估指标:
- 名称:F1值(test_2021)
类型:f1
值:0.6447001005249637
- 名称:精确率(test_2021)
类型:精确率
值:0.6234607906675308
- 名称:召回率(test_2021)
类型:召回率
值:0.6674375578168362
- 名称:宏F1值(test_2021)
类型:f1_macro
值:0.5982200308213212
- 名称:宏精确率(test_2021)
类型:精确率_macro
值:0.576608821080324
- 名称:宏召回率(test_2021)
类型:召回率_macro
值:0.622268182336741
- 名称:实体跨度F1值(test_2021)
类型:f1_entity_span
值:0.7793353811784417
- 名称:实体跨度精确率(test_2020)
类型:精确率_entity_span
值:0.7536184921149276
- 名称:实体跨度召回率(test_2021)
类型:召回率_entity_span
值:0.8068694344859488
- 名称:F1值(test_2020)
类型:f1
值:0.6582010582010582
- 名称:精确率(test_2020)
类型:精确率
值:0.671343766864544
- 名称:召回率(test_2020)
类型:召回率
值:0.6455630513751947
- 名称:宏F1值(test_2020)
类型:f1_macro
值:0.619090119256277
- 名称:宏精确率(test_2020)
类型:精确率_macro
值:0.6309214005692869
- 名称:宏召回率(test_2020)
类型:召回率_macro
值:0.6088158080350003
- 名称:实体跨度F1值(test_2020)
类型:f1_entity_span
值:0.7647525800476317
- 名称:实体跨度精确率(test_2020)
类型:精确率_entity_span
值:0.7802375809935205
- 名称:实体跨度召回率(test_2020)
类型:召回率_entity_span
值:0.7498702646600934
管道标签:标记分类
小部件:
- 文本:"从{@herbiehancock@}通过{@bluenoterecords@}获取
Takin' Off
专辑的全模拟经典黑胶版本,链接如下:{{URL}}"
示例标题:"NER示例1"
tner/twitter-roberta-base-dec2021-tweetner7-all
此模型是基于cardiffnlp/twitter-roberta-base-dec2021在tner/tweetner7数据集(train_all
分割)上微调的版本。模型微调通过T-NER的超参数搜索完成(详情见仓库)。在2021年的测试集上,它取得了以下结果:
- F1(微观):0.6447001005249637
- 精确率(微观):0.6234607906675308
- 召回率(微观):0.6674375578168362
- F1(宏观):0.5982200308213212
- 精确率(宏观):0.576608821080324
- 召回率(宏观):0.622268182336741
测试集上各实体类别的F1分数细分如下:
- 公司:0.5048128342245989
- 创意作品:0.45297029702970293
- 事件:0.46761313220940554
- 团体:0.6009661835748793
- 地点:0.6592252133946159
- 人物:0.8302430243024302
- 产品:0.6717095310136157
对于F1分数,置信区间通过自助法获得如下:
- F1(微观):
- 90%:[0.6358921767926183, 0.6542958612061787]
- 95%:[0.6341987223616053, 0.6560992650244356]
- F1(宏观):
- 90%:[0.6358921767926183, 0.6542958612061787]
- 95%:[0.6341987223616053, 0.6560992650244356]
完整评估可在NER的评估指标文件和实体跨度的评估指标文件中找到。
使用方法
此模型可通过tner库使用。通过pip安装库。
pip install tner
TweetNER7预处理了推文,将账户名和URL转换为特殊格式(详见数据集页面),因此我们相应地处理推文,然后运行模型预测如下。
import re
from urlextract import URLExtract
from tner import TransformersNER
extractor = URLExtract()
def format_tweet(tweet):
urls = extractor.find_urls(tweet)
for url in urls:
tweet = tweet.replace(url, "{{URL}}")
tweet = re.sub(r"\b(\s*)(@[\S]+)\b", r'\1{\2@}', tweet)
return tweet
text = "从@herbiehancock通过@bluenoterecords获取`Takin' Off`专辑的全模拟经典黑胶版本,链接如下:http://bluenote.lnk.to/AlbumOfTheWeek"
text_format = format_tweet(text)
model = TransformersNER("tner/twitter-roberta-base-dec2021-tweetner7-all")
model.predict([text_format])
也可以通过transformers库使用,但不推荐,因为目前不支持CRF层。
训练超参数
训练期间使用的超参数如下:
- 数据集:['tner/tweetner7']
- 数据集分割:train_all
- 数据集名称:无
- 本地数据集:无
- 模型:cardiffnlp/twitter-roberta-base-dec2021
- crf:是
- 最大长度:128
- 周期:30
- 批量大小:32
- 学习率:1e-05
- 随机种子:0
- 梯度累积步数:1
- 权重衰减:1e-07
- 学习率预热步比例:0.3
- 最大梯度范数:1
完整配置可在微调参数文件中找到。
参考文献
如果使用该模型,请引用T-NER论文和TweetNER7论文。
@inproceedings{ushio-camacho-collados-2021-ner,
title = "{T}-{NER}: An All-Round Python Library for Transformer-based Named Entity Recognition",
author = "Ushio, Asahi and
Camacho-Collados, Jose",
booktitle = "Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: System Demonstrations",
month = apr,
year = "2021",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2021.eacl-demos.7",
doi = "10.18653/v1/2021.eacl-demos.7",
pages = "53--62",
abstract = "Language model (LM) pretraining has led to consistent improvements in many NLP downstream tasks, including named entity recognition (NER). In this paper, we present T-NER (Transformer-based Named Entity Recognition), a Python library for NER LM finetuning. In addition to its practical utility, T-NER facilitates the study and investigation of the cross-domain and cross-lingual generalization ability of LMs finetuned on NER. Our library also provides a web app where users can get model predictions interactively for arbitrary text, which facilitates qualitative model evaluation for non-expert programmers. We show the potential of the library by compiling nine public NER datasets into a unified format and evaluating the cross-domain and cross- lingual performance across the datasets. The results from our initial experiments show that in-domain performance is generally competitive across datasets. However, cross-domain generalization is challenging even with a large pretrained LM, which has nevertheless capacity to learn domain-specific features if fine- tuned on a combined dataset. To facilitate future research, we also release all our LM checkpoints via the Hugging Face model hub.",
}
@inproceedings{ushio-etal-2022-tweet,
title = "{N}amed {E}ntity {R}ecognition in {T}witter: {A} {D}ataset and {A}nalysis on {S}hort-{T}erm {T}emporal {S}hifts",
author = "Ushio, Asahi and
Neves, Leonardo and
Silva, Vitor and
Barbieri, Francesco. and
Camacho-Collados, Jose",
booktitle = "The 2nd Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics and the 12th International Joint Conference on Natural Language Processing",
month = nov,
year = "2022",
address = "Online",
publisher = "Association for Computational Linguistics",
}