allanj / ner_incomplete_annotation

129 stars 33 forks source link

question on the dynet soft implementation #6

Closed yangshao closed 4 years ago

yangshao commented 4 years ago

Hi, I have two questions on the soft implementation:

  1. https://github.com/allanj/ner_incomplete_annotation/blob/aa20c015b3f373ac4a1893e629ac8f2dd137faab/soft_lstmcrf.py#L128 https://github.com/allanj/ner_incomplete_annotation/blob/aa20c015b3f373ac4a1893e629ac8f2dd137faab/soft_lstmcrf.py#L244 the code add marginal after the log_sum_exp, while add mask before log_sum_exp, as mask is just an special case of marginal, why do we deal them differently?

  2. https://github.com/allanj/ner_incomplete_annotation/blob/aa20c015b3f373ac4a1893e629ac8f2dd137faab/soft_lstmcrf.py#L254 does this double time transpose means we still use the original transpose?

allanj commented 4 years ago
  1. I'm not sure if I really understand your question. (a) for the first marginal, it is used for assigning some probabilities to the labels. (b) for the second mask, it is actually used during decoding where we check if this position already has a label, we don't have to make a prediction on this position (during a self-training phase).

  2. Yeah. I think that's correct.