AtmaHou / FewShotTagging

Code for ACL2020 paper: Few-shot Slot Tagging with Collapsed Dependency Transfer and Label-enhanced Task-adaptive Projection Network
153 stars 29 forks source link

代码细节疑问 #19

Closed Wangpeiyi9979 closed 3 years ago

Wangpeiyi9979 commented 3 years ago

您好,很感谢您的工作,简单看了一下代码,关于原始论文的 image 有些疑惑。

1、按TapNet中的说法,这个Φ应该是开始随机初始化的,每一个tag都对应一个向量,然后您在代码中的实现是这一行吗: image 原文采用的BIO形式的标签,那么这个矩阵的维度不该是 num_tags*2+1, bert_emb_dim?

2、关于这个Φ的作用:因为是每一个tag对应一个向量,训练集和测试集的类别不交叉,训练时只能得到训练集相关类别的φi,但是测试时对应类别的φi仍然完全是随机的呀,这个φ到底有什么用呢。

laiyongkui1997 commented 3 years ago

Hello, the size of labels is represented by num_tags, which contains all number of B-x + I-x + O.

As you said, the label size is different between train and test, so we set a big size of anchors which is 3 times of training label size. Because of the big size of anchors, it can work when the testing label number is bigger than the training label number. Off course you can set a bigger coefficient such as 5, 10 etc.

When using the anchors, we select some anchors from the whole set to make that each label matches an anchor.

The meaning of the anchors is used to push away the label prototype representation in embedding space. After training, the anchors will surround the label prototypes, so as push-away anchors, it can work well in testing.

The more information refers to TapNet.

Wangpeiyi9979 commented 3 years ago

thanks for your reply

After training, we can just obtain the reasonable anchor of the train class label, because the set of train class label and test class label are disjoint, how can we obtain the reasonable anchor of the test class label?

AtmaHou commented 3 years ago

thanks for your reply

After training, we can just obtain the reasonable anchor of the train class label, because the set of train class label and test class label are disjoint, how can we obtain the reasonable anchor of the test class label?

The TapNet assumes that anchors are task-agnostic and share them across different tasks. In this aspect, the anchors just need to be well separated in mapped space. Please refer to last paragraph of Section 2.2 of TapNet.

Wangpeiyi9979 commented 3 years ago

Got it, thx