论文阅读《Enriching Pre-trained Language Model with Entity Information forRelation Classifification

Author

Shanchan Wu

Alibaba Group (U.S.) Inc., Sunnyvale, CA

[email protected]

Yifan He

Alibaba Group (U.S.) Inc., Sunnyvale, CA

[email protected]

Task

Given a sequence of text (usually a sentence) s and a pair of nominals e1 and e2, the objective is to identify the relation between e1 and e2。

Method

输入句子:

[CLS] The $$$ kitchen $$$ is the last renovated part of the # \# #house # \# #

标签:

xxx

Enriching Pre-trained Language Model with Entity Information for Relation Classification

基于BERT预训练模型

步骤:

  1. 分词:from bert import tokenization
  2. 填充:from tensorflow.keras.preprocessing.sequence import pad_sequences
    • 将数据转化为数字,并补零统一维度
  3. 标签转换为数字:from sklearn.preprocessing import LabelEncoder
  4. 模型:
    • 加载BERT
      Enriching Pre-trained Language Model with Entity Information for Relation Classification

    • H t H_t Ht为输入句子经BERT模型第t个位置的输出

    • H 1 ‘ , H 2 ‘ H_1^`,H_2^` H1H2为对应关系实体位置值相加再经前馈网络的输出

    • Enriching Pre-trained Language Model with Entity Information for Relation Classification

    • H 0 ‘ H_0^` H0为[CLS] 经BERT模型的输出

    • Enriching Pre-trained Language Model with Entity Information for Relation Classification

    • 最后将以上三者拼接线性变换后输出即为所有可能关系的概率向量

  5. 损失函数:交叉熵损失函数
  6. 评价指标:F1值

Experiment

dataset:

  • the SemEval-2010 Task 8 dataset

result

  • R-BERT(the proposed model): F1 value: 89.25

相关文章:

  • 2021-12-23
  • 2021-09-06
  • 2022-01-17
  • 2021-09-05
  • 2021-05-02
  • 2022-12-23
  • 2022-02-19
  • 2022-01-11
猜你喜欢
  • 2021-06-27
  • 2021-07-10
  • 2021-05-14
  • 2022-12-23
  • 2021-11-01
  • 2021-09-24
  • 2021-05-02
相关资源
相似解决方案