We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
medium
end_to_end
Sequence Classifier
Build a sequence classifier: embedding lookup + RNN + linear classifier.
Pipeline:
-
Embed: Look up embeddings for each token index from
embedding_table - RNN: Process embedded sequence with a vanilla RNN: $h_t = \tanh(e_t \cdot W_{xh} + h_{t-1} \cdot W_{hh} + b_h)$
- Classify: Apply a linear layer to the final hidden state: $\text{logits} = h_T \cdot W_{out} + b_{out}$
Input:
-
indices: token indices of shape(seq_len,) -
embedding_table: shape(vocab_size, embed_dim) -
W_xh: shape(embed_dim, hidden_dim) -
W_hh: shape(hidden_dim, hidden_dim) -
b_h: shape(hidden_dim,) -
h0: shape(hidden_dim,) -
W_out: shape(hidden_dim, num_classes) -
b_out: shape(num_classes,)
Output: Logits of shape (num_classes,).
Hints
sequence-classification
rnn
embedding
nlp
Sign in to attempt this problem and view the solution.