Question 4Easy
A matrix of shape (32, 10) is multiplied by a matrix of shape (10, 5). What is the result's shape?
- (32, 10)
- (5, 32)
- (10, 10)
- (32, 5)
Answer: D. (32, 5)
Explanation
Inner dimensions (10) must match; the result takes the outer dimensions.
Step-by-step solution
- (m, n) x (n, p) gives (m, p).
- Inner dimensions match: 10 and 10.
- Result = (32, 5).
Why the other options are wrong
- A. (32, 10) is the first matrix's shape.
- B. (5, 32) is the transpose of the result.
- C. (10, 10) uses the inner dimensions, which cancel.
Tip: Inner dims must match and vanish; outer dims remain.
Question 6Medium
Why are input features often standardised before gradient descent?
- It speeds up convergence
- It is required for decision trees
- It removes all outliers
- It reduces the number of features
Answer: A. It speeds up convergence
Explanation
Features on very different scales make the loss surface elongated, slowing convergence.
Step-by-step solution
- Features on very different scales make the loss surface long and narrow.
- Gradient descent then zig-zags and needs a small learning rate.
- Standardising gives a rounder surface, so it converges faster.
Why the other options are wrong
- B. Decision trees do not need scaling.
- C. Standardising rescales data but does not remove outliers.
- D. The number of features stays the same.
Question 8Medium
Prediction errors are 2, -2, 4 and -4. What is the RMSE, to two decimals?
- 3.00
- 3.16
- 10.00
- 0.00
Answer: B. 3.16
Explanation
Mean of squares = (4 + 4 + 16 + 16)/4 = 10; RMSE =
sqrt(10) = 3.16.
Step-by-step solution
- Squares: 4, 4, 16, 16; sum = 40.
- Mean =
40 / 4 = 10.
- RMSE =
sqrt(10) = 3.16.
Why the other options are wrong
- A. 3.00 is the mean absolute error.
- C. 10.00 is the MSE before the square root.
- D. 0 is the mean of the signed errors, which cancel.
Tip: RMSE >= MAE; equal only when all errors have the same size.
Question 10Hard
In a dataset with 90% class A and 10% class B, why might micro-averaged F1 look much better than macro-averaged F1?
- Micro averaging ignores class A
- They are always equal
- Macro averaging counts samples twice
- Micro favours the big class
Answer: D. Micro favours the big class
Explanation
Micro pools all predictions, so poor minority-class performance barely moves it; macro weights classes equally.
Step-by-step solution
- Micro averaging pools all predictions before computing the metric.
- With 90% class A, A's results dominate the pooled counts.
- If the model handles A well but B poorly, micro F1 looks high while macro F1 drops.
Why the other options are wrong
- A. Micro averaging is dominated by class A, not blind to it.
- B. They differ whenever classes differ in size and performance.
- C. Macro averages per-class scores; it does not double count.
Tip: Imbalanced data: watch macro F1.