[fix] had taken out a previous optimization while debugging. Don't need to repeatedly update the backpointer array in viterbi to store an argmax when a stack variable will work. Because that's in the quadratic (only in L, the number o labels, which is small) section of the algorithm, even this small change can make a pretty sizeable difference. CRF training speed is now roughly on par with the greedy model

This commit is contained in:
Al
2017-03-11 02:31:52 -05:00
parent 647ddf171d
commit a6eaf5ebc5

View File

@@ -611,7 +611,7 @@ double crf_context_viterbi(crf_context_t *self, uint32_t *labels) {
/* Store this path if it has the maximum score. */
if (max_score < score) {
max_score = score;
back[j] = i;
argmax_score = i;
}
}