scrapinghub / python-crfsuite

A python binding for crfsuite
MIT License
770 stars 222 forks source link

What is the operation part of the CRF implemented in? #82

Closed qyangcauc closed 6 years ago

qyangcauc commented 6 years ago

I'm a green hand. In this library, I didn't see the mathematical implementation of CRF, so I was confused. The mathematical principles of CRF I know a part of it, when I tracking the running of the code, I didn't find it. Forgive me for asking such a simple question.

kmike commented 6 years ago

The actual learning is handled by crfsuite C++ library, which is bundled with python-crfsuite (as a submodule). See e.g. SGD training: https://github.com/chokkan/crfsuite/blob/dc5b6c7b726de90ca63cbf269e6476e18f1dd0d9/lib/crf/src/train_l2sgd.c, or Viterbi decoding: https://github.com/chokkan/crfsuite/blob/a2e6375ae21b3f235a72dc8354b919c64facaef1/lib/crf/src/crf1d_context.c#L466