crownpku / Information-Extraction-Chinese

Chinese Named Entity Recognition with IDCNN/biLSTM+CRF, and Relation Extraction with biGRU+2ATT 中文实体识别与关系提取
2.22k stars 813 forks source link

test_GRU如何计算F1值 #133

Open Guomei-nice opened 3 years ago

Guomei-nice commented 3 years ago

您好,根据代码中对测试集的处理,假设 test_sen = {(实体1,实体2): [[句子1],[句子2],[句子3]]} test_ans = {(实体1,实体2): [1,0,0,1,0,0,0,0,0,0,0,1]} 该如何进行F1值的计算呢?

crownpku commented 3 years ago

看下下面的帖子是否能帮到你: http://www.crownpku.com/2020/03/02/Evaluation-of-Named-Entity-Recognition-Model.html

Guomei-nice commented 3 years ago

看下下面的帖子是否能帮到你: http://www.crownpku.com/2020/03/02/Evaluation-of-Named-Entity-Recognition-Model.html

您好,您推荐的帖子已看。如果我将测试集的数据处理成和训练集数据一样的格式: test_sen = {entity pair:[[[label1-sentence 1],[label1-sentence 2]...],[[label2-sentence 1],[label2-sentence 2]...]} test_ans = {entity pair:[label1,label2,...]} 然后利用下面代码求F1值: f1 = f1_score(np.argmax(test_y, axis=1), predictions, labels=np.array(range(len(relation2id))), average="macro") 这样处理测试集求解F1值是否可行呢?