Machine Learning (Aerospace Applications)
Difficulty: Level 2 — Recall (definitions, standard problems, short derivations) Time limit: 30 minutes Total marks: 40
Answer all questions. Show working where derivations are asked. Use for math.
Q1. (4 marks) Write the normal equation solution for linear regression with design matrix and target vector . Given compute the fitted parameter vector .
Q2. (4 marks) Define the sigmoid function and show that its derivative satisfies .
Q3. (4 marks) State the binary cross-entropy loss for a single example with true label and predicted probability . Evaluate it for , (use natural log).
Q4. (4 marks) Explain the difference between L1 (lasso) and L2 (ridge) regularization. State one practical consequence of each on the learned weights.
Q5. (4 marks) Define the bias–variance trade-off. State qualitatively how increasing model complexity affects bias and variance.
Q6. (5 marks) Perform one forward pass through a single neuron with inputs , weights , bias , and ReLU activation. Then repeat with a sigmoid activation (leave the sigmoid value as and give a decimal).
Q7. (4 marks) Briefly explain k-fold cross-validation. For a dataset of 100 samples with , how many samples are used for training and validation in each fold?
Q8. (4 marks) Write the SGD parameter update rule with learning rate and gradient . Then write the momentum update (velocity form) with momentum coefficient .
Q9. (4 marks) Given query , keys , and values , write the scaled dot-product attention formula and explain why the scaling factor is used.
Q10. (3 marks) In a Markov Decision Process, state the Bellman optimality equation for the state-value function .
Answer keyMark scheme & solutions
Q1. (4 marks) Normal equation: . (1)
Compute: (1)
, so . (1)
(1)
So , .
Q2. (4 marks) . (1) . (1) Write since . (2)
Q3. (4 marks) . (2) For , : . (2)
Q4. (4 marks)
- L1 (lasso): penalty ; produces sparse weights (drives some to exactly zero → feature selection). (2)
- L2 (ridge): penalty ; shrinks weights smoothly toward zero but rarely exactly zero; distributes weight among correlated features. (2)
Q5. (4 marks) Total expected error decomposes into (bias) + variance + irreducible noise. (1) Bias = error from wrong model assumptions (underfitting); variance = sensitivity to training data (overfitting). (1) Increasing complexity decreases bias (1) and increases variance (1); optimal complexity balances the two.
Q6. (5 marks) Pre-activation . (2) ReLU: . (1) Sigmoid: . (2)
Q7. (4 marks) k-fold CV: split data into equal folds; train on folds, validate on the held-out fold, rotate so each fold is validation once; average the scores. (2) For 100 samples, : each fold has 20 samples → 80 training, 20 validation per fold. (2)
Q8. (4 marks) SGD: . (2) Momentum: (or ); . (2)
Q9. (4 marks) . (2) Scaling by prevents dot products from growing large in magnitude with dimension , which would push softmax into regions of very small gradients (saturation); it keeps variance controlled. (2)
Q10. (3 marks) (3) (Equivalent forms with expectation notation accepted.)
[
{"claim":"Normal equation gives theta = [2/3, 1/2]","code":"X=Matrix([[1,1],[1,2],[1,3]]); y=Matrix([1,2,2]); th=(X.T*X).inv()*X.T*y; result = (th == Matrix([Rational(2,3), Rational(1,2)]))"},
{"claim":"Cross-entropy for y=1,p=0.8 is approx 0.2231","code":"L=-log(0.8); result = abs(float(L)-0.2231)<1e-3"},
{"claim":"Neuron pre-activation z=0.5 and sigmoid approx 0.6225","code":"z=0.5*2+1.0*(-1)+0.5; s=1/(1+exp(-z)); result = (z==0.5) and abs(float(s)-0.6225)<1e-3"},
{"claim":"Sigmoid derivative equals s*(1-s)","code":"z=symbols('z'); s=1/(1+exp(-z)); result = simplify(diff(s,z) - s*(1-s))==0"}
]