questions and answers 2025 McGill University
Name:
Student ID number:
• You have 60 minutes to write the exam.
• Hard-copies notes, books, and printed slides are allowed but electronic devices are NOT allowed.
• This exam contains 16 questions on 12 pages.
• 6 multiple-choice questions: circle only ONE correct answer per question.
• 4 multiple-select questions, circle ALL correct answers per question. Scoring: Right minus Wrong.
• 6 short-answer questions: write your answer directly below each question.
• Advice: Try not to spend too much time searching answers through your notes as it will slow you
down and you will not have enough time to complete this exam in 1 hour. Good luck!
1 Multiple-choice questions (30 points)
1. (5 points) Suppose we know that apriori majority of the input features are irrelevant to the target label.
Which method will likely perform the worst when using all features for prediction?
A. KNN
B. Decision tree
C. Logistic regression
Solution: KNN will perform the worst as the distance function takes into account all features. DT
and LR will perform relatively well as they have internal feature selection.
2. (5 points) After training a binary classifier that can produce probability for the positive class, what
threshold guarantees to produce 100% Recall Rate on the test data? Note we set the predicted class
to 1 if the model predicted probability is greater than the threshold.
A. -1
B. 0.01
C. 0.5
D. 1
, E. 2
Solution: For Recall or TPR=TP/(TP+FN), we can have TPR equal to 1 when the threshold is
-1. That is, every data point is predicted to be positive and have zero false negative.
3. (5 points) Suppose you have a hate-speech detection model to detect hate-speech in online com-
ments (hate-speech = 1, normal = 0). Training was successful and you have a pretty good model
which performs much better than random but is less than perfect. You can control the threshold pa-
rameter α such that if you label a comment as hate-speech if p(hate-speech|comment) > α. If you
increase α, what happens to the model’s precision and recall? Select one for each of precision and
recall?
A. recall decreases; precision decreases
B. recall decreases; precision increases
C. recall increases; precision decreases
D. recall increases; precision increases
Solution: Increasing α increases the number of negatives, both TN and FN, and decreases the
number of positives, both TP and FP, if the model does better than chance FP should be reduces
increase. 2.5 pts for each.
4. (5 points) What loss does the estimate ŵ = (X⊤X)−1X⊤y minimize?
qΣ
A. J(w) = (n) − ŷ (n) ) 2 , where yˆ(n) = x(n)w
n(y
Σ
B. J(w) = n |y(n) − ŷ (n) |, where yˆ(n) = x(n)w
Σ
C. J(w) = n(y(n) − ŷ (n) ) 2 , where yˆ(n) = x(n)w
Σ
D. J(w) = n −y(n) log yˆ(n) − (1 − y(n)) log(1 − ŷ (n) ), where yˆ(n) = 1+exp(−x
1 (n)
w)
5. (5 points) Which of the following methods can only be trained using gradient decent?
A. Decision tree
B. Linear regression
C. Linear regression with basis transformed features
D. Logistic regression
Solution: DT are not trained by GD. Linear regression and linear regression with basis-transformed
feature can be fit by analytical solution. Only Logistic regression can only be trained with GD.
6. (5 points) For C = 3 classes and D = 2 features, what is the class probabilities for input x = [1 0],
when using a multiclass regression with the following weights (assuming natural log ln):
0 ln 3 0
W =
ln 3 0 ln 4
A. [1/3, 1/3, 1/3]