Transition matrix indices
yuvalpinter opened this issue · comments
From https://github.com/rguthrie3/BiLSTM-CRF/blob/master/model.py#L114 it appears that transition[j][i] is the score for transitioning from tag i to tag j. However in https://github.com/rguthrie3/BiLSTM-CRF/blob/master/model.py#L52 the comment says the opposite. I guess it doesn't matter because the updates are still consistent, but should the comment change maybe?
OK I might just really not understand what score_sentence() is actually computing. The score of the path between the correct tagging and the observed? Do you have a reference for this method?
The comment is correct I think. T[i,j] is the score of transitioning to i from j. The score_sentence method just computes the score of the path through the trellis corresponding to the gold standard tags. (At least that is how it is used, you could hand in any tag sequence to get the score of that tag sequence).