Question 1, Multinomial Log-Likelihood (15 points)
A multiclass classifier with classes outputs the probability of class given input via the softmax: Write down the log-likelihood expression for a single training example under this multinomial model. Your derivation should follow the same steps used in the course for the binary cross-entropy loss.Solution
For a single example with true class , the probability assigned by the model is . Using indicator notation, we can write the log-likelihood as: Substituting the softmax expression: Since exactly one indicator is 1 (the true class ), this simplifies to: The negative of this expression (averaged over training examples) is the categorical cross-entropy loss minimized during training. Providing the expression for the full dataset (summed over examples) is also acceptable.Question 2, SGD Jitter, Momentum, and Convergence (15 points)
The figure in your notes shows a contour plot of a loss function in weight space together with the SGD trajectory as it searches for the minimum. The trajectory exhibits substantial jitter. (A) (5 points) Is this the best trajectory you can think of? (B) (5 points) Why is there so much jitter? (C) (5 points) A colleague suggests that adding a fraction of the previous update vector to the current update improves convergence. Do you agree? If so, why? Recall the weight update:Solution
(A) No. The jittery trajectory converges very slowly; a smoother, more direct path would be preferable. (B) The axes of the contour plot represent the model parameters . The jitter arises because the two parameter dimensions have very different dynamic ranges (the loss surface is elongated). A single learning rate is simultaneously too large for the steep direction and too small for the flat direction, causing oscillation in the steep direction. (C) Yes. Adding a fraction of the previous update implements a momentum (exponential moving average) update: The averaging filters out high-frequency noise in the gradient, resulting in a much smoother, more direct trajectory and faster convergence, as illustrated by the right-hand plot in the notes.Question 3, CNN Parameter Count and Output Size (15 points)
Consider a CNN trained to classify 64×64 RGB images (3 channels) into 3 vehicle classes (cars, trucks, motorcycles). The architecture is:- Conv1: 32 filters, kernel , stride 1, ReLU
- MaxPool1: , stride 2
- Conv2: 64 filters, kernel , stride 1, ReLU
- MaxPool2: , stride 2
- Conv3: 128 filters, kernel , stride 1, ReLU
- MaxPool3: , stride 2
- FC1: 512 neurons, ReLU
- Output: 3 neurons, softmax
PS3.A (5 points)
How many trainable parameters does Conv1 have?PS3.B (5 points)
What is the output spatial size of Conv1 (assuming no padding)?PS3.C (5 points)
What is the effect of increasing the number of filters in a convolutional layer on the parameter count and on the model’s performance?Solution
PS3.A, Parameters in Conv1. Each of the 32 filters has size (spatial × input channels). Including one bias per filter: (Without biases: . Both values are acceptable.) PS3.B, Output size of Conv1 (no padding, stride 1): PS3.C, Effect of more filters. Increasing the filter count proportionally increases the number of trainable parameters (more weights to store and update). With more filters the network can learn a richer set of feature detectors, which generally improves performance on complex tasks. The trade-offs are higher memory and compute cost, and a greater risk of overfitting on small datasets.Question 4, IoU and Non-Maximum Suppression (15 points)
Boxes are given as in pixels, the top left and bottom right corners. A detector returns threeperson detections:
- (5 points) Compute the intersection over union (IoU) of D1 with D2, and of D1 with D3.
- (5 points) Apply non-maximum suppression (NMS) with an IoU threshold of 0.5. Which detections remain?
- (5 points) Suppose D1 and D2 are in fact two different people, one standing behind the other. What does NMS do to the recall in that case, and what can you change to reduce the damage?
Solution
1. IoU. Each box is , so each has area 1600. D1 and D2 overlap on , an area of : D1 and D3 overlap on , an area of : 2. NMS. Sort by score and keep D1, the highest. D2 overlaps D1 with IoU 0.82 > 0.5, so it is suppressed. D3 overlaps D1 with IoU 0.14 < 0.5, so it is kept. The output is D1 and D3. 3. Crowded scenes. NMS assumes that two boxes with a large overlap describe the same object. When two people really do overlap, the lower-scoring one is removed, and the detector misses it, so recall drops. A higher IoU threshold keeps more overlapping boxes but lets more duplicates through, which lowers precision. Soft-NMS reduces the score of an overlapping box in proportion to the overlap instead of deleting it, so a second object can survive if its score was high. Detectors that predict a set of boxes directly, such as DETR, do not need NMS at all.Question 5, Hidden Markov Model Transition / Observation Models (15 points)
To model humidity as a proxy for temperature, let the hidden state (hot, cold) with transition table and observable humidity with emission table (a) Write out the transition and measurement models as conditional probabilities. (b) Explain qualitatively how you would compute the posterior for the observation sequence “SMSL” using the forward algorithm.Solution
(a) Transition model: Measurement model: (b) The forward algorithm initializes with a prior over the initial state, then recursively updates The filtered posterior is . Apply this once per observation in “SMSL” to obtain the posterior at each step.Question 6, Localization in a Cyclic World (20 points)
A car lives in a cyclic world of three cells, . Moving right from brings it to . Each cell has a waypoint that a sensor can detect:
At you know nothing about the state. At each of the car is commanded to move one cell right, but its control is faulty:
with indices modulo 3. The sensor model is
After each move the sensor reports , and . Using the Bayes filter, find the most probable location at . You may leave the calculations as matrix-vector products.
Solution
Write the belief as a vector over . Each step predicts with the transition matrix, then multiplies by the likelihood of the measurement and normalizes. The likelihood vectors are for and for .
For example, at the prediction for is : the car moved right from , stayed in , or jumped two cells from . The uniform prior stays uniform under the first prediction, because every cell receives the same total probability.
At the car is most probably in , with probability 0.95. The two readings favor after , the faulty but mostly reliable move takes it to , and the reading confirms it.
Question 7, Kalman Filter Behaviour and Noise Trade-offs (10 points)
An agent moves in a 1-D world with constant velocity. A scalar Kalman filter is implemented with equal process and measurement noise standard deviations . (a) Explain why, at the start of filtering, the estimate tracks the noisy measurements closely, whereas after several steps the estimate smooths over them. (b) What happens if the process-noise variance is set too low? Too high? (c) If the measurement matrix , is a meaningful state estimate still possible? Why or why not?Solution
(a) The Kalman gain is close to 1 when the predicted covariance is large (initial uncertainty), so the update weights the measurement heavily. As iterations proceed, decreases and the gain converges to its (nonzero) steady-state value, so the filter blends prediction and measurement in a fixed ratio rather than tracking each measurement directly, visually this looks like smoothing. (b) If the process variance is set artificially low, the filter becomes over-confident in its model and fails to react to real changes in the system. Set it too high and the filter becomes over-reactive, essentially mirroring the noisy measurements. (c) No. If , the measurement carries no information about the state ( is independent of ), so the correction step is a no-op. The filter degenerates into pure prediction and its covariance grows unboundedly.Question 8, Kalman Filter Statements (15 points)
A linear Gaussian system has the motion and measurement models with , and . The Kalman filter computes Which of the following statements is or are correct? A. If for all , then the Kalman filter cannot compute a meaningful estimate of the state from the measurements. B. The Kalman gain depends on the measurements . C. None of the statements above is correct.Solution
A is correct. With the measurement is pure noise and carries no information about the state. The gain is , so the update leaves and unchanged. The filter only predicts, and its covariance grows with every step. B is wrong. is computed from , and only. The covariances do not depend on the measured values, so the gains for a linear system can even be computed before any measurement arrives. The measurements enter only through the innovation in the mean update. C is therefore wrong as well.Question 9, Differential-Drive Kinematics and Odometry (20 points)
A TurtleBot3 has wheel radius m and half track m (the wheels are m apart). Its configuration is . The left and right wheels turn at rad/s and rad/s.- (5 points) Compute the forward speed , the turn rate , and the radius of the circle the robot drives.
- (8 points) The robot starts at and holds these wheel speeds for s. Compute its exact pose at the end. Compare it with the single Euler step , , .
- (4 points) Write the constraint that makes this robot nonholonomic. Can the robot reach the pose , 0.5 m to its left with the same heading? Explain.
- (3 points) Give one systematic and one random source of odometry error, and say which one calibration can remove.
Solution
1. Body twist. The radius is m, with the center of the circle to the robot’s left. 2. Exact pose. With a constant twist the robot drives an arc. After s, rad, and The Euler step uses the initial heading for the whole second and gives . It misses the 4 cm of sideways displacement and overshoots in by 6 mm. Odometry therefore integrates over short steps, or uses the exact arc (the matrix exponential of the twist). 3. Nonholonomic constraint. The wheels do not slide sideways, so the lateral body velocity is zero: This restricts velocities, not configurations, so it cannot be integrated into a constraint on . The robot cannot move straight sideways, but it can still reach by maneuvering: turn left, drive, turn right, drive back, as when you parallel-park a car. 4. Odometry errors. A systematic error is a wheel radius or a track width that differs from its nominal value; it biases every step in the same direction, and calibration removes it. A random error is wheel slip on a smooth or uneven floor, or quantization of the encoder counts; it differs from step to step, calibration cannot remove it, and it is why the uncertainty of the pose estimate grows over time.Question 10, EKF SLAM State and Cost (15 points)
A planar robot runs EKF SLAM with point landmarks. The state stacks the robot pose and the position of each landmark.- (4 points) For , what are the dimensions of the state vector and of its covariance matrix ? How many numbers does hold?
- (4 points) How does the cost of one measurement update grow with ? What limits EKF SLAM in large environments?
- (4 points) At the start, the landmark estimates are uncorrelated. Explain why they become correlated with each other as the robot drives, even though the landmarks do not move.
- (3 points) The robot returns to a landmark it saw at the start (a loop closure). What happens to the uncertainty of the other landmarks, and why?
Solution
1. Dimensions. The state has entries and is , holding numbers (about half of them distinct, since is symmetric). 2. Cost. The update touches the whole covariance: costs per observed landmark, and memory is also . With thousands of landmarks this becomes too slow for real time. A second limit is data association: EKF SLAM assumes each measurement is matched to the right landmark, and one wrong match can corrupt the estimate permanently. 3. Correlations. The robot measures each landmark relative to its own uncertain pose. Two landmarks observed from the same pose inherit the same pose error, so if the robot’s estimate is 10 cm too far left, both landmark estimates are shifted 10 cm left together. The off-diagonal blocks of record this shared error. The correlations are not a defect: they are what lets the map be consistent. 4. Loop closure. Re-observing a well-known landmark sharply reduces the uncertainty of the robot pose. Through the correlations in , the update then also corrects and shrinks the uncertainty of every landmark that was observed from the poses along the loop. Without the off-diagonal terms, the correction would stay with the one re-observed landmark.Question 11, Gridworld Policies and the Bellman Equation (15 points)
Consider a 3×4 gridworld with 2 terminal states and 1 wall (impassable). The agent has 4 deterministic actions (N, S, E, W). (a) How many deterministic policies exist in this gridworld? Give both the general formula and the numerical answer. (b) In a separate 5×5 gridworld under a uniform random policy with discount , there are two special states A and B. State A teleports the agent to A’ with reward +10; state B teleports to B’ with reward +5. Using the Bellman policy-evaluation equation explain qualitatively why while .Solution
(a) The number of deterministic policies is where is the number of non-terminal states. The grid has cells minus 2 terminal and 1 wall, giving . Hence (A common error is to write , which is incorrect.) (b) Because the teleports are deterministic, the Bellman equation reduces to and . The value of A depends on where the teleport lands, not only on its reward. A’ is on the bottom edge of the grid. From there the random policy often tries to step off the grid, which costs and leaves the agent where it is, so is negative, about in Sutton and Barto’s example. Then . B’ is in the middle row, away from the edges and close enough to A and B to collect some of their rewards later, so . Then . The Bellman equation counts the whole discounted stream of rewards after the teleport, and the stream after A’ is negative while the stream after B’ is positive.Question 12, Return Computation and Discounting (15 points)
An MDP has a single non-terminal state with two actions, and . Action yields rewards , while action yields . Compute and in closed form as functions of the discount , and determine the values of for which is preferred over .Solution
For action : Equivalently, the Bellman recursion gives the same answer. For action : Comparing:- If : , prefer .
- If : they are equal.
- If : , prefer .
Question 13, Maze With an Unknown Goal (20 points)
The maze below has a start S and two terminal cells, both marked H.
- (5 points) What is the expected reward at a terminal state?
- (5 points) What is the optimal policy if the agent may stay put? Write the state values in the white cells.
- (5 points) What is the optimal policy if the agent must move? Write the state values in the white cells.
- (5 points) How many deterministic policies does this gridworld have? Explain.
Solution
1. The expected reward at either H is . 2. Reaching an H is worth 0 in expectation, and every move costs 1, so moving can only lose. The optimal policy is to stay put, and every white cell has value 0. 3. Now the agent must pay −1 per step, and the episode ends only at an H, which is worth 0. The best it can do is reach the nearest H as fast as possible, so each cell’s value is minus its distance to the nearest H:
Question 14, Recycling Robot Optimal Policy (20 points)
The recycling robot has battery stateshigh and low. In high it can search or wait; in low it can search, wait or recharge.
- Searching from
highkeeps the batteryhighwith probability and drains it tolowwith probability . The reward is either way. - Searching from
lowkeeps itlowwith probability , with reward 2. With probability the battery runs flat, the robot is rescued and recharged tohigh, and the reward is . - Waiting keeps the battery state and gives .
- Recharging moves
lowtohighwith reward 0.
- (8 points) Write the Bellman optimality equations for and .
- (12 points) Find the optimal policy and the optimal values, by value iteration or by solving the equations for a guessed policy and checking that it is greedy.
Solution
1. Bellman optimality. 2. Solution. Guess the policyhigh → search, low → recharge. Its values satisfy
so and . The action values are
The guessed actions have the largest in both states, so the policy is greedy with respect to its own values, and it is optimal: and . Value iteration from converges to the same numbers. Searching on a low battery risks the −3 rescue too often to beat recharging.
Question 15, SARSA and Q-Learning Updates (15 points)
A robot is in state with . It takes action , receives reward and lands in state , where and . Its -greedy policy happens to pick as the next action, an exploratory move. Use and .- (5 points) Compute the updated under SARSA.
- (5 points) Compute the updated under Q-learning.
- (5 points) Explain the difference in terms of on-policy and off-policy learning. In a cliff-walking world, which of the two learns the safer path, and why?
Solution
1. SARSA uses the action actually taken next: 2. Q-learning uses the greedy action in the target: 3. On-policy and off-policy. SARSA is on-policy: it learns the value of the -greedy policy it actually follows, including the cost of its exploratory moves. Q-learning is off-policy: it learns the value of the greedy policy, whatever the exploration does. Next to a cliff, random exploratory steps sometimes fall off. SARSA’s values include those falls, so the path it learns stays away from the edge. Q-learning’s values assume the robot will act greedily, so it learns the shortest path along the edge, and while it is still exploring it falls more often. For a physical robot that explores while it learns, the SARSA behavior is usually the one you want.Found an error on this page? Report an issue.

