Closed varshachawan closed 6 years ago
Hi @varshachawan, I would say that nothing is wrong, it just turns out that because the I tag is more frequent, in some cases the optimal choice as seen by the model is to pick the I tag instead of the B tag, even though the CRF transition scores might penalize the absence of a B tag.
To solve this, one option would be to set the scores of unknown transitions of the CRF to some very low number so that unseen patterns will never get predicted.
This could be done once upon parameter initialization.
@guillaumegenthial ,
O
[Other]
crf_log_likelihood accepts transition_params=None
tf.contrib.crf.crf_log_likelihood( inputs, tag_indices, sequence_lengths, transition_params=None )
If I refere your sequence_tagging code --> def add_loss_op(self): """Defines the loss""" if self.config.use_crf: log_likelihood, trans_params = tf.contrib.crf.crf_log_likelihood( self.logits, self.labels, self.sequence_lengths) self.trans_params = trans_params # need to evaluate it for decoding self.loss = tf.reduce_mean(-log_likelihood)`
This is a very specific need that you need to address on your own. Googling for how to initialize Tensorflow variables from np array should help. But probably just more data will help.
@guillaumegenthial training Dataset used was In B-I-O format Begin Inside Out format but for some of the predictions it shows I-LOC without B-LOC If I assume correctly, Inside should be always after Begin ... Any thoughts where it is going wrong? Is there any way to control this transitions
Same problem with sequence_tagging implementation and this one Any suggestions where to control these transitions ?