Challenge - 5 Problems
Neural Network Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of a simple neural network prediction
What is the output of the following code snippet that creates a simple neural network and predicts on a single input?
TensorFlow
import tensorflow as tf import numpy as np model = tf.keras.Sequential([ tf.keras.layers.Dense(1, input_shape=(2,), activation='linear') ]) model.layers[0].set_weights([np.array([[1.0],[2.0]]), np.array([0.5])]) input_data = np.array([[3.0, 4.0]]) prediction = model.predict(input_data) print(prediction)
Attempts:
2 left
💡 Hint
Remember the formula for a dense layer output: output = input * weights + bias.
✗ Incorrect
The weights matrix is [[1.0],[2.0]] and bias is [0.5]. For input [3.0, 4.0], output = 3*1 + 4*2 + 0.5 = 3 + 8 + 0.5 = 11.5.
❓ Model Choice
intermediate1:30remaining
Choosing the correct activation function for regression
You want to build a neural network to predict house prices (a continuous value). Which activation function should you use in the output layer?
Attempts:
2 left
💡 Hint
For continuous output without limits, choose an activation that does not restrict output range.
✗ Incorrect
Linear activation allows output to be any real number, suitable for regression tasks like predicting prices.
❓ Hyperparameter
advanced1:30remaining
Effect of batch size on training
Which statement best describes the effect of increasing batch size during neural network training?
Attempts:
2 left
💡 Hint
Think about how batch size affects gradient noise and memory.
✗ Incorrect
Smaller batches give noisier gradients which can help escape local minima and improve generalization, but training is slower. Larger batches use more memory and can speed up training but may reduce generalization.
❓ Metrics
advanced1:30remaining
Choosing the right metric for classification
You train a neural network to classify images into 3 categories. Which metric is best to evaluate overall model accuracy?
Attempts:
2 left
💡 Hint
Think about metrics that measure correct class predictions.
✗ Incorrect
Accuracy measures the proportion of correct predictions and is suitable for classification tasks.
🔧 Debug
expert2:30remaining
Identifying the cause of training failure
You train a neural network but the loss stays constant and does not decrease. What is the most likely cause?
TensorFlow
import tensorflow as tf model = tf.keras.Sequential([ tf.keras.layers.Dense(10, activation='relu', input_shape=(5,)), tf.keras.layers.Dense(1, activation='sigmoid') ]) model.compile(optimizer='adam', loss='binary_crossentropy') import numpy as np X = np.random.rand(100, 5) y = np.ones((100, 1)) model.fit(X, y, epochs=10)
Attempts:
2 left
💡 Hint
Check if the labels provide enough variation for learning.
✗ Incorrect
If all labels are the same, the model cannot learn meaningful differences, so loss stays constant.