CRF
Linear chain conditional random fields are implemented using Numpy and Mxnet/Gluon, and batch training is supported, not limited to training the data one by one.
Install / Use
/learn @vanewu/CRFREADME
Conditional Random Field With Mxnet/Gluon
Introduction
Linear chain conditional random fields are implemented using Numpy and Mxnet/Gluon, and batch training is supported, not limited to training the data one by one. The latest version of the code uses the foreach operation to perform the expansion of the sequence. The calculation uses NDArray for calculations as much as possible, so that the calculation can be accelerated on the GPU. The final test is more than 40 times faster than the previous calculation using the for loop, so the performance is effectively improved.
The forward calculation, backward calculation, Viterbi decoding, log maximum likelihood and other methods in the conditional random field are realized in crf.py. Finally, the CRF is designed as the layer of the neural network that can be reused in Mxet/Gluon. In order to directly interface with other network layers, such as LSTM + CRF.
Contents
- crf.py (Source code for CRF implementation)
- test.py (Directly test whether CRF is available)
- test_crf_layer.py (Place the CRF as a custom layer in other models and test for availability)
Reference
Related Skills
openhue
339.5kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
339.5kElevenLabs text-to-speech with mac-style say UX.
weather
339.5kGet current weather and forecasts via wttr.in or Open-Meteo
tweakcc
1.5kCustomize Claude Code's system prompts, create custom toolsets, input pattern highlighters, themes/thinking verbs/spinners, customize input box & user message styling, support AGENTS.md, unlock private/unreleased features, and much more. Supports both native/npm installs on all platforms.
