kmkurn / pytorch-crf

(Linear-chain) Conditional random field in PyTorch.
https://pytorch-crf.readthedocs.io
MIT License
935 stars 151 forks source link

How to get probability for each tag when Viterbi decode? #48

Closed failable closed 4 years ago

failable commented 4 years ago

Can I get probabilities for tags at every time step? Also can I get the joint probability for the best sequence?

kmkurn commented 4 years ago

Hi, right now (1) is not implemented, and (2) can be done by feeding the best sequence to forward (obvious, but not ideal). I'd suggest you to check pytorch-struct out. It has a linear-chain CRF implementation that is more complete (partition, marginals, log prob, argmax).

failable commented 4 years ago

Thanks for the information! I don't know about it !

On Wed, Dec 4, 2019 at 18:01 Kemal Kurniawan notifications@github.com wrote:

Hi, right now (1) is not implemented, and (2) can be done by feeding the best sequence to forward (obvious, but not ideal). I'd suggest you to check pytorch-struct https://github.com/harvardnlp/pytorch-struct out. It has a linear-chain CRF implementation that is more complete (partition, marginals, log prob, argmax).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kmkurn/pytorch-crf/issues/48?email_source=notifications&email_token=ABJYXPWBY7HTWMOGCDEXHT3QW55X3A5CNFSM4JUWVWX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF4NDSA#issuecomment-561566152, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJYXPREPVH76DNGQKFKP7LQW55X3ANCNFSM4JUWVWXQ .

-- Sent from my iPhone