zh-hongda

RNN模型与NLP应用

RNN模型与NLP应用

Categorical feature processing

Text processing and word embedding

Text processing

Step 1: Tokenization

Step 2: Build Dictionary

Step 3: Encoding

Step 4: Align Sequences

Word Embedding: Word to Vector

First, represent words using one-hot vectors.

Second, map the one-hot vectors to low-dimensional vectors

Total #parameter: vocabulary×embedding_dim

RNN basics.

Total #parameter: shape(h)× [shape(h)+shape(x)]

SimpleRNN is good at short-term dependence.

SimpleRNN is bad at long-term dependence.

LSTM

4 × shape(h) × [shape(h)+shape(x)]

Making RNNs more effective.

Stacked RNN
Bidirectional RNN
Pretrain

Observation: The embedding layer contributes most of the parameters!

Step 1: Train a model on large dataset.
• Perhaps different problem.
• Perhaps different model.

Step 2: Keep only the embedding layer.

Step 3: Train new LSTM and output layers.

Text generation

Machine translation and Seq2Seq Model

Attention

Self-Attention

参考:

RNN模型与NLP应用

CS583: Deep Learning