0
0
ML Pythonml~20 mins

Forward propagation in ML Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Forward Propagation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of a simple forward propagation step
Given the following code for a single neuron forward propagation, what is the output value?
ML Python
import numpy as np

inputs = np.array([1.0, 2.0, 3.0])
weights = np.array([0.2, 0.5, -0.3])
bias = 0.1

output = np.dot(inputs, weights) + bias
print(output)
A1.8
B1.9
C0.4
D2.0
Attempts:
2 left
💡 Hint
Remember to multiply each input by its weight, sum them, then add the bias.
Model Choice
intermediate
1:30remaining
Choosing the correct activation function for forward propagation
Which activation function is best suited for a binary classification problem during forward propagation?
ASoftmax
BReLU (Rectified Linear Unit)
CLinear
DSigmoid
Attempts:
2 left
💡 Hint
Think about output values between 0 and 1 representing probabilities.
Hyperparameter
advanced
2:00remaining
Effect of learning rate on forward propagation outputs
If the learning rate is set too high during training, how does it affect the forward propagation outputs in subsequent iterations?
AOutputs oscillate and may not converge
BOutputs remain unchanged regardless of learning rate
COutputs become more stable and converge faster
DOutputs always decrease in value
Attempts:
2 left
💡 Hint
Consider how big steps in weight updates affect predictions.
Metrics
advanced
2:00remaining
Calculating accuracy from forward propagation predictions
A model outputs the following predictions after forward propagation for 5 samples: [0.9, 0.4, 0.6, 0.3, 0.8]. The true labels are [1, 0, 1, 0, 1]. Using a threshold of 0.5, what is the accuracy?
A40%
B100%
C60%
D80%
Attempts:
2 left
💡 Hint
Convert predictions to 0 or 1 using threshold, then compare to true labels.
🔧 Debug
expert
2:30remaining
Identifying the bug in forward propagation code
What error does the following code raise during forward propagation?
ML Python
import numpy as np

def forward_prop(inputs, weights, bias):
    return np.dot(weights, inputs) + bias

inputs = np.array([1, 2, 3])
weights = np.array([0.2, 0.5])
bias = 0.1
output = forward_prop(inputs, weights, bias)
print(output)
AValueError: shapes (2,) and (3,) not aligned for dot product
BNameError: name 'np' is not defined
CTypeError: unsupported operand type(s) for +: 'int' and 'str'
DNo error, outputs a float value
Attempts:
2 left
💡 Hint
Check if input and weight arrays have matching sizes for dot product.