What is the LSTM-CRF model and how to implement it in Python?

1.4K    Asked by FujiwaraBan in Data Science , Asked on Jan 7, 2020
Answered by Fujiwara Ban

LSTM-CRF model is a hybrid based approach where it uses both LSTM and CRF algorithms to recognize the entities. CRF can capture the backward and the current labels and it can be extended by using Bi-directional LSTM where it can capture both forward and backward labels in a sequence and improves the performance of a NER system. This is why it is also known as a state-of-the-art approach.

To implement the same in Python, we need to import the following libraries.

from keras.models import Model, Input

from keras.layers import LSTM, Embedding, Dense, TimeDistributed, Dropout, Bidirectional

from keras_contrib.layers import CRF

Here, embedding layers are also imported from Keras to build a better neural network for better accuracy.


The above flowchart clearly indicates how LSTM-CRF model works.



Your Answer

Interviews

Parent Categories