0
0
TensorFlowml~20 mins

Time series with RNN in TensorFlow - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Time Series RNN Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Model Choice
intermediate
2:00remaining
Choosing the right RNN layer for time series prediction

You want to predict future values of a time series using a recurrent neural network. Which TensorFlow layer is best suited to capture long-term dependencies in the data?

Atf.keras.layers.SimpleRNN
Btf.keras.layers.Conv1D
Ctf.keras.layers.Dense
Dtf.keras.layers.LSTM
Attempts:
2 left
💡 Hint

Think about which layer can remember information over many time steps.

Predict Output
intermediate
2:00remaining
Output shape of RNN layer

What is the output shape of the following TensorFlow code?

TensorFlow
import tensorflow as tf
model = tf.keras.Sequential([
    tf.keras.layers.LSTM(10, input_shape=(5, 3))
])
output_shape = model.output_shape
A(5, 10)
B(None, 5, 10)
C(None, 10)
D(None, 3)
Attempts:
2 left
💡 Hint

By default, LSTM returns the last output for each sample.

Hyperparameter
advanced
2:00remaining
Effect of sequence length on RNN training

You train an RNN on time series data with sequences of length 100. You reduce the sequence length to 10. What is the most likely effect on training?

ATraining will be faster but model may lose long-term context.
BTraining will be slower and model will capture more context.
CTraining speed and context capture remain unchanged.
DTraining will be faster and model will capture more context.
Attempts:
2 left
💡 Hint

Shorter sequences mean less data per sample but less context.

Metrics
advanced
2:00remaining
Choosing the right metric for time series regression

You train an RNN to predict continuous values in a time series. Which metric is best to evaluate the model's performance?

AMean Squared Error (MSE)
BCategorical Crossentropy
CAccuracy
DPrecision
Attempts:
2 left
💡 Hint

Think about metrics for continuous value prediction.

🔧 Debug
expert
3:00remaining
Debugging exploding gradients in RNN training

You train an RNN on a long time series but notice the training loss becomes NaN after a few epochs. What is the most likely cause?

AUsing Mean Squared Error instead of accuracy metric.
BExploding gradients causing numerical instability.
CIncorrect input shape causing shape mismatch errors.
DModel underfitting due to too few layers.
Attempts:
2 left
💡 Hint

NaN loss often happens when gradients become too large.