0
0
TensorFlowml~20 mins

Sequence-to-sequence basics in TensorFlow - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Seq2Seq Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the main purpose of a sequence-to-sequence model?
In simple terms, what does a sequence-to-sequence model do?
AIt predicts a single number from a fixed set of input features.
BIt converts one sequence of data into another sequence, like translating a sentence from one language to another.
CIt classifies images into categories based on their content.
DIt clusters data points into groups without labels.
Attempts:
2 left
💡 Hint
Think about tasks like language translation or summarizing text.
Predict Output
intermediate
2:00remaining
Output shape of encoder LSTM in a seq2seq model
Given the following TensorFlow code for an encoder LSTM, what is the shape of the output 'encoder_outputs'?
TensorFlow
import tensorflow as tf
encoder_inputs = tf.keras.Input(shape=(None, 10))
encoder_lstm = tf.keras.layers.LSTM(16, return_sequences=True, return_state=True)
encoder_outputs, state_h, state_c = encoder_lstm(encoder_inputs)
A(None, None, 16)
B(None, 16)
C(None, 10, 16)
D(None, 16, 16)
Attempts:
2 left
💡 Hint
return_sequences=True means output has one vector per input time step.
Model Choice
advanced
2:00remaining
Choosing the right decoder output activation for sequence generation
You are building a sequence-to-sequence model to generate text word-by-word from a vocabulary of 5000 words. Which decoder output activation function is most appropriate?
ASoftmax activation to output probabilities over the vocabulary
BLinear activation to output raw scores without normalization
CReLU activation to output positive scores for each word
DSigmoid activation to output independent probabilities for each word
Attempts:
2 left
💡 Hint
Think about how to pick one word from many possible words at each step.
Hyperparameter
advanced
1:30remaining
Effect of increasing LSTM units in a seq2seq model
What is the most likely effect of increasing the number of units in the LSTM layers of a sequence-to-sequence model?
AThe model will ignore input sequences and output random predictions
BThe model will train faster and use less memory
CThe model will always perform worse due to overfitting
DThe model can capture more complex patterns but may overfit if data is limited
Attempts:
2 left
💡 Hint
More units mean more capacity but also more risk of memorizing training data.
Metrics
expert
2:30remaining
Choosing the best metric for evaluating a seq2seq translation model
You trained a sequence-to-sequence model for language translation. Which metric best measures how close the model's output sentences are to the correct translations?
AAccuracy, counting exact matches of entire output sequences
BMean Squared Error, measuring average squared difference between predicted and true word indices
CBLEU score, which compares overlapping n-grams between output and reference sentences
DPerplexity, measuring how well the model predicts the next word probabilities
Attempts:
2 left
💡 Hint
Think about a metric that compares similarity of sentences rather than exact matches.