Topics

A random question


Questions

Showing 799 of 799 questions. You have marked 0 of 799 done. Expand all | Collapse all | Reset

Level: L1 = Beginner, L2 = Elementary, L3 = Intermediate, L4 = Advanced, L5 = Expert
Length: One-liner, Short, Medium, Long
Nature: Th = Theoretical, Mat = Mathematical, Th+Mat = Both

Done#QuestionTopicLevelLengthNature
1
What is the bias–variance tradeoff?

Read the answer

Foundations L1 Short Th
2
Why must you never tune hyperparameters on the test set?

Read the answer

Foundations L1 One-liner Th
3
What is empirical risk minimisation?

Read the answer

Foundations L1 One-liner Th
4
What is the difference between a parametric and a non-parametric model, with one example of each?

Read the answer

Foundations L1 Short Th
5
What is the difference between semi-supervised learning and self-supervised learning?

Read the answer

Foundations L1 One-liner Th
6
When would you use online learning instead of batch (offline) learning, and what is the main trade-off?

Read the answer

Foundations L1 Short Th
7
What is inductive bias in machine learning, and why is it necessary for generalisation?

Read the answer

Foundations L1 One-liner Th
8
What are the three mechanisms of missing data — MCAR (Missing Completely At Random), MAR (Missing At Random) and MNAR (Missing Not At Random) — and what is an everyday example of each?

Read the answer

Foundations L1 Short Th
9
What is data leakage, and what are two examples you could plausibly meet in practice?

Read the answer

Foundations L2 Short Th
10
Your model has 2% training error and 25% validation error. What is the problem, and what would you try? What if instead both errors were about 24%?

Read the answer

Foundations L2 Short Th
11
What is k-fold cross-validation, how do the bias and the computation cost of the error estimate change with k, and why are k=5 and k=10 the usual choices?

Read the answer

Foundations L2 Medium Th+Mat
12
Data are spread uniformly in the unit hypercube [0,1]d. A nearest-neighbour method uses a small cube around each point that contains 1% of the data. What edge length must that cube have for d=1, 10 and 100, and what does this say about local methods in high dimensions?

Read the answer

Foundations L2 Medium Th+Mat
13
What is pool-based active learning, and if a three-class classifier outputs predicted probabilities (0.50,0.45,0.05), (0.40,0.30,0.30) and (0.85,0.10,0.05) for unlabelled points A, B and C, which point do least-confidence and margin sampling query first?

Read the answer

Foundations L2 Short Th+Mat
14
Suppose a concept is a conjunction of three attributes (Sky,Temp,Wind) with Sky∈{Sunny,Rainy}, Temp∈{Warm,Cold} and Wind∈{Strong,Weak}. Given the training examples (Sunny,Warm,Strong,+), (Sunny,Warm,Weak,+), (Rainy,Cold,Strong,−) and (Sunny,Cold,Strong,+), what sequence of hypotheses does the Find-S algorithm produce, and what assumptions does it rely on?

Read the answer

Foundations L2 Medium Th+Mat
15
Consider inputs with d Boolean features x∈{0,1}d. How many distinct Boolean functions exist in total, how many semantically distinct conjunctions of literals (allowing unnegated literals xi, negated literals ¬xi, or omitting feature i) exist, and what are both counts for d=3?

Read the answer

Foundations L2 Short Th+Mat
16
You fit two nested Gaussian regression models on n=100 data points: Model A has kA=3 parameters and maximised log-likelihood ℓA=−120, while Model B has kB=6 parameters and ℓB=−114. Using AIC=2k−2ℓ and BIC=kln⁡n−2ℓ (lower is better), which model does each criterion select?

Read the answer

Foundations L2 Medium Mat
17
Compute both the z-score standardised values (using population standard deviation) and the min-max scaled values on [0,1] for the feature vector [0,8,18,50]. What drawback of min-max scaling does this example reveal, and which ML algorithms do or do not require feature scaling?

Read the answer

Foundations L2 Medium Th+Mat
18
For a d-dimensional input vector x∈Rd, a full polynomial expansion of degree at most p (including the constant bias term 1) has D=(d+pp) features. What is D when d=10 and p=3, and what happens to unregularised least-squares linear regression if you only have n=200 training examples?

Read the answer

Foundations L2 Short Mat
19
What is the difference between a restriction (language) bias and a preference (search) bias, with one standard ML algorithm as an example of each, and why is a preference bias usually safer in practice?

Read the answer

Foundations L2 Short Th
20
Cross-validation for polynomial regression of degree 1 to 6 gives these mean errors (standard error in brackets): degree 1: 0.300 (0.030); degree 2: 0.180 (0.020); degree 3: 0.115 (0.020); degree 4: 0.100 (0.020); degree 5: 0.095 (0.025); degree 6: 0.110 (0.030). Which degree does the one-standard-error rule choose, and why prefer it to the plain minimum?

Read the answer

Foundations L2 Medium Th+Mat
21
How do you derive the bias–variance decomposition of the expected squared error E[(y−f^(x))2], where f^ is the model fitted to a random training set?

Read the answer

Foundations L3 Long Mat
22
For a single weight w and a number z, solve min⁡w12(w−z)2+λ∣w∣ and min⁡w12(w−z)2+λ2w2. Why does this show that L1 regularisation gives sparse solutions and L2 does not?

Read the answer

Foundations L3 Medium Th+Mat
23
Why is the predictor that minimises the expected squared loss the conditional mean E[Y∣X=x], and why is the classifier that minimises the expected 0-1 loss arg⁡max⁡kP(Y=k∣X=x)?

Read the answer

Foundations L3 Medium Mat
24
Consider a d-dimensional unit-radius hypersphere inscribed inside the hypercube [−1,1]d. Using the hypersphere volume Vd(r)=πd/2Γ(d/2+1)rd (where Γ(k+1)=k! for an integer k), what fraction of the hypercube's volume does the sphere occupy for d=2, 4 and 10, and what does this imply about uniformly sampled points in high dimensions?

Read the answer

Foundations L3 Medium Mat
25
In positive-unlabelled (PU) learning, every labelled example is positive (s=1  ⟹  y=1), and each true positive is labelled independently of its features with constant probability c=P(s=1∣y=1,x)=P(s=1∣y=1)>0. How do you express the true posterior P(y=1∣x) in terms of the observed-label posterior P(s=1∣x) and c, and how can c be estimated from a held-out set of labelled positives?

Read the answer

Foundations L3 Medium Mat
26
Consider a conjunctive hypothesis space over three binary attributes A1,A2,A3∈{1,2}. What sequences of specific boundaries S and general boundaries G does the candidate-elimination algorithm produce on the four examples (1,1,1,+), (2,2,2,−), (1,2,1,+) and (2,1,1,−), and which hypotheses remain in the final version space?

Read the answer

Foundations L3 Long Th+Mat
27
How do AIC and BIC compare in terms of their complexity penalties and their large-sample behaviour (n→∞) regarding model-selection consistency versus predictive efficiency, and when would you prefer one over the other?

Read the answer

Foundations L3 Medium Th
28
How does the minimum description length (MDL) principle turn model selection into a data-compression problem, and how does a two-part MDL code connect mathematically to MAP estimation and BIC?

Read the answer

Foundations L3 Medium Th+Mat
29
For a categorical variable with K categories, why does keeping all K one-hot indicator columns together with an intercept make unregularised linear regression singular, why does ridge regression remove this singularity, and what precaution is required when using target encoding instead?

Read the answer

Foundations L3 Medium Th+Mat
30
Suppose a feature X has mean μ and variance σ2, and each entry is missing independently with probability p (MCAR). If missing entries are replaced by μ, what are the mean and variance of the imputed feature Ximp, how does this affect Corr⁡(Ximp,Y) with a target Y, and why is adding a binary missingness indicator often better?

Read the answer

Foundations L3 Medium Mat
31
Let X,Z∼N(0,Id) be two independent d-dimensional standard Gaussian vectors. Compute E[∥X−Z∥22] and SD⁡(∥X−Z∥22) as functions of d. Why does the ratio SD⁡(∥X−Z∥22)/E[∥X−Z∥22] tend to 0 as d→∞, and how does this break distance-based methods like k-NN?

Read the answer

Foundations L3 Medium Mat
32
A colleague standardises all features using the mean and standard deviation of the entire dataset, selects the 20 features most correlated with the label y, and then runs 5-fold cross-validation to tune and report the accuracy of a classifier. Is the resulting CV accuracy unbiased, how do you fix the pipeline, and how badly can full-dataset feature screening distort pure random noise?

Read the answer

Foundations L3 Medium Th+Mat
33
When data are missing at random (MAR), suppose an outcome Y is observed only when R=1, where the observation probability π(X)=P(R=1∣X,Y)=P(R=1∣X)>0 depends only on fully observed covariates X. Why is the unweighted complete-case sample mean biased for E[Y], and how do you prove that the inverse-probability-weighted (IPW) estimator μ^IPW=1n∑i=1nRiYiπ(Xi) is unbiased?

Read the answer

Foundations L3 Medium Mat
34
Suppose the m fold errors in cross-validation each have variance σ2 and every pair has correlation ρ. Derive the variance of their average. Evaluate it for m=10 and ρ=0.1, 0.5, 0.9 with σ2=1, and explain why this is used to argue that leave-one-out has high variance?

Read the answer

Foundations L3 Medium Mat
35
Derive the number of monomial features of degree at most p in d input variables, using a stars-and-bars counting argument. Check it for d=2, p=2 by listing the terms, then evaluate it for d=100, p=3 and explain why a polynomial kernel avoids building these features?

Read the answer

Foundations L3 Medium Mat
36
What does the no-free-lunch theorem say, and what does it imply for choosing a learning algorithm in practice?

Read the answer

Foundations L4 Medium Th
37
For least-squares linear regression with hat matrix H=X(X⊤X)−1X⊤, how do you prove that the leave-one-out residual is yi−y^(−i)=yi−y^i1−hii, so that leave-one-out cross-validation needs only one fit?

Read the answer

Foundations L4 Long Mat
38
Does Occam's razor claim that nature itself prefers simple laws, or is there a formal statistical reason to prefer simpler hypotheses that fit the training data — and when can counting parameters mislead you?

Read the answer

Foundations L4 Medium Th
39
Suppose you evaluate M hyperparameter settings using a single 5-fold cross-validation loop and report the minimum CV error min⁡merr^m as your model's expected generalisation error. Why is this estimate optimistically biased, how does nested cross-validation eliminate this selection bias, and how many model fits does a Kout-outer, Kin-inner nested CV over G hyperparameter candidates require for Kout=5, Kin=4 and G=10 (including refitting)?

Read the answer

Foundations L4 Medium Th+Mat
40
Suppose you use a train/validation/test split to choose among M=100 candidate models (with 0–1 loss) on a validation set of size nval. Using Hoeffding's inequality and the union bound, how large must nval be so that simultaneously all M validation errors are within ϵ=0.05 of their true errors with probability at least 95%, why do large datasets not need 20\% validation splits, and should you retrain on train+validation before testing?

Read the answer

Foundations L4 Medium Th+Mat
41
A binary classification population has positive-class proportion p∈(0,1), and a fixed classifier has true error rates e1 on positives and e0 on negatives. How do the bias and variance of the validation error estimate compare between m i.i.d. validation draws (simple random sampling) and m stratified validation draws (m1=mp positives and m0=m(1−p) negatives, assumed integers), and when does stratification reduce variance the most?

Read the answer

Foundations L4 Long Mat
42
How is Schwarz's Bayesian Information Criterion BIC=kln⁡n−2ℓ(θ^MLE) derived from the Bayesian marginal likelihood p(D∣M)=∫Rkp(D∣θ,M) p(θ∣M) dθ using Laplace's approximation?

Read the answer

Foundations L5 Long Mat
43
Consider fixed-design regression yi=μi+εi (i=1,…,n) with independent noise E[εi]=0 and Var⁡(εi)=σ2, and let y^=f(y) be any fitted predictor. How do you prove that the expected in-sample optimism equals E[Errin]−E[err‾]=2n∑i=1nCov⁡(y^i,yi), and how does this simplify to 2σ2dn for rank-d ordinary least squares (giving Mallows' Cp)?

Read the answer

Foundations L5 Long Mat
44
What do the expected value and the variance (or standard deviation) of a random variable measure intuitively, and what are their values for a game that pays ₹10 with probability 0.2 and ₹0 otherwise?

Read the answer

Probability and statistics L1 Short Th+Mat
45
What do covariance and correlation tell you about two variables, and why is correlation usually easier to interpret than covariance?

Read the answer

Probability and statistics L1 Short Th
46
Why is P(A∣B) generally not equal to P(B∣A), and how does Bayes' rule connect the two, with a small example?

Read the answer

Probability and statistics L1 Short Th+Mat
47
If two events A and B both have positive probability and are mutually exclusive, can they be independent?

Read the answer

Probability and statistics L1 One-liner Th
48
Does E[X+Y]=E[X]+E[Y] need X and Y to be independent? What about Var(X+Y)=Var(X)+Var(Y)?

Read the answer

Probability and statistics L1 Short Th+Mat
49
In statistics and machine learning, what is the difference between probability and likelihood, and what is the idea behind maximum likelihood estimation (MLE)? If you toss a coin 10 times and get 7 heads, what is the MLE of its heads probability?

Read the answer

Probability and statistics L1 Short Th+Mat
50
Can a probability density function take values greater than 1?

Read the answer

Probability and statistics L1 One-liner Th
51
What are the mean and variance of a Poisson(λ) random variable, and what kind of data is it used to model?

Read the answer

Probability and statistics L1 Short Th
52
In a hypothesis test, what are a type I error, a type II error and the power, and how do they appear in a spam filter that tests "this email is spam"?

Read the answer

Probability and statistics L1 Short Th
53
A test gives p=0.03. Is it true that "there is a 3% probability the null hypothesis is true", and why?

Read the answer

Probability and statistics L1 Short Th
54
Can an estimator be unbiased but not consistent, and can it be biased but consistent? What is one example of each?

Read the answer

Probability and statistics L1 Short Th
55
A 95% confidence interval for a model's accuracy is [0.82,0.88]. Is it true that the true accuracy lies in this interval with probability 0.95, and why?

Read the answer

Probability and statistics L1 Short Th
56
Using X∼Uniform(−1,1) and Y=X2, how can you show that two random variables can be uncorrelated but not independent?

Read the answer

Probability and statistics L2 Short Th+Mat
57
A disease affects 1% of people. A test detects it 99% of the time when it is present, and gives a false positive 5% of the time when it is absent. If a person tests positive, what is the probability that they have the disease?

Read the answer

Probability and statistics L2 Short Mat
58
What does the central limit theorem say? If per-example test losses have mean μ and standard deviation σ=10, roughly what is the probability that their average over n=100 test examples differs from μ by more than 2?

Read the answer

Probability and statistics L2 Short Th+Mat
59
A bootstrap sample of size n is drawn with replacement from n data points. What is the probability that a given point is left out, what does it tend to as n→∞, and how is this used?

Read the answer

Probability and statistics L2 Short Th+Mat
60
A coin's probability of heads θ has prior Beta(2,2), and you observe 7 heads in 10 tosses. What is the posterior, and how do the MLE, the MAP estimate and the posterior mean compare?

Read the answer

Probability and statistics L2 Medium Mat
61
A bag holds 4 red and 6 blue balls. You draw 3 balls at random without replacement. What is the probability that exactly 2 are red?

Read the answer

Probability and statistics L2 Short Mat
62
Machines A, B and C produce 50%, 30% and 20% of a factory's items. Their defect rates are 1%, 2% and 3%. An item is picked at random and found defective. What is the probability that it came from machine C?

Read the answer

Probability and statistics L2 Short Mat
63
A classifier errs independently on each test example with probability 0.1. On 20 test examples, what is the probability of at most one error?

Read the answer

Probability and statistics L2 Short Mat
64
A server's waiting time T (in minutes) is exponential with mean 5. Given that you have already waited 3 minutes, what is the probability you wait more than 8 minutes in total? Why is the answer what it is?

Read the answer

Probability and statistics L2 Short Th+Mat
65
Two binary variables X and Y have joint probabilities P(0,0)=0.3, P(0,1)=0.2, P(1,0)=0.1, P(1,1)=0.4. What are Cov(X,Y) and the correlation ρ?

Read the answer

Probability and statistics L2 Medium Mat
66
If X∼N(2,9) and Y=3X−1, what is the distribution of Y, and what is P(Y>14), given Φ(1)≈0.8413?

Read the answer

Probability and statistics L2 Short Mat
67
A model's latency has a known standard deviation of 12 ms. On n=36 requests the mean latency is 54 ms. Test H0:μ=50 against H1:μ≠50 with a z-test at the 5% level. What is the p-value, and what is your conclusion?

Read the answer

Probability and statistics L2 Medium Mat
68
A non-negative random variable X (say, the response time of a server) has mean 50 and variance 25. Using Markov's and Chebyshev's inequalities, what bounds do you get for P(X≥80) and for P(∣X−50∣≥15), and why is one bound much tighter?

Read the answer

Probability and statistics L2 Medium Mat
69
Let p=(12,14,14) and q=(13,13,13) on three outcomes. Compute H(p), the cross-entropy H(p,q), and both DKL(p∥q) and DKL(q∥p) in bits. What do the numbers show?

Read the answer

Probability and statistics L2 Medium Mat
70
Two binary variables X and Y have the joint distribution P(0,0)=P(1,1)=0.4 and P(0,1)=P(1,0)=0.1. What is the mutual information I(X;Y) in bits, and what would it be if X and Y were independent?

Read the answer

Probability and statistics L2 Medium Mat
71
A classifier's accuracy is measured on n=16 independent random splits, giving a sample mean of 72% and sample standard deviation of 8%. Give a 95% confidence interval for the true mean accuracy, using t15, 0.975=2.131. Why not use 1.96?

Read the answer

Probability and statistics L2 Short Mat
72
You run m=20 independent hypothesis tests, all with true null hypotheses, each at level α=0.05. What is the probability of at least one false positive? What level per test does the Bonferroni correction use, and what family-wise error rate does that achieve?

Read the answer

Probability and statistics L2 Short Mat
73
A die is rolled 60 times and faces 1 to 6 appear 5,8,9,8,10,20 times. The critical value for 5 degrees of freedom is 11.07. Is the die fair according to a chi-squared goodness-of-fit test at the 5% level?

Read the answer

Probability and statistics L2 Medium Mat
74
In a sample of 100 emails, a rule fires on 40 of them. Of the 50 emails that are spam, the rule fires on 30. The 50 non-spam emails give the other 10 firings. The critical value for 1 degree of freedom at 5% is 3.84. According to a chi-squared test of independence, are the rule and the spam label independent?

Read the answer

Probability and statistics L2 Medium Mat
75
Model A and model B are compared on the same 5 cross-validation folds. A's accuracy minus B's accuracy, in percentage points, is 2,1,3,0,4. Run a paired t-test of "no difference" at 5% (the two-sided critical value for 4 degrees of freedom is 2.776). Why should you be careful with this test?

Read the answer

Probability and statistics L2 Medium Th+Mat
76
A classifier wrongly flags a transaction with probability p=0.003, independently, and it scores n=1000 transactions. How do you approximate the probability of at most 2 false flags, and why does the approximation work?

Read the answer

Probability and statistics L2 Medium Mat
77
You pick door 1 out of three, one of which hides a car. The host, who knows where the car is, always opens a different door that has a goat and offers you a switch. He opens door 3. Using Bayes' rule, what is the probability that the car is behind door 2, and why is the host's knowledge important?

Read the answer

Probability and statistics L2 Medium Mat
78
What is the difference between MLE and MAP estimation, and how can you show that L2-regularised linear regression is MAP with a Gaussian prior?

Read the answer

Probability and statistics L3 Medium Th+Mat
79
Is KL divergence a distance, and why is minimising cross-entropy the same as maximum likelihood?

Read the answer

Probability and statistics L3 Medium Th+Mat
80
What are the maximum likelihood estimates of μ and σ2 from independent samples x1,…,xn of N(μ,σ2), and how do you derive them?

Read the answer

Probability and statistics L3 Medium Mat
81
Why is 1n∑i(xi−xˉ)2 a biased estimator of σ2, and why does dividing by n−1 instead remove the bias?

Read the answer

Probability and statistics L3 Medium Mat
82
You can draw samples from Uniform(0,1), and you have Φ−1, the inverse CDF of the standard normal N(0,1). How do you generate samples from a 2D normal distribution N(μ,Σ), and how do you show that they have the right mean and covariance?

Read the answer

Probability and statistics L3 Medium Th+Mat
83
Two classifiers A and B are evaluated on the same 1,000 test examples. A is right and B wrong on 30 examples; B is right and A wrong on 15. Is A significantly better at the 5% level, and what does the p-value mean here?

Read the answer

Probability and statistics L3 Medium Th+Mat
84
Counts x1,…,xn are independent Poisson(λ) samples. Derive the MLE of λ. For the counts 2,0,3,1,4, what is λ^ and the probability that the next count is zero?

Read the answer

Probability and statistics L3 Medium Mat
85
The number of attempts K until the first success has P(K=k)=(1−p)k−1p, for k=1,2,…. You observe 4 independent runs needing 3, 1, 4 and 2 attempts. How do you derive the MLE of p, and what is its value?

Read the answer

Probability and statistics L3 Medium Mat
86
A website gets N∼Poisson(λ) visitors per hour. Each visitor independently spends an amount Xi with mean μ and variance σ2. Using the laws of total expectation and total variance, what are the mean and variance of the hourly revenue Y=∑i=1NXi? What are the values for λ=10, μ=3, σ2=4?

Read the answer

Probability and statistics L3 Medium Mat
87
Event counts are Poisson(λ). You use a Gamma prior with shape α=2 and rate β=1, whose density is ∝λα−1e−βλ. You observe counts 3,5,4. What are the posterior, its mean, the MAP estimate and the MLE?

Read the answer

Probability and statistics L3 Medium Mat
88
If U∼Uniform(0,1) and λ>0, show that Y=−ln⁡(U)/λ is exponential with rate λ. How does this give a way to sample, and what is Y for λ=2, U=0.3?

Read the answer

Probability and statistics L3 Medium Mat
89
(X1,X2) is bivariate Gaussian with means (1,2) and covariance (4223). Why is X1∣X2=x2 Gaussian, and what are its mean and variance at x2=3?

Read the answer

Probability and statistics L3 Medium Mat
90
A die-like variable takes values in {1,…,K} with probabilities π1,…,πK. Given nk observations of category k (total n), derive the MLE of π with a Lagrange multiplier. For counts (30,50,20), what is it?

Read the answer

Probability and statistics L3 Medium Mat
91
Why is the Bernoulli distribution with parameter θ in the exponential family? What are its natural parameter, sufficient statistic and log-partition function, and why does the derivative of the log-partition function give the mean?

Read the answer

Probability and statistics L3 Medium Mat
92
A variable is drawn from N(0,1) with probability 0.3 and from N(4,2) (variance 2) with probability 0.7. Use the law of total variance to find its mean and variance. Why is the variance more than the weighted average of the two component variances?

Read the answer

Probability and statistics L3 Medium Mat
93
Data x1,…,xn are i.i.d. N(μ,σ2) with known σ2 and prior μ∼N(μ0,τ2). What is the posterior of μ, and what is it for μ0=0, τ2=4, σ2=1, n=4, xˉ=2? Why is the MAP estimate a ridge-type shrinkage of xˉ?

Read the answer

Probability and statistics L3 Long Mat
94
Is it true that if X and Y are each Gaussian and uncorrelated, then they are independent, and what construction justifies your answer?

Read the answer

Probability and statistics L3 Medium Th+Mat
95
Samples x1,…,xn are i.i.d. Uniform(0,θ). What is the MLE of θ, why is it biased, and what is an unbiased correction? What are both estimates for the data 1.2, 0.7, 2.9, 2.1?

Read the answer

Probability and statistics L3 Long Mat
96
For n i.i.d. Bernoulli(p) samples, derive the Fisher information, state the Cramér–Rao bound, and show that the sample mean Xˉ attains it. What does the bound say numerically for p=0.3 and n=50?

Read the answer

Probability and statistics L3 Medium Mat
97
For i.i.d. N(μ,σ2) data, consider σ^c2=c∑i=1n(Xi−Xˉ)2. Which c gives the smallest mean squared error, and how do the unbiased choice c=1n−1 and the MLE c=1n compare for n=10?

Read the answer

Probability and statistics L3 Long Mat
98
You test H0:μ=0 against H1:μ>0 with a one-sided z-test at α=0.05, where σ=1 is known and n=25. Use z0.95=1.645 and z0.80=0.8416. If the true mean is 0.5, what is the power? How large must n be for 80% power?

Read the answer

Probability and statistics L3 Medium Mat
99
For the sample {2,4,6,8,10}, what is the exact bootstrap variance and standard error of the sample mean, and how does it compare with the usual s/n? How would you get a 95% percentile bootstrap interval in practice?

Read the answer

Probability and statistics L3 Medium Th+Mat
100
A fair coin is tossed n=100 times and p^ is the fraction of heads. Compare the Chebyshev bound, the Hoeffding bound and the CLT approximation for P(∣p^−0.5∣≥0.1). The exact value is about 0.057. What do the comparisons teach?

Read the answer

Probability and statistics L3 Medium Mat
101
Eight tests give the p-values 0.001,0.008,0.012,0.024,0.041,0.049,0.20,0.60. Which hypotheses are rejected by (a) Bonferroni, (b) Holm and (c) Benjamini–Hochberg at level 0.05, and what error rate does each control?

Read the answer

Probability and statistics L3 Long Th+Mat
102
In 100 tosses of a coin, 60 heads appear. What is the result of a likelihood-ratio test of H0:p=0.5 at the 5% level, using Wilks' theorem (critical value 3.84), and how does it compare with the z-test?

Read the answer

Probability and statistics L3 Medium Mat
103
For a bivariate Gaussian (X,Y) with correlation ρ, show that I(X;Y)=−12ln⁡(1−ρ2). What is the value for ρ=0.8, and what happens as ρ→0 and ρ→1?

Read the answer

Probability and statistics L3 Long Mat
104
n keys are hashed independently and uniformly into m slots. How do you find the probability that at least two keys share a slot, and how large must n be for this probability to pass 12 when m=365 (the birthday problem)?

Read the answer

Probability and statistics L3 Medium Mat
105
Three independent jobs have exponential run times with rates λ1=1, λ2=2 and λ3=3 per hour. What is the distribution of the time until the first job finishes, and what is the probability that job 1 is the first to finish?

Read the answer

Probability and statistics L3 Medium Mat
106
Word counts in a class for a 4-word vocabulary are (3,1,0,0). With a symmetric Dirichlet(α,…,α) prior on the word probabilities θ, what is the posterior, and how does the posterior mean give add-α (Laplace) smoothing as used in naive Bayes?

Read the answer

Probability and statistics L3 Medium Mat
107
How do you prove the weak law of large numbers for i.i.d. random variables with mean μ and finite variance σ2, using Chebyshev's inequality? If σ2=4, how many samples guarantee P(∣Xˉn−μ∣≥0.5)≤0.01?

Read the answer

Probability and statistics L3 Medium Mat
108
Each draw picks one of n classes uniformly at random with replacement. What is the expected number of draws until every class has appeared at least once, and what is it for n=6 and for n=100?

Read the answer

Probability and statistics L3 Medium Mat
109
Show that an estimator whose bias and variance both tend to 0 is consistent. For i.i.d. X1,…,Xn∼N(μ,σ2) with σ2=4, what are an unbiased but inconsistent and a biased but consistent estimator of μ, and for n=10, how do the mean squared errors (MSE) of the divide-by-n and divide-by-(n−1) estimators of σ2 compare?

Read the answer

Probability and statistics L3 Medium Mat
110
For a natural exponential family p(x∣η)=h(x)exp⁡(η T(x)−A(η)), why is A′(η)=E[T(X)] and A′′(η)=Var(T(X)), and hence why does the MLE satisfy A′(η^)=1n∑iT(xi)? What does this give for exponential data 2,5,3,6,4?

Read the answer

Probability and statistics L4 Long Mat
111
Let x=(xa,xb)∼N(μ,Σ) with partitions μ=(μa,μb) and Σ=(ΣaaΣabΣbaΣbb). How do you derive the conditional distribution of xa given xb by completing the square with the precision matrix Λ=Σ−1?

Read the answer

Probability and statistics L4 Long Mat
112
Let U1,U2 be independent Uniform(0,1). Define R=−2ln⁡U1, Θ=2πU2, X=Rcos⁡Θ and Y=Rsin⁡Θ. Why are X and Y independent N(0,1) variables, and what are (X,Y) for U1=0.5, U2=0.25?

Read the answer

Probability and statistics L4 Long Mat
113
Lifetimes X1,…,Xn are i.i.d. exponential with rate λ, with density λe−λx. What are the MLE and its Fisher information? For n=50 and xˉ=2, what is a 95% Wald interval for λ, and what does the delta method give for the mean lifetime 1/λ?

Read the answer

Probability and statistics L4 Long Mat
114
For i.i.d. samples from Uniform(0,θ), compare 2Xˉ and the sample maximum M (and its rescaled version n+1nM) as estimators of θ in terms of bias, variance and MSE. Why does the Cramér–Rao bound not apply?

Read the answer

Probability and statistics L4 Long Mat
115
Let ε1,…,εn be independent with P(εi=±1)=12. Prove that P(∑iεi≥t)≤e−t2/(2n) using the moment generating function. What is the bound for n=100 and t=20, and how does it compare with the exact tail probability?

Read the answer

Probability and statistics L4 Long Mat
116
Is it true that averaging more samples always makes the sample mean more concentrated? For i.i.d. standard Cauchy samples with density f(x)=1π(1+x2), why do the law of large numbers and the central limit theorem fail?

Read the answer

Probability and statistics L4 Long Th+Mat
117
What is the Cramér–Rao lower bound for an unbiased estimator of a scalar parameter θ, how do you prove it, and how does it show that the sample mean is the best unbiased estimator of a Bernoulli parameter p?

Read the answer

Probability and statistics L5 Long Mat
118
Let X1,…,Xn be i.i.d. N(μ,σ2). Why are the sample mean Xˉ and sample variance S2=1n−1∑i(Xi−Xˉ)2 independent, and why is (n−1)S2/σ2∼χn−12? What is Var(S2) for n=5?

Read the answer

Probability and statistics L5 Long Mat
119
For a smooth parametric family pθ, show that DKL(pθ∥pθ+δ)=12I(θ)δ2+O(δ3) for small δ, where I(θ) is the Fisher information. How do you check it for N(μ,σ2) with σ known?

Read the answer

Probability and statistics L5 Long Mat
120
State and prove the Neyman–Pearson lemma for testing a simple H0:f0 against a simple H1:f1. How do you show that for N(μ,σ2) data with known σ, the test "reject when xˉ>c" is most powerful for μ0 against μ1>μ0?

Read the answer

Probability and statistics L5 Long Mat
121
What does the dot product of two vectors measure, and what does it mean when the dot product is zero? What is a⋅b for a=(2,1) and b=(1,−2)?

Read the answer

Linear algebra and optimisation L1 Short Th+Mat
122
What is a vector norm, how do the ℓ1 (Manhattan) norm and the ℓ2 (Euclidean) norm differ geometrically, and what are both norms for v=(3,−4)⊤?

Read the answer

Linear algebra and optimisation L1 Short Th+Mat
123
What is the gradient of a function of two variables, and what does it tell you? What is the gradient of f(x,y)=x2+y2 at the point (3,4)?

Read the answer

Linear algebra and optimisation L1 Short Th+Mat
124
Why does gradient descent step in the direction −∇f(x)?

Read the answer

Linear algebra and optimisation L1 One-liner Th
125
How do full-batch gradient descent, stochastic gradient descent (SGD) and mini-batch gradient descent differ in how they compute each parameter update, and why is mini-batch SGD the standard choice in machine learning (ML)?

Read the answer

Linear algebra and optimisation L1 Short Th
126
What is constrained optimisation in plain words, and why does a constraint change where the best answer is? Use a farmer who has 20 m of fencing and wants the biggest rectangular field?

Read the answer

Linear algebra and optimisation L1 Short Th
127
What are an eigenvector and an eigenvalue of a square matrix intuitively, why are they useful, and how do you check that v=(1,1)⊤ is an eigenvector of A=(3113) and find its eigenvalue?

Read the answer

Linear algebra and optimisation L1 Short Th+Mat
128
What do span, linear independence and rank tell you about the columns of a feature matrix X∈Rn×d?

Read the answer

Linear algebra and optimisation L1 Short Th
129
What is an orthogonal matrix geometrically, and what properties of vectors does multiplying by one preserve?

Read the answer

Linear algebra and optimisation L1 One-liner Th
130
What is the null space (kernel) of a matrix A, and what does a non-trivial null space mean for the linear system Ax=b?

Read the answer

Linear algebra and optimisation L1 One-liner Th
131
What does it mean for a symmetric matrix A to be positive definite rather than positive semidefinite, and what shape does x⊤Ax have in each case?

Read the answer

Linear algebra and optimisation L1 Short Th+Mat
132
What is a convex set, what is a convex function, and what does the bowl shape of a convex problem mean for finding a minimum?

Read the answer

Linear algebra and optimisation L1 Short Th
133
What is a saddle point on a loss surface, and intuitively why are saddle points far more common than local minima in high-dimensional neural networks?

Read the answer

Linear algebra and optimisation L1 One-liner Th
134
Why do training pipelines often start with a learning-rate warmup and then decay the learning rate over time?

Read the answer

Linear algebra and optimisation L1 Short Th
135
Why is every covariance matrix symmetric positive semidefinite, and when is it singular?

Read the answer

Linear algebra and optimisation L2 Short Th+Mat
136
You minimise f(x,y)=4x2+2y2+5 by gradient descent with a fixed learning rate η, starting from (x0,y0)=(−1,2). (a) What is the largest learning rate for which gradient descent converges? (b) What do the iterates do at that learning rate, and above it?

Read the answer

Linear algebra and optimisation L2 Medium Mat
137
A 4×6 matrix A has a null space of dimension 3, and b∈R4 lies in the column space of A. What is the rank of A, how many free parameters does the solution to Ax=b have, and could Ax=c have a solution for every c∈R4?

Read the answer

Linear algebra and optimisation L2 Short Mat
138
For which values of k does the linear system x+y+z=2, 2x+3y+2z=5, 2x+3y+(k2−2)z=k+3 have (a) a unique solution, (b) infinitely many solutions and (c) no solution?

Read the answer

Linear algebra and optimisation L2 Medium Mat
139
A 3×3 matrix A has trace 6, determinant 6, and one eigenvalue equal to 1. What are its other two eigenvalues, and what are the trace and determinant of B=A2−2A?

Read the answer

Linear algebra and optimisation L2 Short Mat
140
What are the eigenvalues and unit eigenvectors of A=(4213), and how do you use them to compute A4(30) without multiplying matrices four times?

Read the answer

Linear algebra and optimisation L2 Medium Mat
141
For B=(221−1), how do you compute the Frobenius norm ∥B∥F, the induced ℓ1 norm ∥B∥1, the induced ℓ∞ norm ∥B∥∞ and the spectral norm ∥B∥2?

Read the answer

Linear algebra and optimisation L2 Medium Mat
142
How do you compute the LU factorisation (with unit diagonal in L) of A=(21−1450−2811), use it to solve Ax=(−1−112), and explain when row pivoting (PA=LU) is needed?

Read the answer

Linear algebra and optimisation L2 Medium Mat
143
Geometrically, why must the gradient of the objective be parallel to the gradient of the constraint at a smooth optimum of min⁡xf(x) subject to g(x)=0?

Read the answer

Linear algebra and optimisation L2 Short Th
144
Starting from w0=3, perform two steps of gradient descent on f(w)=2(w−1)2+5 with learning rate η=0.4. Does the iterate overshoot the minimum, and do the iterates still converge?

Read the answer

Linear algebra and optimisation L2 Medium Mat
145
Minimise f(w)=12w2 starting from w0=4 with initial velocity v0=0, learning rate η=0.25 and momentum β=0.5. Compute w1 and w2 using (a) heavy-ball momentum (vt+1=βvt−η∇f(wt), wt+1=wt+vt+1) and (b) Nesterov accelerated gradient (vt+1=βvt−η∇f(wt+βvt), wt+1=wt+vt+1). How do the two updates differ?

Read the answer

Linear algebra and optimisation L2 Medium Mat
146
How does RMSProp fix AdaGrad's diminishing step size, and for f(w)=12w2 starting from w0=4 with s0=0, η=1 and ϵ=0, what are w1 and w2 under (a) AdaGrad (st=st−1+gt2) and (b) RMSProp (st=ρst−1+(1−ρ)gt2) with ρ=0.75?

Read the answer

Linear algebra and optimisation L2 Medium Mat
147
For what values of the constant c is f(x,y)=2x2+2cxy+8y2−12x−24y convex, for what values is it strictly convex, and what is its minimum when c=2?

Read the answer

Linear algebra and optimisation L2 Medium Mat
148
Using Lagrange multipliers, find the point on the line 2x+y=5 that minimises f(x,y)=x2+y2, and what is the minimum value?

Read the answer

Linear algebra and optimisation L2 Medium Mat
149
How does projected gradient descent handle a closed convex constraint set C, what is the Euclidean projection onto (a) a box [li,ui] and (b) the non-negative orthant R+d, and what does one step from (x0,y0)=(2,1) with η=0.5 give for min⁡x≥0, y≥0(x−1)2+(y+2)2?

Read the answer

Linear algebra and optimisation L2 Medium Th+Mat
150
Find all stationary points of f(x,y)=x3−3x+y2−4y, and use the Hessian at each stationary point to classify it as a local minimum, local maximum or saddle point. What happens if gradient descent is initialised at (−1,2) versus (−1,0)?

Read the answer

Linear algebra and optimisation L2 Medium Mat
151
For a 2×2 matrix A=(abcd) the inverse is A−1=1ad−bc(d−b−ca) (when ad−bc≠0). How do you use it to solve 2x+y=5 and x+3y=10?

Read the answer

Linear algebra and optimisation L2 Medium Mat
152
The determinant of (abcd) is ad−bc. Compute it for A=(3162) and B=(3122). Which matrix is invertible, and what does the determinant tell you about its columns?

Read the answer

Linear algebra and optimisation L2 Medium Th+Mat
153
How do you show that the negative log-likelihood of logistic regression is convex in the weights w?

Read the answer

Linear algebra and optimisation L3 Medium Mat
154
What are ∇x (x⊤Ax) for a square matrix A and ∇x ∥Ax−b∥2, and how do you derive them?

Read the answer

Linear algebra and optimisation L3 Medium Mat
155
Which of these functions are convex, and why: (a) ∥x∥2; (b) log⁡(1+ex); (c) x3 on R; (d) f(x,y)=xy; (e) the hinge loss max⁡(0, 1−y w⊤x) as a function of w?

Read the answer

Linear algebra and optimisation L3 Medium Mat
156
How is the SVD of a matrix A related to the eigendecomposition of A⊤A? What are the singular values of A=(3045), and what is the error of its best rank-1 approximation?

Read the answer

Linear algebra and optimisation L3 Medium Th+Mat
157
What is the Adam update, why does it need bias correction, and how large is its very first step?

Read the answer

Linear algebra and optimisation L3 Medium Th+Mat
158
How do you solve min⁡x,y (x−2)2+(y−2)2 subject to x+y≤2 using the KKT conditions, and what does each condition mean?

Read the answer

Linear algebra and optimisation L3 Medium Mat
159
Using the Gram–Schmidt process, how do you turn the columns of A=(110101011) into an orthonormal basis, and how do you write the resulting QR factorisation?

Read the answer

Linear algebra and optimisation L3 Medium Mat
160
What is an idempotent matrix, what are its possible eigenvalues, and how do you construct the orthogonal projection matrix P onto the column space of a full-column-rank matrix X∈Rn×d and show that tr⁡(P)=d?

Read the answer

Linear algebra and optimisation L3 Medium Th+Mat
161
For which values of c is the symmetric matrix A=(42025202c) positive definite by Sylvester's criterion, and what is its Cholesky factorisation A=LL⊤ when c=5?

Read the answer

Linear algebra and optimisation L3 Medium Mat
162
How do you classify the quadratic form q(x1,x2,x3)=x12+x22+x32+4x1x2+4x1x3+4x2x3 as positive definite, semidefinite or indefinite, and how do you write it in diagonal form via an orthogonal change of variables x=Qy?

Read the answer

Linear algebra and optimisation L3 Medium Mat
163
When is a square matrix A∈Rn×n diagonalisable, why can repeated eigenvalues break diagonalisability, and how do you tell whether A=(3103) and B=(3003) are diagonalisable?

Read the answer

Linear algebra and optimisation L3 Medium Th+Mat
164
How is the Moore–Penrose pseudoinverse A+ defined from the SVD A=UΣV⊤, what does x∗=A+b compute in general, and what are A+ and x∗ for A=(1224) and b=(36)?

Read the answer

Linear algebra and optimisation L3 Medium Mat
165
For a symmetric positive definite matrix A∈Rd×d and a square matrix B∈Rd×d, how do you derive ∇Atr⁡(BA) and ∇Alog⁡det⁡(A), and how does ∇Σlog⁡det⁡(Σ) appear in fitting a multivariate Gaussian by maximum likelihood?

Read the answer

Linear algebra and optimisation L3 Medium Mat
166
What is the ℓ2 condition number κ2(A) of an invertible matrix A, how does it bound the relative sensitivity of Ax=b to perturbations in b, and what happens for A=(1019999101) when b=(200200) is perturbed by δb=(2−2)?

Read the answer

Linear algebra and optimisation L3 Medium Th+Mat
167
How do you prove that every real symmetric matrix A∈Rn×n has only real eigenvalues and that eigenvectors corresponding to distinct eigenvalues are orthogonal?

Read the answer

Linear algebra and optimisation L3 Medium Mat
168
Why does rank⁡(AB)≤min⁡(rank⁡(A),rank⁡(B)) hold, why is rank⁡(A⊤A)=rank⁡(A) for every real matrix A, and what does this imply for the consistency of the normal equations A⊤Ax=A⊤b?

Read the answer

Linear algebra and optimisation L3 Medium Th+Mat
169
What are the four fundamental subspaces of a matrix A∈Rm×n of rank r, how do they pair up as orthogonal complements, and how does the SVD A=UΣV⊤ give an orthonormal basis for every one of them?

Read the answer

Linear algebra and optimisation L3 Medium Th+Mat
170
Is it true that (a) a uniformly sampled mini-batch gradient is an unbiased estimator of the full-batch gradient, (b) every SGD step decreases the training objective, and (c) SGD with a fixed learning rate converges to the exact minimum, and why?

Read the answer

Linear algebra and optimisation L3 Medium Th+Mat
171
Why are the non-negative weighted sum ∑iαifi(x) (αi≥0), the pointwise maximum max⁡ifi(x), and the affine composition f(Ax+b) convex whenever each fi and f is convex, and how do these rules show that the L2-regularised hinge loss is convex without computing any Hessian?

Read the answer

Linear algebra and optimisation L3 Medium Mat
172
What are the first-order and second-order conditions for a twice-differentiable function f:Rd→R to be convex, and how do you prove that the second-order condition (∇2f(x)⪰0 everywhere) implies the first-order condition (f(y)≥f(x)+∇f(x)⊤(y−x))?

Read the answer

Linear algebra and optimisation L3 Medium Mat
174
What is a subgradient of a convex function at a non-differentiable point, and what is the subdifferential of f(w)=∣w∣ at w=0? Why can the subgradient method increase the objective on some steps, and why must its step size decay instead of staying constant?

Read the answer

Linear algebra and optimisation L3 Medium Mat
175
How is the Lagrange dual function g(λ,ν) defined for a constrained optimisation problem, why is g(λ,ν) always concave even when the primal problem is non-convex, and how do you prove weak duality (d∗≤p∗)?

Read the answer

Linear algebra and optimisation L3 Medium Mat
176
How do step decay, 1/t decay and cosine annealing learning-rate schedules differ, and why do the Robbins–Monro conditions (∑t=1∞ηt=∞, ∑t=1∞ηt2<∞) require the step size to decay neither too fast nor too slow for SGD convergence?

Read the answer

Linear algebra and optimisation L3 Short Th+Mat
177
What is strong duality, what does Slater's condition state, and how do you derive the Lagrange dual of min⁡x∈R2x12+x22 subject to x1+x2≥2 and verify that the duality gap is zero?

Read the answer

Linear algebra and optimisation L3 Long Mat
178
Solve min⁡x,y(x−3)2+(y−2)2 subject to x+y≤2 and y≥0 using the KKT conditions. Which constraint is active at the optimum, and why does the unconstrained minimum fail?

Read the answer

Linear algebra and optimisation L3 Long Mat
179
Applying power iteration to A=(2112) starting from v0=(1,0)⊤ for three steps, what is the estimate of the dominant eigenvalue from the Rayleigh quotient, and how fast does the method converge?

Read the answer

Linear algebra and optimisation L3 Medium Mat
180
For the underdetermined system Ax=b with A=(110011) and b=(2,2)⊤, how do you find the solution with the smallest ℓ2 norm, and why is the answer x=A⊤(AA⊤)−1b?

Read the answer

Linear algebra and optimisation L3 Medium Mat
181
If A−1 is known, how do you derive the Sherman–Morrison formula for (A+uu⊤)−1? How do you verify it for A=diag⁡(2,1) and u=(1,2)⊤, and why does it matter for online ridge regression?

Read the answer

Linear algebra and optimisation L3 Long Mat
182
Derive why the direction of fastest local decrease of f at x is −∇f(x), using a first-order Taylor expansion and the Cauchy–Schwarz inequality. For f(x,y)=x2+3y2 at (1,1), compare the rate of decrease along −∇f/∥∇f∥ with the one along (0,−1)?

Read the answer

Linear algebra and optimisation L3 Medium Th+Mat
183
Prove that for a convex function f on a convex set C, every local minimum is a global minimum. Then show on f(x)=max⁡(0,∣x∣−1) that the minimiser need not be unique, and what extra condition makes it unique?

Read the answer

Linear algebra and optimisation L3 Medium Th
184
Why does momentum speed up gradient descent on ill-conditioned problems?

Read the answer

Linear algebra and optimisation L4 Medium Th+Mat
185
How does Newton's method compare with gradient descent? What does one Newton step do on f(x,y)=4x2+2y2+5 from (−1,2), and why is Newton's method not used to train large neural networks?

Read the answer

Linear algebra and optimisation L4 Medium Th+Mat
186
How does the mini-batch size affect the noise in stochastic gradient descent? What is the variance of a mini-batch gradient, and what is the “linear scaling rule” for the learning rate?

Read the answer

Linear algebra and optimisation L4 Medium Th+Mat
187
If a data matrix X∈Rn×d has singular values σ1≥⋯≥σd≥0, how does adding λI (λ>0) change the eigenvalues and condition number of X⊤X, and why does this explain both numerical stability and Tikhonov regularisation?

Read the answer

Linear algebra and optimisation L4 Medium Th+Mat
188
For L(W)=12∥Y−XW∥F2+λ2tr⁡(W⊤AW), where X∈Rn×d, W∈Rd×k, Y∈Rn×k and A∈Rd×d is symmetric, how do you derive ∇WL(W) using differentials and verify every matrix product by its shapes?

Read the answer

Linear algebra and optimisation L4 Medium Mat
189
How do quasi-Newton methods (BFGS and L-BFGS) approximate the Hessian without computing second derivatives, what are the secant equation and the curvature condition sk⊤yk>0, and how does L-BFGS reduce memory from O(d2) to O(md)?

Read the answer

Linear algebra and optimisation L4 Medium Th+Mat
190
Why can deterministic gradient descent take arbitrarily long or get trapped near a strict saddle point, and how do stochastic gradient noise (SGD) or perturbed gradient descent escape strict saddles?

Read the answer

Linear algebra and optimisation L4 Medium Th+Mat
191
For least-squares linear regression f(w)=12n∥Xw−y∥22, how does the condition number of X⊤X govern the convergence speed of gradient descent, and why does standardising features speed up gradient descent even though it leaves the closed-form predictions unchanged?

Read the answer

Linear algebra and optimisation L4 Medium Th+Mat
192
Minimise f(x)=12x⊤Ax−b⊤x with A=(4113), b=(1,2)⊤ and x0=0 using the conjugate gradient method. How do you show that it reaches the exact minimiser in two steps, and why does this happen?

Read the answer

Linear algebra and optimisation L4 Long Mat
193
Let f be convex and L-smooth, with minimiser x∗. How do you prove that gradient descent with step size 1/L satisfies f(xT)−f(x∗)≤L∥x0−x∗∥22T?

Read the answer

Linear algebra and optimisation L5 Long Mat
194
How do you prove that for a real symmetric matrix A∈Rn×n with eigenvalues λ1≥⋯≥λn, the Rayleigh quotient R(x)=x⊤Axx⊤x satisfies λn≤R(x)≤λ1, and how does the Courant–Fischer min–max theorem characterise the k-th eigenvalue λk?

Read the answer

Linear algebra and optimisation L5 Long Mat
195
How do you prove the Eckart–Young–Mirsky theorem in the spectral norm: for any matrix A∈Rm×n with singular values σ1≥⋯≥σr>0 and any matrix B of rank at most k<r, why must ∥A−B∥2≥σk+1, and why does the truncated SVD Ak achieve equality?

Read the answer

Linear algebra and optimisation L5 Long Mat
196
How do you derive the block-matrix determinant formula det⁡(ABCD)=det⁡(A)det⁡(D−CA−1B) via block LU factorisation (assuming A is invertible), and how does it prove the matrix determinant lemma det⁡(A+uv⊤)=det⁡(A)(1+v⊤A−1u)?

Read the answer

Linear algebra and optimisation L5 Long Mat
197
Let f:Rd→R be μ-strongly convex and L-smooth with unique minimiser x∗. How do you prove that gradient descent with step size η=1/L achieves linear convergence ∥xt−x∗∥22≤(1−μL)t∥x0−x∗∥22?

Read the answer

Linear algebra and optimisation L5 Long Mat
198
Let f:Rd→R be convex with minimiser x∗, and suppose stochastic gradients gt satisfy E[gt∣xt]=∇f(xt) and E[∥gt∥22∣xt]≤G2. How do you prove that SGD with fixed step size η satisfies E[f(xˉT)−f(x∗)]≤∥x0−x∗∥222ηT+ηG22 for xˉT=1T∑t=0T−1xt, and what step size gives the optimal O(1/T) rate?

Read the answer

Linear algebra and optimisation L5 Long Mat
199
For a differentiable convex optimisation problem min⁡xf0(x) subject to fi(x)≤0 (fi convex) and hj(x)=aj⊤x−bj=0 (affine), how do you prove that any point (x∗,λ∗,ν∗) satisfying the KKT conditions is globally primal-dual optimal and achieves zero duality gap?

Read the answer

Linear algebra and optimisation L5 Long Mat
200
When we fit a straight line to data points by least squares, what exactly is the line trying to make small?

Read the answer

Supervised learning L1 One-liner Th
201
A model scores each student with a number z (positive leans towards "will pass", negative towards "will fail"). Why does logistic regression pass z through the sigmoid function σ(z)=1/(1+e−z), and what does the output mean? For example, what does z=2 become?

Read the answer

Supervised learning L1 Short Th
202
What is a decision tree, and how does it use a chain of yes/no questions to decide the class of a new example? Use "go out to play or stay in" as your example?

Read the answer

Supervised learning L1 Short Th
203
What is the difference between multiclass and multilabel classification? Can you give one everyday example of each?

Read the answer

Supervised learning L1 One-liner Th
204
Why should you standardise features before running k-nearest neighbours (k-NN)?

Read the answer

Supervised learning L1 One-liner Th
205
What is the difference between bagging and boosting, in one sentence?

Read the answer

Supervised learning L1 One-liner Th
206
In plain words, what does the hinge loss punish in a classifier, and what is the loss for a point with correct label +1 when the model's score for it is 0.5?

Read the answer

Supervised learning L1 Short Th+Mat
207
In a soft-margin support vector machine (SVM), what does the hyperparameter C control?

Read the answer

Supervised learning L1 One-liner Th
208
A fraud dataset has 99.5% legitimate and 0.5% fraudulent transactions, and your classifier reports 99.5% accuracy. Is it a good classifier, and how would you handle the imbalance?

Read the answer

Supervised learning L1 Short Th
209
What is the Bayes classifier for minimum error rate, and why does picking the most probable class minimise your chance of being wrong?

Read the answer

Supervised learning L1 Short Th
210
What is the difference between a generative and a discriminative classifier? What is one example of each, and when would you prefer each?

Read the answer

Supervised learning L1 Short Th
211
In k-nearest neighbours classification, what happens to the decision boundary when k=1 and when k=n (the training set size)? How does this show the bias–variance trade-off, and how would you choose k?

Read the answer

Supervised learning L1 Short Th
212
What is a kernel density estimate (Parzen window estimate), and what does the bandwidth h control? Why is the method called non-parametric?

Read the answer

Supervised learning L1 Short Th
213
What is the perceptron learning rule for labels yi∈{−1,+1}, and how does one update move the prediction in the right direction?

Read the answer

Supervised learning L1 Short Th+Mat
214
Why should you standardise the features before fitting ridge or lasso regression, but not necessarily before ordinary least squares?

Read the answer

Supervised learning L1 One-liner Th
215
How does Adaline (trained with the delta or LMS rule) differ from the perceptron, in the quantity used for the update and in the loss being minimised?

Read the answer

Supervised learning L1 Short Th+Mat
216
What do Gini impurity and entropy measure in a two-class decision-tree node, and what are their values when the positive-class proportion is p=0.5 (evenly mixed) and p=1 (pure)?

Read the answer

Supervised learning L1 Short Th+Mat
217
How many binary classifiers do one-vs-rest (OvR) and one-vs-one (OvO) need for K=10 classes? For K=4 classes A,B,C,D, suppose the OvO classifiers say A beats B, A beats C, D beats A, B beats C, D beats B and D beats C. What does OvO predict, and why can OvR be ambiguous?

Read the answer

Supervised learning L1 Short Th+Mat
218
Why does a random forest have lower variance than a single deep decision tree?

Read the answer

Supervised learning L2 Short Th
219
A logistic regression model gives P(y=1∣x)=σ(w⊤x+b), with w=(2,−1), b=−1 and σ(z)=1/(1+e−z). (a) What is the decision boundary for threshold 0.5? (b) What is it for threshold 0.8? (c) How is the point x=(1,0) classified under each threshold?

Read the answer

Supervised learning L2 Short Mat
220
A spam filter uses two yes/no features: O = “contains the word offer” and L = “contains a link”. The training set has 10 emails: 4 spam and 6 ham (not spam). Among spam, O=1 in 3 emails and L=1 in 3. Among ham, O=1 in 1 email and L=1 in 2. Using Bernoulli naive Bayes, how is a new email with O=1,L=0 classified (a) with maximum-likelihood estimates and (b) with Laplace (add-one) smoothing, and what is the posterior P(spam∣x) in each case?

Read the answer

Supervised learning L2 Medium Mat
221
A node holds 16 samples, 8 positive and 8 negative. Split A sends 6 samples (5 positive, 1 negative) left and 10 samples (3 positive, 7 negative) right. Split B sends 8 samples (6 positive, 2 negative) left and 8 samples (2 positive, 6 negative) right. What is the information gain (using base-2 entropy) of each split, and which split is chosen?

Read the answer

Supervised learning L2 Medium Mat
222
Write the hinge loss and the logistic loss as functions of the margin m=t f(x), where t∈{−1,+1} is the label and f(x) the classifier's score, and evaluate both at m=−1,0,1,2. What does the difference in their shapes mean for the classifiers they produce?

Read the answer

Supervised learning L2 Short Th+Mat
223
A feature x has class-conditional densities N(μ1=1,σ2=4) for class C1 and N(μ2=5,σ2=4) for class C2, with priors P(C1)=0.8 and P(C2)=0.2. For equal-variance 1-D Gaussians, the Bayes decision boundary is x∗=μ1+μ22+σ2μ2−μ1ln⁡P(C1)P(C2). What is x∗, which class is predicted for x=4, and how does the unequal prior shift the boundary?

Read the answer

Supervised learning L2 Medium Mat
224
A screening test must decide between "disease" (D) and "healthy" (H). The loss is 0 for a correct decision, 20 for declaring "healthy" when the person has the disease, and 1 for declaring "disease" when the person is healthy. For one patient the posterior is P(D∣x)=0.1. Which decision minimises the expected loss, and above what posterior probability of disease should we declare "disease"?

Read the answer

Supervised learning L2 Medium Mat
225
A 3-class classifier may also reject (refuse to decide). A wrong decision costs 1, a correct decision costs 0, and rejecting costs λr=0.2. For the posteriors (0.55,0.30,0.15) and (0.85,0.10,0.05), what should the classifier do? What is the general rule in terms of λr?

Read the answer

Supervised learning L2 Short Mat
226
The training points are A=(1,1) red, B=(2,1) red, C=(4,5) blue, D=(5,4) blue and E=(4,2) blue. Using Euclidean distance, classify the query q=(3,2) with k=1, k=3 and k=5. What does this tell you about the choice of k?

Read the answer

Supervised learning L2 Short Mat
227
A multinomial naive Bayes spam filter uses the vocabulary {win,cash,meeting}. Training: spam documents "win win cash" and "cash cash"; ham documents "meeting win" and "meeting meeting cash". Using Laplace (add-one) smoothing, classify the new document "win meeting meeting". Why is the smoothing needed?

Read the answer

Supervised learning L2 Medium Mat
228
Four observations are x=1.5, 2, 4, 7. What is the estimated density at x=3 using (a) a box kernel of width 2h=4, that is K(u)=12 for ∣u∣≤1 with h=2, and (b) a Gaussian kernel with h=1?

Read the answer

Supervised learning L2 Medium Mat
229
For the four data points (1,2),(2,3),(3,5),(4,4), set up and solve the normal equations for the line y=β0+β1x. What are the residual sum of squares and the unbiased noise-variance estimate σ^2?

Read the answer

Supervised learning L2 Medium Mat
230
Run the perceptron algorithm with learning rate 1, starting from w=(0,0) and b=0, on the points (2,1) with label +1, (1,−1) with +1, (−1,0) with −1 and (0,2) with −1, in this order. A point counts as a mistake if y(w⊤x+b)≤0. What are the weights after each update, and when does it stop?

Read the answer

Supervised learning L2 Medium Mat
231
An Adaline has two weights, no bias, starting at w=(0,0), with learning rate η=0.1 and the delta rule w←w+η(t−w⊤x) x. Apply it to the sample x=(1,2) with target t=3, then to x=(2,1) with target t=1. What are the weights after each step? For what range of η is a single repeated sample x=(1,2) stable?

Read the answer

Supervised learning L2 Medium Mat
232
With p=10 candidate features, how many models does best-subset selection have to consider, and how many model fits does forward stepwise selection need? What changes for p=30, and why might forward stepwise still give a worse model than best subset?

Read the answer

Supervised learning L2 Short Th+Mat
233
A three-class softmax model produces scores (logits) z=(2,1,0) for an input. Compute the class probabilities. If the true class is class 2, what is the cross-entropy loss, and what is the gradient of the loss with respect to z?

Read the answer

Supervised learning L2 Medium Mat
234
A linear classifier has w=(2,−1) and b=0.5. What are the hinge loss and the 0–1 loss on the points A=(1,0) with label +1, B=(0,0) with label +1, and C=(1,1) with label −1?

Read the answer

Supervised learning L2 Short Mat
235
What is the difference between multiclass and multilabel classification, and how do the output activation, the loss and the prediction rule differ for a neural or linear model with L outputs? What are three ways to reduce multilabel to simpler problems?

Read the answer

Supervised learning L2 Medium Th
236
A node has 10 samples, 6 positive and 4 negative. A split sends 5 samples left (4 positive, 1 negative) and 5 right (2 positive, 3 negative). What is the Gini impurity of the parent and of the two children, and what is the Gini gain of the split?

Read the answer

Supervised learning L2 Short Mat
237
A node has 12 samples, 6 of each class. Attribute ID takes 12 distinct values (one per sample). Attribute B splits the samples into two groups of 6: (5 positive, 1 negative) and (1 positive, 5 negative). Compute the information gain and the gain ratio of both attributes. Which one does ID3 pick and which does C4.5 pick, and why?

Read the answer

Supervised learning L2 Medium Mat
238
Take the Gaussian (RBF) kernel k(x,z)=exp⁡ ⁣(−(x−z)22) on the 1-D points x=0,1,3. Write the Gram matrix. What happens to the Gram matrix when the width is made very small and when it is made very large, and what does that mean for an SVM?

Read the answer

Supervised learning L2 Medium Th+Mat
239
In round 1 of AdaBoost on n=10 points with equal weights 0.1, a stump misclassifies 3 points. What are its error ε, its weight α, and the new normalised weights of the misclassified and the correctly classified points?

Read the answer

Supervised learning L2 Medium Mat
240
A regression tree is grown on x=1,2,3,4,5,6 with y=2,3,2,9,10,8. Which threshold does the first split choose using the sum of squared errors (SSE), and what are the leaf predictions and the SSE reduction?

Read the answer

Supervised learning L2 Medium Mat
242
In stacking, a meta-learner is trained on the predictions of base models. Why must the meta-features be out-of-fold predictions, and how are they produced with 5-fold cross-validation for 3 base models? What goes wrong if you use the base models' predictions on their own training data?

Read the answer

Supervised learning L2 Medium Th
243
The Huber loss with threshold δ has derivative equal to minus the clipped residual, −ψ(yi−c) where ψ(r)=max⁡(−δ,min⁡(δ,r)), so the optimal constant fit c satisfies ∑iψ(yi−c)=0. When fitting a constant c to {1,2,3,4,100}, what does squared loss give, verify that c=3 satisfies the Huber condition for δ=1.5, and compare it with the mean and median?

Read the answer

Supervised learning L2 Short Th+Mat
244
A linear regression model predicts monthly rent, in thousands of rupees, as y^=5+0.02 a+3 r, where a is the flat's area in square feet and r is the number of bedrooms. (a) What rent does it predict for a 600 sq ft flat with 2 bedrooms? (b) What does the number 3 mean? (c) Two flats both have 2 bedrooms but one is 100 sq ft larger. How much more rent does the model predict for it?

Read the answer

Supervised learning L2 Short Th+Mat
245
Two weight vectors fit a training set equally well: wA=(3,0) and wB=(1.5,1.5). Ridge adds the penalty λ∑jwj2 and lasso adds λ∑j∣wj∣, with λ=0.1. Compute both penalties for each vector. Which vector does each method prefer?

Read the answer

Supervised learning L2 Short Th+Mat
246
How do you derive the hard-margin SVM objective, and why is the margin 2∥w∥, where w is the weight vector?

Read the answer

Supervised learning L3 Long Mat
247
How do you derive the normal equations for least-squares linear regression? When is X⊤X singular, what do you do then, and what is a concrete example of a singular design?

Read the answer

Supervised learning L3 Medium Mat
248
What is the closed-form solution of ridge regression, min⁡w∥y−Xw∥2+λ∥w∥2, and, using the singular value decomposition X=UDV⊤, which directions does ridge shrink the most?

Read the answer

Supervised learning L3 Medium Mat
249
Why does the lasso give coefficients that are exactly zero while ridge does not? When the design is orthonormal (X⊤X=I), what is the lasso solution and how does it compare with ridge?

Read the answer

Supervised learning L3 Medium Th+Mat
250
How can you show that k(x,z)=(1+x⊤z)2 on R2 is a valid kernel by finding a feature map ϕ with k(x,z)=ϕ(x)⊤ϕ(z)? What is Mercer's condition, and why does it show that k(x,z)=x⊤z−1 is not a valid kernel?

Read the answer

Supervised learning L3 Medium Th+Mat
251
A linear support vector regression (SVR) with an ε-insensitive loss, ε=0.5 and C=2, is trained on five points (x,y) and learns f(x)=x (so w=1, b=0). The points are A=(0,0.1), B=(1,1.5), C=(2,1.5), D=(3,1.8) and E=(4,5.0). Using the dual variables, which points are support vectors, and which have zero training loss?

Read the answer

Supervised learning L3 Medium Th+Mat
252
Two regression models f1 and f2 are combined as y^=wf1(x)+(1−w)f2(x). Assume both are unbiased, their errors e1=f1(x)−y and e2=f2(x)−y have variances σ12 and σ22, and Cov⁡(e1,e2)=ρσ1σ2, where ρ is the correlation of the errors. Which w minimises the variance of the combined error, and what is that minimum variance?

Read the answer

Supervised learning L3 Medium Mat
253
A binary classification training set has 64 one-dimensional samples, 32 from each class, and all 64 values of x are distinct. A decision tree splits with thresholds x≤θ and keeps splitting until every leaf is pure. Justify each answer. (a) What is the maximum possible training accuracy? (b) What is the maximum possible depth of the tree? (c) What is the minimum possible depth? (d) Does the minimum-depth tree need regularisation?

Read the answer

Supervised learning L3 Medium Th+Mat
254
What is the AdaBoost algorithm for binary labels yi∈{−1,+1}, and when and why must a weak classifier be rejected, in terms of its weight αt?

Read the answer

Supervised learning L3 Long Th+Mat
255
Class 0 has points (1,2),(2,1),(3,3) and class 1 has points (5,4),(6,6),(7,5). With equal priors, fit LDA (shared covariance). What are the discriminant direction w and the boundary, and which class is the query (4,3) assigned to?

Read the answer

Supervised learning L3 Long Mat
256
For two classes, Fisher's criterion is J(w)=(w⊤(m1−m0))2w⊤SWw, where m0,m1 are the class means and SW is the total within-class scatter matrix. Show that the maximiser is w∝SW−1(m1−m0). How do you check it for m1−m0=(3,2) and SW=diag(2,1)?

Read the answer

Supervised learning L3 Long Th+Mat
257
In Gaussian discriminant analysis with x∣y=k∼N(μk,Σ) (the same Σ for both classes) and P(y=1)=ϕ, show that P(y=1∣x)=σ(w⊤x+b), the logistic function of a linear function of x. Give w and b. For μ0=0, μ1=2, Σ=1, ϕ=0.5 in one dimension, what is P(y=1∣x=1.5)?

Read the answer

Supervised learning L3 Medium Th+Mat
258
In one dimension, class 1 has density N(0,1) and class 2 has density N(0,4) (variance 4), with equal priors. Where are the Bayes decision boundaries, and which class is chosen in each region? Why is the boundary not a single point?

Read the answer

Supervised learning L3 Medium Mat
259
A Gaussian naive Bayes classifier has two classes. Class A has prior 0.6, feature means (1,2) and feature variances (1,4). Class B has prior 0.4, means (3,0) and variances (1,1). Which class is the point x=(2,1) assigned to?

Read the answer

Supervised learning L3 Medium Mat
260
n points are drawn uniformly in the unit ball in p dimensions. Show that the median distance from the origin to the nearest point is d=(1−(12)1/n)1/p. What is its value for n=500 with p=2 and p=10, and what does it mean for k-NN?

Read the answer

Supervised learning L3 Medium Th+Mat
261
Multiple discriminant analysis (multi-class Fisher LDA) solves SBv=λSWv. For C=3 classes in d=100 dimensions with n=60 training points, how many useful discriminant directions are there, and what goes wrong with SW? How can you fix it?

Read the answer

Supervised learning L3 Medium Th+Mat
262
For GDA with binary y∈{0,1}, y∼Bernoulli(ϕ) and x∣y=k∼N(μk,Σ), how do you derive the maximum likelihood estimates of ϕ, μ0, μ1 and Σ from n labelled points?

Read the answer

Supervised learning L3 Long Mat
263
Show that a naive Bayes classifier with two classes and binary features is a linear classifier in x, and give its weights. For P(y=1)=0.5, P(x1=1∣y=1)=0.8, P(x1=1∣y=0)=0.2, P(x2=1∣y=1)=0.6, P(x2=1∣y=0)=0.3, find the log-odds for x=(1,0) and x=(1,1). What goes wrong if feature 2 is copied twice?

Read the answer

Supervised learning L3 Long Th+Mat
264
In least-squares linear regression, why is the fitted vector y^=Xβ^ the orthogonal projection of y onto the column space of X, and what does this say about the residuals?

Read the answer

Supervised learning L3 Short Th
265
Fit a straight line (intercept and slope) to the three points (x,y)=(0,1),(1,3),(2,2). What are the hat matrix diagonal entries h11,h22,h33, do they sum to 2, and what is the residual vector?

Read the answer

Supervised learning L3 Medium Mat
266
How do you derive the log-likelihood, the gradient and the Hessian of binary logistic regression, show that the log-likelihood is concave, and carry out one Newton step from w=0 on the data x=(1,2,−1), y=(1,1,0) (one feature, no intercept)?

Read the answer

Supervised learning L3 Long Mat
267
For ridge regression, define the effective degrees of freedom df⁡(λ)=tr⁡(X(X⊤X+λI)−1X⊤) and express it with the singular values dj of X. If X has singular values 4,2,1 and λ=4, what are df⁡ and the shrinkage factor on each direction?

Read the answer

Supervised learning L3 Medium Mat
268
Assume y=Xβ+ε with E[ε]=0, Cov⁡(ε)=σ2I and X of full column rank p. How do you prove that E[RSS]=(n−p)σ2, so that σ^2=RSS/(n−p) is unbiased?

Read the answer

Supervised learning L3 Medium Mat
270
For K-class softmax regression with P(y=k∣x)=ewk⊤x/∑jewj⊤x, derive the gradient of the negative log-likelihood with respect to wk. How do you show that the parameters are redundant (not identifiable), and how is this fixed?

Read the answer

Supervised learning L3 Long Mat
271
Fit the points (0,1),(1,3),(2,3) with (a) a quadratic y=a+bx+cx2 and (b) a straight line. Find each fit and its residual sum of squares. Why is the quadratic exact, and what goes wrong if you try a cubic?

Read the answer

Supervised learning L3 Medium Mat
272
The elastic net minimises ∥y−Xβ∥2+λ2∥β∥22+λ1∥β∥1. How do you show that it is a lasso problem on augmented data, and what does this imply for the number of variables it can select and for correlated features?

Read the answer

Supervised learning L3 Long Mat
273
Show that ridge regression is the MAP (maximum a posteriori) estimate under a Gaussian prior, and lasso under a Laplace prior, when the noise is Gaussian. If the noise variance is σ2=2 and the prior is βj∼N(0,τ2) with τ2=0.5, what ridge λ does this give?

Read the answer

Supervised learning L3 Medium Mat
274
Take an orthonormal design (X⊤X=I) with noise variance σ2. For one coefficient with true value β, find the mean squared error of the ridge estimate β^/(1+λ) as a function of λ. Show that some λ>0 always beats OLS, find the best λ, and evaluate it for σ2=1, β=2. Why is this not a free lunch?

Read the answer

Supervised learning L3 Long Mat
275
A 1-D training set has x=1 with label −1, and x=3 and x=4 with label +1. What are the hard-margin SVM w, b and the dual variables αi, and which points are support vectors?

Read the answer

Supervised learning L3 Medium Mat
276
How do you derive the dual of the soft-margin SVM min⁡w,b,ξ 12∥w∥2+C∑iξi subject to yi(w⊤xi+b)≥1−ξi and ξi≥0? How do you show the box constraint 0≤αi≤C, and what are the KKT conditions that classify each point?

Read the answer

Supervised learning L3 Long Mat
277
The SVM objective λ2∥w∥2+1n∑imax⁡(0,1−yiw⊤xi) is minimised by stochastic subgradient descent (Pegasos) with step ηt=1/(λt). With λ=0.5 and w0=0, what is the result of running three steps on the single points (x,y)=((1,2),+1), ((−1,0),−1) and ((0,−1),+1), in that order, and what is the update rule?

Read the answer

Supervised learning L3 Medium Mat
278
With squared loss, run two rounds of gradient boosting on x=1,2,3,4 and y=3,5,12,14, using a stump that splits between x=2 and x=3 in each round and a learning rate ν=0.5. What is the training MSE before boosting (the constant model), after round 1, and after round 2?

Read the answer

Supervised learning L3 Medium Mat
279
How do you show that the AdaBoost classifier weight α=12ln⁡1−εε is the value that minimises the exponential loss, given a weak classifier h with weighted error ε?

Read the answer

Supervised learning L3 Medium Mat
280
In a screening task, a false negative costs 20 and a false positive costs 1, with no cost for correct decisions. What probability threshold minimises expected cost? A model trained after keeping only 10% of the negatives outputs ps=0.5 for a patient. What is the true probability, and what do we decide?

Read the answer

Supervised learning L3 Medium Mat
281
The four XOR points (1,1) and (−1,−1) with label +1, and (1,−1) and (−1,1) with label −1, are not linearly separable. Solving the hard-margin SVM dual with the kernel k(x,z)=(1+x⊤z)2, what are the αi, the bias and the decision function?

Read the answer

Supervised learning L3 Long Mat
282
A soft-margin SVM uses a different penalty for each class: min⁡12∥w∥2+C+∑yi=+1ξi+C−∑yi=−1ξi with the usual constraints. What changes in the dual and in the KKT conditions? In what direction does the boundary move if C+>C−, and how would you choose C± for an imbalanced dataset?

Read the answer

Supervised learning L3 Medium Th+Mat
283
Prove that information gain from any split is non-negative, and say when it is exactly zero. Can it be zero for a split that is useful?

Read the answer

Supervised learning L3 Medium Mat
284
Kernel ridge regression uses the kernel k(x,z)=(1+xz)2 on one-dimensional inputs, with penalty λ=1. The training data are (x1,y1)=(0,1) and (x2,y2)=(1,3). Find the dual coefficients α and predict at x=2. Why is the dual form useful?

Read the answer

Supervised learning L3 Medium Th+Mat
285
Locally weighted linear regression predicts at a query xq by minimising ∑iwi (yi−θ0−θ1xi)2 with weights wi=exp⁡ ⁣(−(xi−xq)2/(2τ2)). For the data (0,1),(1,3),(2,2), bandwidth τ=1 and query xq=0, compute the prediction. How does it compare with the ordinary least-squares prediction at x=0?

Read the answer

Supervised learning L3 Medium Mat
286
The pinball (quantile) loss for level τ∈(0,1) is ρτ(r)=τr if r≥0 and (τ−1)r if r<0, with r=y−c. Show that the constant c minimising E ρτ(Y−c) is the τ-quantile of Y. How do you check it numerically for τ=0.7 on {1,2,3,4,10}?

Read the answer

Supervised learning L3 Long Th+Mat
287
Gradient boosting for binary classification uses the log loss with F(x) as the log-odds. The data are x=1,2,3,4,5 with labels y=1,1,0,0,0. Start from the best constant, grow a stump that splits between x=2 and x=3, and use Newton leaf values with learning rate 0.5. What are the new probabilities?

Read the answer

Supervised learning L3 Long Mat
288
A hard-margin linear SVM is trained on (0,0) with label −1 and on (3,0), (0,3) and (4,4) with label +1. Find w, b, the margin and the dual variables αi. Which points are support vectors?

Read the answer

Supervised learning L3 Medium Mat
289
In Poisson regression the count y has mean μ=ewx (one weight, no intercept). The data are (x,y)=(1,1) and (2,3). What are the log-likelihood, its gradient and Hessian, and the result of two Newton steps from w=0?

Read the answer

Supervised learning L3 Medium Mat
290
Two classes have one-dimensional Gaussian class-conditional densities with the same variance σ2, means μ1<μ2 and priors P(C1), P(C2). What is the Bayes decision boundary x∗ (derive it), and what is it for μ1=0, μ2=4, σ2=1, P(C1)=0.9, P(C2)=0.1, and which class is predicted at x=2.4?

Read the answer

Supervised learning L3 Medium Th+Mat
291
The Huber loss with threshold δ is ℓ(r)=12r2 for ∣r∣≤δ and δ(∣r∣−12δ) otherwise, where r is the residual. How do you derive ℓ′(r), show that ℓ is convex, and use this to show that the optimal constant c for the data {1,2,3,4,100} with δ=1.5 is c=3?

Read the answer

Supervised learning L3 Medium Mat
292
You want an ensemble of linear SVMs. What are two different ways to get different linear SVMs from one training set, why does each make the SVMs differ, and why must the ensemble combine their votes rather than average their real-valued scores?

Read the answer

Supervised learning L4 Medium Th
293
The linear SVM minimises ∑i[1−ti(w⊤xi+b)]++λ∥w∥22, where [a]+=max⁡(0,a) and ti∈{−1,+1} is the label. What changes if the penalty is replaced by λ∥w∥1, in the solution, the optimisation problem, the use of kernels and the meaning of the margin?

Read the answer

Supervised learning L4 Medium Th+Mat
294
Why is gradient boosting called gradient descent in function space, what are the pseudo-residuals for squared, absolute and logistic loss, and what is the full algorithm with regression trees as base learners?

Read the answer

Supervised learning L4 Long Th+Mat
295
For a kernel density estimate f^(x)=1nh∑iK ⁣(x−xih) in one dimension, derive the leading terms of its bias and variance at a point x. Hence what is the bandwidth that minimises the asymptotic mean squared error, and at what rate does the error shrink with n?

Read the answer

Supervised learning L4 Long Mat
296
Show that, as n→∞, the error rate of the 1-nearest-neighbour classifier for two classes is at most 2R∗(1−R∗), where R∗ is the Bayes error. What does it say numerically for R∗=0.1?

Read the answer

Supervised learning L4 Long Mat
297
LDA and logistic regression both give linear decision boundaries. When would you expect each to do better, and why, in terms of data size, model correctness and outliers?

Read the answer

Supervised learning L4 Medium Th
298
Under what conditions on k=kn does the k-NN classifier approach the Bayes error as n→∞? Why does a fixed k not suffice, and why is k≈n a sensible choice?

Read the answer

Supervised learning L4 Medium Th
299
Two classes have densities N(μ0,Σ) and N(μ1,Σ) with equal priors. Show that the Bayes error is Φ(−Δ/2), where Δ2=(μ1−μ0)⊤Σ−1(μ1−μ0) and Φ is the standard normal cdf. What is its value for μ0=(0,0), μ1=(2,2), Σ=(10.50.51), and how does it compare with the Bhattacharyya bound?

Read the answer

Supervised learning L4 Long Mat
300
Derive why the directions that maximise the multi-class Fisher criterion are the leading eigenvectors of SW−1SB. Start with a single direction w and maximise w⊤SBww⊤SWw. How do you show that for two classes the result reduces to w∝SW−1(m1−m0)?

Read the answer

Supervised learning L4 Long Mat
301
Prove that the leave-one-out residual of ordinary least squares is ei/(1−hii), where ei is the ordinary residual and hii the leverage, so LOOCV needs only one fit. How do you check it on the points (0,1),(1,3),(2,3) by computing the LOOCV mean squared error both ways?

Read the answer

Supervised learning L4 Long Mat
302
Prove the perceptron convergence theorem: if there is a unit vector w∗ and a margin γ>0 such that yi(w∗⊤xi)≥γ for all i, and ∥xi∥≤R, then the perceptron (starting from w=0) makes at most (R/γ)2 mistakes. Why does the bound not depend on the number of points or the dimension?

Read the answer

Supervised learning L4 Long Mat
303
Describe the least angle regression (LAR) algorithm and how it relates to the lasso path. In the case X=I2 (two orthonormal columns) with y=(3,1): what is the path of coefficients as a function of the penalty λ, and where does each variable enter?

Read the answer

Supervised learning L4 Long Th+Mat
304
A 1-D dataset has x=−1 with y=0 and x=+1 with y=1, and the model is P(y=1∣x)=σ(wx) (no intercept). How do you show that the maximum-likelihood estimate does not exist, what happens to the Hessian, and how does an L2 penalty fix it?

Read the answer

Supervised learning L4 Long Mat
305
Describe how partial least squares (PLS) builds its first component, and how it differs from principal components regression (PCR). Take centred X with X⊤X=4I2, X⊤y=(4,3)⊤ for n=4 samples: what are the first PLS direction and the one-component fit coefficients, and how do they compare with OLS?

Read the answer

Supervised learning L4 Long Th+Mat
306
How is the optimal leaf weight w∗=−G/(H+λ) and the split gain derived in XGBoost's second-order objective? How do you apply it to 6 samples with logistic loss, current prediction F=0 (so p=0.5), labels 1,1,0 in the left candidate leaf and 1,0,0 in the right, λ=1, γ=0.1?

Read the answer

Supervised learning L4 Long Mat
307
A random forest has features x1 (a truly informative binary variable) and x2 (a continuous pure-noise variable). Why can mean decrease in impurity (MDI) rate x2 as important, and how does permutation importance on the out-of-bag (OOB) data fix this? What is its own weakness with correlated features?

Read the answer

Supervised learning L4 Medium Th
308
For a hard-margin SVM trained on n linearly separable points, how do you prove that the leave-one-out error is at most NSV/n, where NSV is the number of support vectors, and what does this imply about the expected test error?

Read the answer

Supervised learning L5 Medium Th+Mat
309
For two classes, how do you derive the asymptotic error of the 3-nearest-neighbour rule as a function of the posterior η(x), and how do you show that it is never worse than the 1-NN rule at every x? What are the errors of both rules when the local Bayes error is r=0.1?

Read the answer

Supervised learning L5 Long Mat
310
Write the optimality (KKT) conditions for the lasso min⁡β12∥y−Xβ∥2+λ∥β∥1. Using them, what is the smallest λ at which β^=0, and how do you verify that β^=(1.5,0) is the solution for X=I2, y=(3,1), λ=1.5?

Read the answer

Supervised learning L5 Long Mat
311
Prove the Gauss–Markov theorem: under y=Xβ+ε with E[ε]=0, Cov⁡(ε)=σ2I and X of full column rank, the OLS estimator has the smallest covariance matrix among all linear unbiased estimators. Why does this not rule out ridge regression doing better in MSE?

Read the answer

Supervised learning L5 Long Mat
312
How do you prove that the Gaussian kernel k(x,z)=exp⁡(−γ∥x−z∥2) is a valid (positive semi-definite) kernel, using only the linear kernel and closure rules?

Read the answer

Supervised learning L5 Long Mat
313
How do you prove that the training error of AdaBoost is at most ∏t2εt(1−εt)≤exp⁡(−2∑tγt2), where γt=12−εt? For γt≥0.1 and n=1000 training points, after how many rounds is the training error zero?

Read the answer

Supervised learning L5 Long Mat
314
Consider a kernel k with reproducing-kernel Hilbert space (RKHS) H. How do you prove that a minimiser of ∑iL(yi,f(xi))+λ∥f∥H2, with λ>0, has the form f=∑iαik(xi,⋅)? Why does this make kernel SVMs practical?

Read the answer

Supervised learning L5 Long Mat
315
In clustering we group points that are "close" to each other. How do we measure closeness with the Euclidean (straight-line) distance, and what is it between the points (1,2) and (4,6)?

Read the answer

Unsupervised learning L1 Short Th+Mat
316
How does the k-means clustering algorithm group unlabelled data points into k clusters, and what happens in one full iteration on the 1-D (one-dimensional) points {0,2,8,10} with k=2 starting from initial centres 2 and 6?

Read the answer

Unsupervised learning L1 Short Th+Mat
317
What does principal component analysis (PCA) do to a dataset, what are principal components geometrically, and why do we often keep only the first few?

Read the answer

Unsupervised learning L1 Short Th
318
Why should you usually standardise features before running principal component analysis (PCA)?

Read the answer

Unsupervised learning L1 One-liner Th
319
How do you choose the number of clusters k for k-means, and why can't you just pick the k that minimises the k-means objective?

Read the answer

Unsupervised learning L1 Short Th
320
Why is k-medoids (PAM) more robust to outliers than k-means, and what does it cost you?

Read the answer

Unsupervised learning L1 Short Th
321
What is the difference between AGNES and DIANA in hierarchical clustering, and which is cheaper to run?

Read the answer

Unsupervised learning L1 Short Th
322
In DBSCAN with radius ε and threshold minPts, how are a core point, a border point and a noise point defined, and how are clusters formed from them?

Read the answer

Unsupervised learning L1 Short Th
323
How does an isolation forest detect anomalies, and why do anomalous points end up with shorter average path lengths?

Read the answer

Unsupervised learning L1 Short Th
324
What is an undercomplete autoencoder, and why does it need a bottleneck narrower than the input to learn anything useful?

Read the answer

Unsupervised learning L1 Short Th
325
What is collaborative filtering, and how do user-based and item-based neighbourhood methods differ? Which one scales better when there are far more users than items, and why?

Read the answer

Unsupervised learning L1 Short Th
326
Does k-means always converge, and does it find the global optimum?

Read the answer

Unsupervised learning L2 Short Th+Mat
327
What is k-means++ initialisation, and for the 1-D points {0,1,2,10,11} with k=2, if the first centre chosen is 0, what is the probability that each remaining point becomes the second centre?

Read the answer

Unsupervised learning L2 Short Th+Mat
328
Five 1-D points are A=0, B=1, C=3, D=7 and E=8. With agglomerative clustering, what merges and merge heights do (a) single linkage and (b) complete linkage give, and how do the two linkages differ in practice?

Read the answer

Unsupervised learning L2 Medium Mat
329
A clustering of 1-D data gives cluster 1 ={0,2} and cluster 2 ={6,8,10}. What are the silhouette values of the points x=2 and x=6, and what do they tell you?

Read the answer

Unsupervised learning L2 Short Mat
330
Six records have three categorical attributes: 1=(a,x,p), 2=(a,x,q), 3=(a,y,p), 4=(b,y,q), 5=(b,y,p), 6=(b,x,q). Run k-modes with k=2 from initial modes c1=(a,x,p) and c2=(b,y,q), using the simple matching dissimilarity. What are the clusters, the new modes and the total cost?

Read the answer

Unsupervised learning L2 Medium Mat
331
In mini-batch k-means (Sculley's version) each centre c has a count v of points it has absorbed. For each point x assigned to it, the update is v←v+1, c←(1−η)c+ηx with η=1/v. In 1-D the centres are c1=4 with v1=3 and c2=10 with v2=1. A mini-batch {6,2,9,12} arrives. What are the new centres, and why does this update make sense?

Read the answer

Unsupervised learning L2 Medium Mat
332
Take the 1-D points {1,2,3,10,11,25} with k=2 and absolute-difference distance. Starting from medoids {1,11}, compute the total cost, then the cost after swapping medoid 1 with the non-medoid 2. Does PAM accept the swap, and is {2,11} optimal?

Read the answer

Unsupervised learning L2 Medium Mat
333
Six points have true classes A,A,A,B,B,B (points 1–6) and a clustering puts points {1,2} in cluster 1 and {3,4,5,6} in cluster 2. Compute the Rand index and the purity. Why is the Rand index alone not enough?

Read the answer

Unsupervised learning L2 Medium Mat
334
Three 1-D clusters are C1={1,3}, C2={7,9,11} and C3={20,24}. Using the Euclidean distance, compute the Davies–Bouldin index. Is a larger or smaller value better?

Read the answer

Unsupervised learning L2 Medium Mat
335
Run DBSCAN with ε=2 and minPts=4 (counting the point itself) on the 1-D points {0,1,2,3,5,7,8,9,10,20}. Label each point as core, border or noise. What happens to the point 5?

Read the answer

Unsupervised learning L2 Medium Mat
336
Four items a,b,c,d have dissimilarities ab=2, ac=5, ad=9, bc=3, bd=8, cd=4.5. If you run agglomerative clustering with single, complete and average linkage, what are the merge order and heights for each, and which linkage shows the chaining effect?

Read the answer

Unsupervised learning L2 Medium Mat
337
A self-organising map has three neurons on a line with weight vectors w1=(0,0), w2=(2,0) and w3=(5,0). The input is x=(3,1), the learning rate is η=0.5 and the neighbourhood is h=exp⁡(−d2/(2σ2)) with σ=1, where d is the distance on the map between neurons (neurons 1, 2, 3 are at positions 1, 2, 3). Which neuron wins, and what are the three weight vectors after one update?

Read the answer

Unsupervised learning L2 Medium Mat
338
The covariance matrix of a 4-dimensional dataset has eigenvalues 5, 3, 1.5 and 0.5. (a) What fraction of the variance does each principal component explain? (b) How many components are needed to keep at least 90% of the variance? (c) What is the average squared reconstruction error per point when you keep that many?

Read the answer

Unsupervised learning L2 Medium Mat
339
Four 2-D points are (1,2), (2,1), (3,4) and (4,3). What are the sample covariance matrix, the first principal component, the fraction of variance it explains, and the coordinate of the first point along it?

Read the answer

Unsupervised learning L2 Medium Mat
340
In matrix factorisation for recommendation, a rating r=4 is modelled as r^=p⊤q with user vector p=(1,0.5) and item vector q=(2,1). With squared loss plus L2 penalty 12λ(∥p∥2+∥q∥2), learning rate η=0.1 and λ=0.1, perform one stochastic gradient step on this rating. What are the new p, q and prediction?

Read the answer

Unsupervised learning L2 Medium Mat
341
A Gaussian kernel density estimate with bandwidth h is built from the three 1-D points 1, 2 and 4. (a) Write p^(x) and compute p^(2) for h=1. (b) What does p^(2) become for h=0.2, and what does the change in h do to the estimate in general?

Read the answer

Unsupervised learning L2 Medium Th+Mat
342
A one-class SVM with an RBF kernel is trained on n=200 normal points with ν=0.05. (a) What does ν guarantee about the number of training points outside the learned boundary and the number of support vectors? (b) What happens if you set ν=0.5 instead, and why would ν be a poor choice for contaminated data if set too small?

Read the answer

Unsupervised learning L2 Short Th+Mat
343
Five shopping baskets are T1 = {A, B, C}, T2 = {A, B}, T3 = {A, C}, T4 = {B, C, D} and T5 = {A, B, C, D}. Run Apriori with minimum support count 2 to list all frequent itemsets. Then, for the rules {A,B}→C and {B,C}→D, compute confidence and lift. Which rule shows a real association?

Read the answer

Unsupervised learning L2 Medium Mat
344
Six points on a line are 1, 2, 3, 10, 11 and 12. Using a flat kernel of radius 2.5 (all points within distance 2.5 get equal weight), run mean shift by hand from the starting positions x=4 and x=9. Where does each run stop, and what do you learn about the number of clusters?

Read the answer

Unsupervised learning L2 Medium Mat
345
How do you derive PCA as finding the direction of maximum variance?

Read the answer

Unsupervised learning L3 Long Mat
346
A data matrix X has one feature per column. Its covariance matrix decomposes as C=UΛU⊤ with U=12[11−11] and Λ=diag⁡(99,1). (a) What is the shape of X? (b) What steps compute C from X, and what is C explicitly? (c) To what dimension would you reduce the data with PCA, onto which direction, and why?

Read the answer

Unsupervised learning L3 Medium Mat
347
Normal data in 2-D is modelled as a Gaussian with mean μ=(0,0) and covariance Σ=[10.90.91]. What is the squared Mahalanobis distance of x1=(1,1) and of x2=(1,−1), which is anomalous at the 1% level, and would a model that treats the two features as independent Gaussians notice the difference?

Read the answer

Unsupervised learning L3 Medium Mat
348
A 2-D dataset has two clusters: 50 points evenly spaced on a circle of radius 1 and 200 points evenly spaced on a circle of radius 5, both centred at the origin. (a) Can fuzzy c-means with c=2 separate the two rings? (b) Can DBSCAN, and which values of ε and MinPts work, which fail, and why?

Read the answer

Unsupervised learning L3 Medium Th+Mat
349
How do you compute PCA from the singular value decomposition (SVD) of the centred data matrix Xc∈Rn×d, how are the principal directions, variances and projected coordinates read off it, and why is the SVD route preferred in practice?

Read the answer

Unsupervised learning L3 Medium Mat
350
How do you show that Ward's linkage, which merges the pair of clusters that least increases the total within-cluster sum of squares, has merge cost Δ(A,B)=nAnBnA+nB∥μA−μB∥2? How do you check it on A={0,2} and B={6}?

Read the answer

Unsupervised learning L3 Long Mat
351
A 1-D Gaussian mixture has two components with equal weights π1=π2=0.5, means μ1=0 and μ2=4, and both variances equal to 1. For the data {0,1,5}, what are the E-step responsibilities and the updated weights and means after one EM iteration?

Read the answer

Unsupervised learning L3 Long Mat
352
In EM for a Gaussian mixture with weights πk, means μk and covariances Σk, how do you derive the M-step updates for πk, μk and Σk from the expected complete-data log-likelihood?

Read the answer

Unsupervised learning L3 Long Mat
353
A graph on four nodes has edge weights w12=1, w34=1, w23=0.1 and no other edges. Write the unnormalised Laplacian L=D−W and find its second-smallest eigenvalue and eigenvector. What clustering does the sign of that eigenvector give, and how does the eigenvalue compare with the RatioCut of that split?

Read the answer

Unsupervised learning L3 Long Mat
354
BIRCH summarises a sub-cluster by a clustering feature CF=(N,LS,SS). Why are these three numbers enough, and what are the CFs and radius when {1,2,3} is merged with {7,9}? If the threshold is T=3, is the merge allowed?

Read the answer

Unsupervised learning L3 Long Th+Mat
355
In OPTICS with ε=3 and minPts=3 (counting the point itself) on the 1-D points {0,2,4,6,7,7.2,7.4,7.6}, compute the core distance of points 4, 6 and 7.2 and the reachability distances of 6 from 4, of 7.0 from 6, and of 7.4 from 7.2. Why does OPTICS handle this data better than one DBSCAN run?

Read the answer

Unsupervised learning L3 Long Th+Mat
356
CURE represents each cluster by several well-scattered representative points that are shrunk towards the cluster centroid by a factor α. In 2-D, a cluster with centroid (4,3) has a representative at (10,0). With α=0.2, where does it go? Why does the shrinking help, and what happens at α=0 and α=1?

Read the answer

Unsupervised learning L3 Medium Th+Mat
357
The gap statistic compares log⁡Wk (the log within-cluster dispersion) with its expectation under a reference null with no cluster structure. For k=1,…,5 suppose log⁡Wk=5.00, 4.20, 3.90, 3.75, 3.70, the reference expectations are 5.40, 4.75, 4.48, 4.20, 3.95, and all sk=0.05. Compute the gaps and choose k by the standard "one standard error" rule. Why not pick the k with the largest gap?

Read the answer

Unsupervised learning L3 Medium Th+Mat
358
Three points have pairwise distances d12=3, d23=4 and d13=7. Use classical multidimensional scaling (MDS) with double centring to find the matrix B and the 1-D embedding. Why is one dimension enough?

Read the answer

Unsupervised learning L3 Medium Mat
359
How do you show that the directions of maximum variance also minimise the squared reconstruction error of PCA? How do you derive the error for k components in terms of the eigenvalues of the covariance matrix?

Read the answer

Unsupervised learning L3 Long Mat
360
Factor analysis models x=μ+Wz+ϵ, with z∼N(0,Iq) and noise ϵ∼N(0,Ψ) where Ψ is diagonal. (a) What covariance does this imply for x? (b) For d=6 observed variables and q=2 factors, how many free parameters does it use compared with a full covariance, taking the rotation ambiguity into account? (c) How does it differ from PCA?

Read the answer

Unsupervised learning L3 Medium Th+Mat
361
In independent component analysis (ICA) we observe x=As with independent sources s. (a) Why must at most one source be Gaussian? (b) Why is whitening the first step? (c) A source s with unit variance is uniform on [−3,3]. Its excess kurtosis is E[s4]−3. What is it, and what is the kurtosis of (s1+s2)/2 for two independent such sources?

Read the answer

Unsupervised learning L3 Long Th+Mat
362
Five points lie on a unit half-circle at angles 0∘,45∘,90∘,135∘,180∘. Isomap uses a neighbourhood graph in which two points are joined if they are less than 0.8 apart. (a) What is the graph (geodesic) distance between the first and last points, and how does it compare with the straight-line distance and the true arc length? (b) What goes wrong if the radius is too large, for example 1.5?

Read the answer

Unsupervised learning L3 Medium Th+Mat
363
An isolation forest uses sub-samples of size ψ=256 and scores a point with s(x,ψ)=2−E[h(x)]/c(ψ), where c(ψ)=2(ln⁡(ψ−1)+0.5772)−2(ψ−1)ψ. (a) Compute c(256). (b) Find s for average path lengths E[h]=4, 10.24 and 12 and say what each means. (c) Why is c(ψ) in the formula?

Read the answer

Unsupervised learning L3 Medium Th+Mat
364
In alternating least squares (ALS) for matrix factorisation, a user has rated two items, with item vectors q1=(1,0) and q2=(1,1) fixed and ratings 3 and 5. (a) Derive the update that minimises ∑i(ri−p⊤qi)2+λ∥p∥2 for the user vector p. (b) Compute p for λ=1, and for λ=0. (c) Why is ALS attractive for large recommenders?

Read the answer

Unsupervised learning L3 Long Mat
365
Probabilistic PCA models x=Wz+μ+ϵ with z∼N(0,Iq) and ϵ∼N(0,σ2Id). The maximum-likelihood solution is WML=Uq(Λq−σ2I)1/2R and σML2=1d−q∑j>qλj. (a) For d=4 and sample covariance eigenvalues 6,3,0.6,0.4, find σML2 and the scale of each column of WML for q=2. (b) Why does the covariance of the model match the data in the top q directions? (c) How does PPCA relate to ordinary PCA as σ2→0?

Read the answer

Unsupervised learning L3 Long Th+Mat
366
A variational autoencoder's encoder outputs, for a 1-D latent code, a mean μ=1 and standard deviation σ=0.5. (a) Compute KL(N(μ,σ2) ∥ N(0,1)). (b) Draw z by the reparameterisation trick if the noise sample is ε=0.8. (c) Why do we need this trick, and what role does the KL term play compared with a plain autoencoder?

Read the answer

Unsupervised learning L3 Medium Th+Mat
367
For A=(3045), find the singular values, the best rank-1 approximation A1 in the Frobenius norm, and the approximation error. What fraction of the squared Frobenius norm does A1 keep, and why is this the best possible rank-1 choice?

Read the answer

Unsupervised learning L3 Medium Mat
368
For a clustering of data points x1,…,xN into clusters C1,…,CK with centroids μk and overall mean μ, prove that total scatter = within-cluster scatter + between-cluster scatter. Why does this show that minimising k-means cost is the same as maximising between-cluster scatter? How do you check it on the 1-D clusters {1,2} and {6,7}?

Read the answer

Unsupervised learning L3 Medium Mat
369
Centred 2-D data has covariance Σ=(5335). What is a whitening matrix W so that z=Wx has identity covariance? What is z for x=(2,0)⊤, and how do you check that ∥z∥2 equals the Mahalanobis distance of x?

Read the answer

Unsupervised learning L3 Medium Mat
370
Why can exact divisive (top-down) clustering not simply try every possible split of a cluster, and how does DIANA's splinter-group heuristic get around this? How many splits exist for m=5 and m=20 points, and what does one DIANA split give on the 1-D points 0,1,2,9,10 (absolute difference as dissimilarity)?

Read the answer

Unsupervised learning L3 Medium Th+Mat
371
t-SNE maps points xi∈R50 to yi∈R2 by minimising ∑iKL(Pi∥Qi), where pj∣i∝exp⁡(−∥xi−xj∥2/2σ2) in the original space and qj∣i∝(1+∥yi−yj∥2)−1 in the embedding. (a) What happens to the embedding if σ is very large, or very small? (b) How is σ chosen in practice?

Read the answer

Unsupervised learning L4 Medium Th+Mat
372
How is k-means a limiting case of EM for a Gaussian mixture model, and what assumptions about the clusters does this reveal?

Read the answer

Unsupervised learning L4 Medium Th+Mat
373
How can the principal components in a feature space ϕ(x) be found by solving an eigenvalue problem for the n×n kernel matrix K, with Kij=k(xi,xj)=ϕ(xi)⊤ϕ(xj)? How are the coefficients normalised, how is K centred, and how is a new point projected?

Read the answer

Unsupervised learning L4 Long Mat
374
A linear autoencoder with a k-dimensional bottleneck, encoder W1∈Rk×d and decoder W2∈Rd×k, is trained with squared reconstruction error on centred data. How does its solution relate to PCA, and what changes with a nonlinear autoencoder?

Read the answer

Unsupervised learning L4 Medium Th+Mat
375
For a similarity graph with symmetric non-negative weights W and degree matrix D, let L=D−W. How do you prove that f⊤Lf=12∑i,jwij(fi−fj)2, how does this show that the number of zero eigenvalues of L equals the number of connected components, and why does this justify spectral clustering?

Read the answer

Unsupervised learning L4 Medium Mat
376
In locally linear embedding (LLE), the weights wj reconstruct a point x from its neighbours ηj by minimising ∥x−∑jwjηj∥2 subject to ∑jwj=1. (a) Derive the closed-form weights using the local Gram matrix. (b) For x=(0,0) with neighbours η1=(1,0) and η2=(0,2), compute the weights. (c) What is the second stage of LLE, and why is regularisation needed when k>d?

Read the answer

Unsupervised learning L4 Long Mat
377
UMAP builds a weighted neighbour graph with membership strengths μj∣i=exp⁡ ⁣(−(dij−ρi)/σi), where ρi is the distance from i to its nearest neighbour. (a) For a point with k=3 neighbours at distances 1.0, 1.5 and 3.0, find ρ, solve for σ so the strengths sum to log⁡2k, and give the three strengths. (b) How are directed strengths combined into an undirected weight? (c) How do UMAP and t-SNE differ?

Read the answer

Unsupervised learning L4 Long Th+Mat
378
Why is the log-likelihood of a Gaussian mixture unbounded above when each component has its own covariance matrix? How do you show it in one dimension with K=2, and how do EM implementations avoid the problem?

Read the answer

Unsupervised learning L4 Medium Th+Mat
379
For symmetric t-SNE with high-dimensional affinities pij (symmetric, with ∑i≠jpij=1) and low-dimensional affinities qij=(1+∥yi−yj∥2)−1∑k≠l(1+∥yk−yl∥2)−1, how do you derive ∂C∂yi=4∑j(pij−qij)(yi−yj)(1+∥yi−yj∥2)−1 for C=KL(P∥Q)? What do the two terms mean, and why does the Student-t kernel help with the crowding problem?

Read the answer

Unsupervised learning L5 Long Mat
380
How can the k-means objective be written as a trace problem over cluster indicator vectors, and what lower bound on the optimal SSE do you get by relaxing it to orthonormal matrices when the data are centred?

Read the answer

Unsupervised learning L5 Long Mat
381
For a similarity graph with weights W, degrees D and Laplacian L=D−W, how do you derive the relaxation of the two-way normalised cut Ncut(A,B)=cut(A,B)(1vol(A)+1vol(B)) into the generalised eigenproblem Lf=λDf? How do you check the bound on the graph with w12=w34=1, w23=0.1?

Read the answer

Unsupervised learning L5 Long Mat
382
How do you show that DBSCAN* (DBSCAN without border points) at radius ε is the same as cutting a single-linkage tree built on the mutual reachability distance dm(x,y)=max⁡{c(x),c(y),d(x,y)}, where c(x) is the core distance? What does this say about minPts=1 and about the order-dependence of DBSCAN?

Read the answer

Unsupervised learning L5 Long Th+Mat
383
For whitened data z (zero mean, identity covariance), FastICA finds one independent component with the update w+=E[z(w⊤z)3]−3w followed by w←w+/∥w+∥. How do you derive this fixed-point rule from the kurtosis contrast F(w)=E[(w⊤z)4]−3 under ∥w∥=1 using Newton's method?

Read the answer

Unsupervised learning L5 Long Mat
384
Let S be a symmetric positive semi-definite matrix with eigenvalues λ1≥⋯≥λd. How do you prove that over all d×k matrices U with orthonormal columns, tr⁡(U⊤SU) is maximised by the top k eigenvectors, with maximum value λ1+⋯+λk (the Ky Fan theorem)? Why does this justify PCA with k components?

Read the answer

Unsupervised learning L5 Long Mat
385
What is the difference between a perceptron and a logistic (sigmoid) neuron?

Read the answer

Deep learning L1 Short Th
386
Why can a deep network with no non-linear activation functions represent nothing more than a single linear (affine) layer?

Read the answer

Deep learning L1 Short Th
387
What is backpropagation in a neural network, and what roles do the forward pass and the backward pass play during training?

Read the answer

Deep learning L1 Short Th
388
A neural network is trained on 2000 labelled examples with a batch size of 50. What are an epoch, a batch and an iteration, and how many iterations make up one epoch?

Read the answer

Deep learning L1 One-liner Th+Mat
389
What is dropout in a neural network, why does randomly switching off neurons during training reduce overfitting, and what happens at test time?

Read the answer

Deep learning L1 Short Th
390
What does batch normalisation do to the values a layer produces, and why does it help training? What are the new values if a feature takes the values 2 and 4 in a mini-batch?

Read the answer

Deep learning L1 Short Th+Mat
391
What does it mean that a convolutional layer "shares" one small filter across the whole image, and why does that suit images? How many weights does one 3×3 filter need, compared with one fully connected neuron looking at a 28×28 greyscale image?

Read the answer

Deep learning L1 Short Th+Mat
392
What is a "dead" ReLU unit?

Read the answer

Deep learning L1 One-liner Th
393
What is the difference between valid padding and same padding in a stride-1 convolution?

Read the answer

Deep learning L1 One-liner Th
394
When adapting a pretrained image classifier to a new dataset, when should you freeze the backbone and train only a new head versus fine-tuning the whole network?

Read the answer

Deep learning L1 Short Th
395
Why does an ordinary autoencoder need a bottleneck smaller than the input dimension, or an explicit regulariser?

Read the answer

Deep learning L1 One-liner Th
396
A multilayer perceptron takes 10-dimensional inputs, passes them through two hidden layers of widths 32 and 16 (each with biases), and outputs 4 class scores (logits). How many learnable parameters does it have?

Read the answer

Deep learning L1 One-liner Mat
397
What goes wrong if you initialise every weight in a multi-layer perceptron to zero (or to the same non-zero constant c)?

Read the answer

Deep learning L1 Short Th
398
What is data augmentation, why does it reduce overfitting without collecting new labelled examples, and what are two concrete examples where a standard image augmentation like horizontal flipping or 180∘ rotation breaks the ground-truth label?

Read the answer

Deep learning L1 Short Th
399
You plot training and validation loss against epochs. What do the curves look like for (a) underfitting, (b) overfitting and (c) a learning rate that is too high, and what would you do in each case?

Read the answer

Deep learning L2 Short Th
400
A three-class classifier outputs the probability vector y^=[0.3, 0.6, 0.1]⊤, and the true class is the second one. What is the cross-entropy loss?

Read the answer

Deep learning L2 One-liner Mat
401
Let f(x,y)=ax2log⁡(by+c), where the inputs x,y and the parameters a,b,c are all scalars and log⁡ is the natural log. What is the computational graph with intermediate nodes, and how do you use backpropagation on it to compute ∂f/∂b?

Read the answer

Deep learning L2 Medium Mat
402
A convolutional layer takes a 32×32×3 input and applies 16 filters of size 5×5 with stride 1 and padding 2. What is the output shape, and how many learnable parameters does the layer have? What changes if the stride is 2 and the padding is 0?

Read the answer

Deep learning L2 Short Mat
403
What is the receptive field of a unit after three stacked 3×3 convolutions with stride 1, and how does their total parameter count compare with a single 7×7 convolution (both with C input and C output channels, ignoring biases)?

Read the answer

Deep learning L2 Short Mat
404
In dropout with keep probability p, why are the kept activations divided by p during training (inverted dropout), and what goes wrong at test time if you do not scale?

Read the answer

Deep learning L2 Short Th+Mat
405
Why do convolutional neural networks suit image data better than fully connected MLPs, and what is the difference between translation equivariance and translation invariance?

Read the answer

Deep learning L2 Short Th
406
Given the 4×4 single-channel input X=[12013−120021−210−12] and 2×2 filter W=[1−201] with bias b=0, stride 1 and no padding, what is the output after cross-correlation, ReLU activation and 2×2 max pooling with stride 1?

Read the answer

Deep learning L2 Medium Mat
407
An activation tensor of shape 28×28×192 passes through a 1×1 convolutional layer with 64 filters (including biases). What are the output shape, the number of learnable parameters and the multiply-accumulate (MAC) count, and why do architectures such as Inception and ResNet use 1×1 convolutions?

Read the answer

Deep learning L2 Short Mat
408
A small CNN takes a 32×32×3 image through: (1) a 3×3 conv with 16 filters, stride 1, padding 1; (2) 2×2 max pooling, stride 2; (3) a 3×3 conv with 32 filters, stride 1, padding 1; (4) global average pooling; and (5) a 10-class linear head. Including biases, what are the output shape after each layer and the total parameter count, and why does global average pooling avoid a parameter explosion?

Read the answer

Deep learning L2 Medium Mat
409
What single key architectural change did each of AlexNet, VGG, Inception, ResNet and DenseNet introduce over prior CNNs?

Read the answer

Deep learning L2 Medium Th
410
In a U-Net encoder–decoder for image segmentation, why are encoder feature maps concatenated directly to the corresponding decoder layers instead of relying on the bottleneck alone?

Read the answer

Deep learning L2 Short Th
411
How can a two-layer MLP with two ReLU hidden units and a linear output unit compute the XOR function on (x1,x2)∈{0,1}2, and what values do its hidden units and output take on all four inputs?

Read the answer

Deep learning L2 Short Mat
412
In a small computation graph, input x=2 feeds two branches that share the same weight w=3: a=wx and b=(w−1)2, and the loss is L=12(ab−20)2. How do you compute ∂L∂w by backpropagation, and what happens if an implementation overwrites instead of accumulating branch gradients?

Read the answer

Deep learning L2 Short Mat
413
A hidden layer with nin=256 independent inputs (each of mean 0 and variance 1) computes z=w⊤x with zero bias, which gives Var⁡(z)=nin σW2 when weights are drawn independently with mean 0 and variance σW2. What is the standard deviation of z under N(0,1) (σW2=1) versus Xavier-style normal N(0,1/nin) (σW2=1/256), and why does N(0,1) stall training under a tanh⁡ activation?

Read the answer

Deep learning L2 Short Mat
414
Why are bias vectors and normalisation scale/shift parameters (γ,β) usually excluded from L2 weight decay in deep neural networks?

Read the answer

Deep learning L2 One-liner Th
415
Is it true that an additive bias term b in a linear or convolutional layer immediately followed by batch normalisation is redundant, and why?

Read the answer

Deep learning L2 One-liner Th
416
What are the Huber loss Lδ(r) for residual r=y^−y with threshold δ>0 and its derivative Lδ′(r)? For δ=1, what are Lδ(r) and Lδ′(r) at r=0.5 and r=4, and why does Huber loss combine the benefits of MSE and MAE?

Read the answer

Deep learning L2 Medium Th+Mat
417
How does clipping gradients by global L2 norm differ from clipping element-wise by value? Given a gradient vector g=[3,4]⊤ and threshold τ=2, what is the clipped gradient under each method, and which preserves the steepest-descent direction?

Read the answer

Deep learning L2 Short Mat
418
A network uses cosine annealing without restarts from ηmax⁡=0.1 down to ηmin⁡=0 over T=100 steps: ηt=ηmin⁡+12(ηmax⁡−ηmin⁡)(1+cos⁡(πt/T)). What is the learning rate at t=0,25,50,75,100, and why is cosine decay often preferred over step decay?

Read the answer

Deep learning L2 Short Th+Mat
419
A 4×4 feature map X=[1320421501322611] goes through 2×2 pooling with stride 2, giving a 2×2 output. The gradient of the loss with respect to that output is G=[2−10.54]. What is the gradient with respect to X for max pooling and for average pooling?

Read the answer

Deep learning L2 Medium Mat
420
A network has two layers with no activation function. Layer 1 is h=W1x+b1 with W1=[1201], b1=(1,0)⊤. Layer 2 is y^=W2h+b2 with W2=[2011], b2=(0,1)⊤. What single layer W′x+b′ does the same job, and does it agree with the two layers at x=(1,1)⊤?

Read the answer

Deep learning L2 Medium Mat
421
A tiny network has input x=(1,2), two hidden units with h1=ReLU⁡(x1+x2−2) and h2=ReLU⁡(−x1+x2−2), and a linear output y^=2h1+3h2+1. Here ReLU⁡(z)=max⁡(0,z). Compute the hidden values, the output y^, and the squared error (y^−y)2 for the target y=5?

Read the answer

Deep learning L2 Short Mat
422
How do you derive the gradient of the softmax cross-entropy loss with respect to the logits?

Read the answer

Deep learning L3 Short Mat
423
Suppose you train a binary classification network with a sigmoid output using mean-squared error (MSE) instead of cross-entropy. Is training still useful, judging by the gradient of each loss with respect to the logit z (the input to the sigmoid)? How do the two losses look as functions of z for a positive example?

Read the answer

Deep learning L3 Medium Th+Mat
424
For a two-layer network h=ReLU⁡(W1x+b1), y^=softmax⁡(W2h+b2), trained with cross-entropy on one example with true class c, what are the gradients of the loss with respect to W1,b1,W2,b2 in matrix form, and do their shapes check out?

Read the answer

Deep learning L3 Long Mat
425
How does the product of layer Jacobians explain vanishing and exploding gradients in a deep feed-forward network, and why are sigmoid networks especially prone to vanishing gradients?

Read the answer

Deep learning L3 Medium Th+Mat
426
What is the batch normalisation forward pass for one feature? For a mini-batch of activations [1,2,3,6] with γ=2, β=1 and ϵ≈0, what are the outputs? What changes at inference time, and why do transformers use layer normalisation instead?

Read the answer

Deep learning L3 Medium Th+Mat
427
How does the multiply-accumulate cost of a standard k×k convolution compare with that of a depthwise separable convolution (k×k depthwise followed by 1×1 pointwise), for an H×W output with Cin input and Cout output channels? What is the ratio for k=3 and Cout=256?

Read the answer

Deep learning L3 Short Mat
428
With label smoothing ϵ on K classes, what is the target distribution, and what is the gradient of the cross-entropy loss with respect to the logits? For K=3, ϵ=0.1 and true class 2, what are the target vector and the logit gap the model is pushed towards?

Read the answer

Deep learning L3 Short Mat
429
How do you derive the Xavier (Glorot) and He initialisation variances from the requirement that activation variance stays constant from layer to layer?

Read the answer

Deep learning L3 Long Mat
430
In a variational autoencoder (VAE), the encoder outputs mean μ=1.5 and log-variance log⁡σ2=ln⁡4 for a scalar latent variable z∼N(μ,σ2). How does the reparameterisation trick produce z for auxiliary noise ε=−0.5, why is it needed for backpropagation, and what are ∂z/∂μ and ∂z/∂(log⁡σ2)?

Read the answer

Deep learning L3 Short Mat
431
An undirected 3-node path graph 1−2−3 has initial scalar features H(0)=[2−34]. Using one Kipf–Welling graph convolutional layer H(1)=ReLU⁡(D~−1/2A~D~−1/2H(0)W) with A~=A+I, D~ii=∑jA~ij and scalar weight W=1, what is H(1)?

Read the answer

Deep learning L3 Medium Mat
432
What is a dilated (atrous) convolution with dilation factor d? For a 1-D input of length L, what are the output length and the receptive field after two stacked 3×1 convolutions with stride 1, no padding and dilations d1=1 and d2=2, and why does exponential dilation (d=1,2,4,…) avoid the gridding problem?

Read the answer

Deep learning L3 Medium Mat
433
A single-channel 3×3 input X=[102210031] is cross-correlated (no padding, stride 1, no bias) with a 2×2 kernel W, giving output Y. Given upstream loss gradient ∂L∂Y=[1−120], what is ∂L∂W, and how is ∂L∂X computed in general?

Read the answer

Deep learning L3 Medium Mat
434
How does a transposed convolution upsample a feature map (give its output size formula for input size n, kernel k, stride s and padding p), and why does it often create checkerboard artefacts when k is not divisible by s?

Read the answer

Deep learning L3 Short Th+Mat
435
A ResNet bottleneck block maps 256 channels to 256 channels via a 1×1 conv (to 64), a 3×3 conv (at 64) and a 1×1 conv (to 256), ignoring biases. How many parameters and MACs per spatial position does it use compared with a basic block of two 3×3 convs at 256 channels, and how does the same 1×1 idea cut the cost of a 5×5 Inception branch (192→32 channels via 16 bottleneck channels)?

Read the answer

Deep learning L3 Medium Mat
436
How does a DenseNet block differ from a ResNet block in how earlier features are combined, what is the channel count entering layer l (with initial channels k0 and growth rate k), and what is the trade-off between parameter efficiency and GPU memory?

Read the answer

Deep learning L3 Short Th+Mat
437
In a VAE with prior p(z)=N(0,I) and diagonal Gaussian encoder qϕ(z∣x)=N(μ,diag⁡(σ12,…,σd2)), how do you derive the closed-form KL divergence DKL(qϕ(z∣x) ∥ p(z)), and what does each term encourage?

Read the answer

Deep learning L3 Long Mat
438
For the minimax GAN objective min⁡Gmax⁡DV(D,G)=Ex∼pdata[log⁡D(x)]+Ez∼pz[log⁡(1−D(G(z)))], how do you derive the optimal discriminator DG∗(x) for a fixed generator G, and show that substituting DG∗ reduces the generator objective to 2DJS(pdata∥pg)−log⁡4?

Read the answer

Deep learning L3 Long Mat
439
In SimCLR with a mini-batch of N images (giving 2N augmented views), write the NT-Xent (InfoNCE) loss for a positive pair (i,j) with cosine similarity si,j and temperature τ. Why is this a (2N−1)-way cross-entropy loss, and how does τ affect the gradients?

Read the answer

Deep learning L3 Medium Mat
440
What is the general message-passing neural network (MPNN) update for node v, and how do you prove that relabelling nodes with any permutation matrix P makes a node-level GNN layer permutation-equivariant while global sum or mean pooling makes a graph-level readout permutation-invariant?

Read the answer

Deep learning L3 Medium Th+Mat
441
Consider a small ReLU network with input x=[1,−1]⊤, hidden layer z(1)=W(1)x with W(1)=[1−1−12], h=ReLU⁡(z(1)), and scalar output y^=w(2)⊤h with w(2)=[2,−1]⊤ (no biases). For target y=3 and squared loss L=12(y^−y)2, what are the exact gradients ∂L∂w(2) and ∂L∂W(1)?

Read the answer

Deep learning L3 Medium Mat
442
For a mini-batch of N examples stacked as rows in X∈RN×d, a two-layer network computes Z=XW1+1b1⊤, H=ϕ(Z) and Y^=HW2+1b2⊤, where W1∈Rd×m, b1∈Rm, W2∈Rm×K, b2∈RK and 1∈RN is the all-ones vector. Given the batch-averaged loss gradient Δ2=∂L∂Y^∈RN×K, what are the gradients with respect to W2,b2,W1,b1, and how do matrix dimensions verify the transposes?

Read the answer

Deep learning L3 Medium Mat
443
How do you express the derivatives of σ(z)=11+e−z and tanh⁡(z)=ez−e−zez+e−z purely in terms of σ(z) and tanh⁡(z), what are their maximum values, and why is tanh⁡ generally preferred over σ in hidden layers?

Read the answer

Deep learning L3 Medium Th+Mat
444
For p=softmax⁡(z)∈RK, how do you derive the full Jacobian matrix J=∂p∂z for both diagonal (i=j) and off-diagonal (i≠j) entries, and why does shifting every logit by a constant c leave p unchanged?

Read the answer

Deep learning L3 Medium Mat
445
What are the GELU and SiLU (Swish) activation functions, what is the exact derivative of SiLU⁡(z)=z σ(z), and why do modern deep architectures often prefer them over ReLU?

Read the answer

Deep learning L3 Short Th+Mat
446
Using the update convention vt=βvt−1+∇f(⋅) and θt=θt−1−ηvt, how does Nesterov accelerated gradient (NAG) differ from classical momentum, and for f(θ)=12θ2 with θ0=1, v0=4, β=0.5 and η=0.5, what is θ1 under each method?

Read the answer

Deep learning L3 Medium Th+Mat
447
What are the per-parameter update rules for AdaGrad and RMSProp, why does AdaGrad’s effective step size decay towards zero in deep learning, and for a constant gradient gt=2 with base learning rate η=0.1, decay rate ρ=0.9 and stability constant ϵ=0, what are the effective learning rates after 100 steps under AdaGrad versus RMSProp (at steady state)?

Read the answer

Deep learning L3 Medium Th+Mat
448
A convolutional layer outputs a tensor of shape (N,C,H,W)=(8,12,16,16) (batch size, channels, height, width). Over which axes are the mean and variance computed, how many distinct (μ,σ2) pairs are computed per batch, and how many learnable scale and shift parameters (γ,β) exist (assuming one pair per channel) for (a) batch normalisation, (b) layer normalisation, (c) instance normalisation and (d) group normalisation with G=3 groups?

Read the answer

Deep learning L3 Medium Mat
449
For binary classification with logit z∈R and target y∈{0,1}, evaluating −(ylog⁡σ(z)+(1−y)log⁡(1−σ(z))) naively can overflow e−z or take log⁡(0). How do you derive the numerically stable form max⁡(z,0)−zy+log⁡(1+e−∣z∣), and what value does it give at z=−2,y=1?

Read the answer

Deep learning L3 Short Mat
450
How does focal loss FL⁡(pt)=−(1−pt)γlog⁡pt modify cross-entropy for extreme class imbalance, where pt is the predicted probability for the true class and γ≥0 is the focusing parameter? What is the ratio of the loss on a hard example (pt=0.1) to an easy example (pt=0.9) for γ=0 versus γ=2, and why does this help?

Read the answer

Deep learning L3 Medium Th+Mat
451
A scalar parameter starts at θ0=1 and is trained with Adam using learning rate η=0.1, β1=0.9, β2=0.999 and ϵ=10−8. The first two gradients are g1=0.4 and g2=−0.2. What are θ1 and θ2, and what would the first step have been without bias correction?

Read the answer

Deep learning L3 Medium Mat
452
You have implemented backpropagation by hand and want to test it with gradient checking. Why is the central difference J(w+h)−J(w−h)2h preferred to the forward difference, how do you compare it with your analytic gradient, and what goes wrong if h is too large or too small? Illustrate with J(w)=w3 at w=2 and h=0.1?

Read the answer

Deep learning L3 Medium Th+Mat
453
A network has input x=(1,2)⊤, two hidden units, and one linear output y^=a1w21+a2w22+b2. All weights and biases start at 0. The loss is 12(y^−1)2 and the learning rate is 1. What happens over two gradient-descent steps (a) with sigmoid hidden units and (b) with ReLU hidden units, and what happens to the two hidden units?

Read the answer

Deep learning L3 Medium Mat
454
How do you derive the recurrence for the receptive field of a stack of convolution and pooling layers with kernel sizes kl and strides sl, and what receptive field does it give for a unit in (a) a 3×3 conv with stride 2 followed by two 3×3 convs with stride 1, and (b) a 3×3 conv with stride 1, a 2×2 max-pool with stride 2, then two 3×3 convs with stride 1?

Read the answer

Deep learning L3 Medium Th+Mat
455
Why do residual connections make very deep networks trainable?

Read the answer

Deep learning L4 Medium Th
456
Why is L2 regularisation not the same as weight decay when training with Adam, and what does AdamW change?

Read the answer

Deep learning L4 Medium Th+Mat
457
What does the universal approximation theorem say for networks with one hidden layer, what does it not guarantee, and why are deep networks used anyway?

Read the answer

Deep learning L4 Medium Th
458
Why can a deterministic autoencoder not generate realistic new images by sampling from its latent space, and how does the VAE’s KL term fix this? What is posterior collapse in VAEs, when does it happen, and how do β-VAE and KL annealing address it?

Read the answer

Deep learning L4 Medium Th
459
Why do gradients of the original minimax GAN objective vanish when pdata and pg have disjoint supports, what is mode collapse, and how does the Wasserstein-1 distance in WGAN fix both?

Read the answer

Deep learning L4 Medium Th+Mat
460
In a denoising diffusion probabilistic model (DDPM), the forward process is q(xt∣xt−1)=N(xt;1−βt xt−1, βtI). How do you derive the closed-form marginal q(xt∣x0)=N(xt;αˉt x0, (1−αˉt)I) with αt=1−βt and αˉt=∏s=1tαs, and why does predicting the noise ε match predicting the score ∇xtlog⁡q(xt∣x0)?

Read the answer

Deep learning L4 Long Mat
461
At DDPM reverse step t with αt=0.81, βt=0.19, αˉt=0.36 and scalar noisy value xt=1.09, a trained noise network predicts εθ(xt,t)=0.8. What is the estimated clean signal x^0, and what is the reverse-step mean μθ(xt,t) used to sample xt−1?

Read the answer

Deep learning L4 Medium Mat
462
In joint-embedding self-supervised learning, what is representation collapse, why does simply maximising similarity between two augmented views fail, and how do contrastive methods (SimCLR), asymmetric self-distillation (BYOL, DINO) and covariance methods (Barlow Twins, VICReg) prevent it?

Read the answer

Deep learning L4 Medium Th
463
What is over-smoothing in deep graph convolutional networks (GCNs), why does repeated multiplication by A^=D~−1/2A~D~−1/2 push node representations towards a low-dimensional subspace, and how do residual connections, Jumping Knowledge (JK-Net) or DropEdge mitigate it?

Read the answer

Deep learning L4 Medium Th+Mat
464
At most how many linear regions can a 1-D ReLU network with one hidden layer of m units create, and how can composing L hidden layers of width 2 create 2L linear regions instead?

Read the answer

Deep learning L4 Long Mat
465
What is orthogonal weight initialisation, why does it preserve both forward activation norms and backward gradient norms exactly in a deep linear network with nin=nout, and what gain factor should scale it when used with ReLU?

Read the answer

Deep learning L4 Medium Mat
466
Excluding the weights and gradients themselves, how much optimiser-state memory per parameter (in fp32) do plain SGD, SGD with momentum and Adam require, and why can SGD with momentum still beat Adam on test accuracy in image classification benchmarks?

Read the answer

Deep learning L4 Medium Th+Mat
467
Why is standard test-time weight scaling in dropout only an exact ensemble average for a single linear layer, and how does Monte Carlo (MC) dropout use dropout at inference time to estimate predictive uncertainty?

Read the answer

Deep learning L4 Medium Th
468
For a quadratic loss J(w)=12(w−w∗)⊤H(w−w∗) with symmetric positive definite Hessian H (whose largest eigenvalue is λmax⁡(H)), started at w0=0 with gradient descent step size 0<η<1/λmax⁡(H), how do you show that stopping after t iterations acts approximately like L2 regularisation with penalty λ≈1ηt?

Read the answer

Deep learning L4 Long Mat
469
Taking ϵ→0, how do you prove that batch normalisation makes a layer’s output invariant to positive scalar rescaling of its weights, BN⁡(cWx)=BN⁡(Wx) for any c>0, and what does this imply for the weight gradient ∇cWL and the effective learning rate during SGD?

Read the answer

Deep learning L4 Long Mat
470
Why do modern deep networks such as Transformers and large-batch CNNs typically start training with a learning-rate warm-up instead of immediately using the peak learning rate?

Read the answer

Deep learning L4 Medium Th
471
What is epoch-wise double descent in deep neural networks, why can test error spike mid-training before falling again as training continues, and how do weight decay, data augmentation and early stopping affect the double-descent peak in practice?

Read the answer

Deep learning L4 Medium Th
472
Consider an overparameterised linear model Xw=y with X∈Rn×d, d>n and rank⁡(X)=n, trained to minimise L(w)=12∥Xw−y∥22 by gradient descent from w0=0. How do you prove that if gradient descent converges to an interpolating solution, it must converge to the unique minimum-ℓ2-norm interpolator w∗=X⊤(XX⊤)−1y, and what changes if w0≠0?

Read the answer

Deep learning L4 Long Mat
473
For linear regression y^=∑iwixi with inverted dropout on the inputs (keep probability p), why does the expected squared loss equal the ordinary squared loss plus an adaptive L2 penalty? What is the closed-form solution, and what does the penalty say about how dropout regularises?

Read the answer

Deep learning L5 Long Mat
474
In a DDPM, why is the reverse-time conditional q(xt−1∣xt,x0) tractable when conditioned on x0 even though q(xt−1∣xt) is not, and how do you derive its mean μ~t(xt,x0) and variance β~t by completing the square in Bayes’ rule?

Read the answer

Deep learning L5 Long Mat
475
For a positive pair (x,y)∼p(x,y) and K−1 independent negative samples y2,…,yK∼p(y) with critic score f(x,y), how do you prove that minimising the InfoNCE loss LK=−E[log⁡ef(x,y)ef(x,y)+∑j=2Kef(x,yj)] maximises a lower bound on the mutual information I(X;Y)≥log⁡K−LK, and what is the optimal critic f∗(x,y)?

Read the answer

Deep learning L5 Long Mat
476
Why is the expressive power of standard message-passing GNNs bounded by the 1-Weisfeiler–Lehman (1-WL) graph isomorphism test, what is an explicit pair of non-isomorphic graphs (with identical node features) that GCNs cannot distinguish, and what architectural changes go beyond 1-WL?

Read the answer

Deep learning L5 Long Th+Mat
477
What is a recurrent neural network, and how does its hidden state act as a memory of the sequence so far? What is meant by 'unrolling' the network through time?

Read the answer

Sequence models and transformers L1 Short Th
478
In a recurrent neural network, what is a "gate", and how does a number between 0 and 1 act like a tap that controls how much information passes through?

Read the answer

Sequence models and transformers L1 Short Th
479
When we train a model to write a sentence one word at a time, what does it mean to feed it the correct previous words during training, and why might that cause trouble later?

Read the answer

Sequence models and transformers L1 Short Th
480
In attention, what do the query, keys and values stand for, and how is the output a weighted average? If the attention weights over three values 10,20,30 are 0.7,0.2,0.1, what is the output?

Read the answer

Sequence models and transformers L1 Short Th+Mat
481
Why does a transformer need positional encodings?

Read the answer

Sequence models and transformers L1 One-liner Th
482
What is the difference between the skip-gram and CBOW models of word2vec, and when would you prefer each?

Read the answer

Sequence models and transformers L1 Short Th
483
Why does a maximum-likelihood n-gram language model fail on unseen n-grams, and what does smoothing do about it?

Read the answer

Sequence models and transformers L1 Short Th
484
What is the difference between greedy decoding and beam search for generating a sequence? Why is neither guaranteed to find the most probable sequence?

Read the answer

Sequence models and transformers L1 Short Th
485
How do the training objectives of BERT (masked language modelling) and GPT (causal language modelling) differ, and what does each allow the model to attend to?

Read the answer

Sequence models and transformers L1 Short Th
486
How much memory do the weights of a 7-billion-parameter LLM (large language model) need in fp32, fp16, int8 and int4? What are these four number formats, why does lower precision help, and what else uses GPU (graphics processing unit) memory at inference time?

Read the answer

Sequence models and transformers L1 Short Th+Mat
487
What is retrieval-augmented generation (RAG), and when should you choose it instead of fine-tuning an LLM (large language model)?

Read the answer

Sequence models and transformers L1 Short Th
488
What is teacher forcing when training a sequence-to-sequence decoder, and what is exposure bias?

Read the answer

Sequence models and transformers L2 Short Th
489
How is causal (look-ahead) masking implemented in decoder self-attention? What is the mask for a sequence of length 4, and why are masked logits set to −∞ rather than the attention weights being set to 0?

Read the answer

Sequence models and transformers L2 Short Th+Mat
490
What are the time and memory costs of one self-attention layer for sequence length n and model dimension d? For n=4096 and d=1024, which part dominates?

Read the answer

Sequence models and transformers L2 Short Mat
491
How many parameters does a multi-head self-attention layer with dmodel=512 and h=8 heads have (with biases)? Does the number of heads change the count? How many does a full transformer encoder layer with feed-forward width dff=2048 have?

Read the answer

Sequence models and transformers L2 Short Mat
492
A language model assigns probabilities 0.5, 0.25, 0.125 and 0.5 to the four tokens of a test sentence (each conditioned on the tokens before it). What is the perplexity? What is the perplexity of a model that is uniform over a vocabulary of size V?

Read the answer

Sequence models and transformers L2 Short Mat
493
The corpus word counts are: hug ×10, pug ×5, pun ×12, bun ×4, hugs ×5. Starting from single characters, what are the first three merges of byte-pair encoding (BPE), done by hand? How are the words "bugs" and "mug" then tokenised?

Read the answer

Sequence models and transformers L2 Medium Mat
494
What are the two gates of a GRU and what does each control? How is a GRU different from an LSTM?

Read the answer

Sequence models and transformers L2 Short Th
495
A training corpus has three sentences: "⟨s⟩ i like tea ⟨/s⟩", "⟨s⟩ i like coffee ⟨/s⟩" and "⟨s⟩ you like tea ⟨/s⟩". The vocabulary of predicted words is {i, you, like, tea, coffee, ⟨/s⟩}, so V=6. Using add-one smoothing, what is the bigram probability of the sentence "⟨s⟩ you like coffee ⟨/s⟩", and what does the unsmoothed MLE give?

Read the answer

Sequence models and transformers L2 Medium Mat
496
Reference: "the cat is on the mat" (6 words). Candidate 1: "the the the the the the the". Candidate 2: "the cat mat". (a) What is the clipped unigram precision of Candidate 1? (b) For Candidate 2, what are the unigram precision and the brevity penalty, so what is its unigram-only BLEU?

Read the answer

Sequence models and transformers L2 Medium Mat
497
Three tokens have embeddings x1=(1,0), x2=(0,1) and x3=(1,1). Take Q=K=V=X (no projection matrices) and dk=2. What are the attention weights and output for token 1 using scaled dot-product attention?

Read the answer

Sequence models and transformers L2 Medium Mat
498
A language model gives logits (2,1,0,−1) for four tokens. What are the sampling probabilities at temperature T=1, T=0.5 and T=2? What happens as T→0 and as T→∞?

Read the answer

Sequence models and transformers L2 Medium Mat
499
A weight matrix W0∈R4096×4096 is adapted with LoRA of rank r=8. How many trainable parameters does LoRA add for this matrix, and what fraction of the full matrix is that? If LoRA is applied to the query and value matrices of all 32 layers, how many trainable parameters is that in total?

Read the answer

Sequence models and transformers L2 Short Mat
500
A scalar RNN has ht=tanh⁡(w ht−1+u xt) with w=0.5, u=1 and h0=0. For inputs x1=1 and x2=−1, what are h1, h2 and the gradient ∂h2/∂h1?

Read the answer

Sequence models and transformers L2 Medium Mat
501
Take the sinusoidal positional encoding with dmodel=4, ordered as (sin⁡,cos⁡) pairs, PE(pos,2i)=sin⁡ ⁣(pos/100002i/d) and PE(pos,2i+1)=cos⁡ ⁣(pos/100002i/d). What is the vector for position pos=2?

Read the answer

Sequence models and transformers L2 Short Mat
502
A transformer layer-norm sees the feature vector x=(1,3,5,7) for one token, with γ=2, β=1 for every feature and ϵ=0. What is the output? How does the statistics axis of layer norm differ from batch norm?

Read the answer

Sequence models and transformers L2 Medium Mat
503
An encoder gives hidden states h1=(1,0), h2=(0,1) and h3=(1,1). The decoder state is s=(2,1). Using Luong dot-product attention, compute the attention weights and the context vector. How does Bahdanau (additive) attention differ?

Read the answer

Sequence models and transformers L2 Medium Th+Mat
504
A model gives next-token probabilities (0.50, 0.20, 0.15, 0.10, 0.05) for tokens A–E. What is the sampling distribution under top-k with k=2, and under nucleus (top-p) sampling with p=0.8? Why is nucleus sampling often preferred to a fixed k?

Read the answer

Sequence models and transformers L2 Medium Th+Mat
505
In BERT's masked language modelling, 15% of tokens are chosen for prediction. Of those, 80% become [MASK], 10% become a random token and 10% stay unchanged. What fraction of all tokens are in each case? Why not simply use [MASK] every time?

Read the answer

Sequence models and transformers L2 Medium Th+Mat
506
Training compute is approximately C≈6ND FLOPs for N parameters and D tokens. The Chinchilla result suggests a compute-optimal ratio of about D≈20N. (a) For C=1023 FLOPs, what N and D are compute-optimal? (b) How many tokens and how much compute does a compute-optimal 7B model need? (c) How much compute does a 70B model trained on 1.4T tokens use?

Read the answer

Sequence models and transformers L2 Medium Mat
507
Two finished hypotheses have token probabilities H1=(0.4, 0.5) and H2=(0.6, 0.6, 0.6, 0.6). Which one does beam search prefer by raw log-probability? Which by average log-probability, and which by GNMT length normalisation log⁡P/((5+∣Y∣)/6)? What bias does this show?

Read the answer

Sequence models and transformers L2 Medium Mat
508
A single-layer LSTM has input size 128 and hidden size 256. How many trainable parameters does it have (one bias vector per gate), and how does the count compare with a GRU and a plain RNN of the same sizes? What changes if the LSTM is bidirectional?

Read the answer

Sequence models and transformers L2 Short Mat
509
In scaled dot-product attention, why divide QK⊤ by dk, where Q and K are the query and key matrices and dk is the key dimension?

Read the answer

Sequence models and transformers L3 Short Th+Mat
510
For a vanilla RNN ht=tanh⁡(Wht−1+Uxt+b) with loss L=∑tLt, how does backpropagation through time give ∂LT/∂hk for k<T, and why do gradients over long time spans vanish or explode?

Read the answer

Sequence models and transformers L3 Long Mat
511
What are the LSTM cell equations, and why does the cell state ease the vanishing-gradient problem of a vanilla RNN? How does a GRU differ, and how many parameters does each have for input size 100 and hidden size 128?

Read the answer

Sequence models and transformers L3 Medium Th+Mat
512
In an RNN encoder–decoder for translation, what is the bottleneck problem, and how does attention fix it? What are the equations for the context vector at decoder step t, and what is the context vector for scores [2,0,1] over three encoder states with (scalar) values h=[1,2,3]?

Read the answer

Sequence models and transformers L3 Medium Th+Mat
513
What is the KV cache in autoregressive transformer decoding? How does it change the cost of generating each token, and how much memory does it need for a 32-layer model with dmodel=4096, a context of 4096 tokens, and fp16 values?

Read the answer

Sequence models and transformers L3 Medium Th+Mat
514
Skip-gram with negative sampling uses the loss J=−log⁡σ(uo⊤vc)−∑k=1Klog⁡σ(−uk⊤vc), where vc is the centre-word vector, uo the true context vector and uk the vectors of K sampled negative words. Derive ∂J/∂vc. Then, for vc=(1,0), uo=(0.5,0.5) and one negative u1=(1,−1), what are the gradient and the result of one SGD step with learning rate 0.1?

Read the answer

Sequence models and transformers L3 Long Mat
515
In skip-gram with a full softmax, P(o∣c)=exp⁡(uo⊤vc)∑wexp⁡(uw⊤vc) and the loss is J=−log⁡P(o∣c). Show that ∂J/∂vc=∑wP(w∣c) uw−uo. For a three-word vocabulary with u1=(1,0), u2=(0,1), u3=(−1,0), centre vector vc=(1,1) and true context word o=1, what is the gradient?

Read the answer

Sequence models and transformers L3 Long Mat
516
How does the GloVe objective J=∑i,jf(Xij)(wi⊤w~j+bi+b~j−log⁡Xij)2 arise from the idea that meaning is carried by ratios of co-occurrence probabilities? What is the role of f?

Read the answer

Sequence models and transformers L3 Long Th+Mat
517
For a GRU with ht=(1−zt)⊙ht−1+zt⊙h~t, what is the direct term in ∂ht/∂ht−1, and why does a small zt let gradients survive many steps? If zt=0.01 at every step, what does that direct path contribute over 100 steps?

Read the answer

Sequence models and transformers L3 Medium Mat
518
Count the matrix-multiply FLOPs of one transformer layer's forward pass for sequence length n=2048, model width d=1024 and feed-forward width dff=4d (one sequence, ignoring softmax, layer norm and biases). Which part dominates, and at what n does attention's n2 term equal the linear-in-n part?

Read the answer

Sequence models and transformers L3 Long Mat
519
Assume GPT-2 small has 12 layers, d=768, feed-forward width 3072, vocabulary 50,257 and context length 1024 with learned positional embeddings, and output weights tied to the token embedding, where each projection has a bias and each layer has two layer norms. How many parameters does it have?

Read the answer

Sequence models and transformers L3 Long Mat
520
A corpus has the words low (×5), lower (×2), newest (×6) and widest (×3), each split into characters. BPE merges the most frequent adjacent pair. WordPiece merges the pair with the highest score c(ab)c(a) c(b). Which pair does each choose first, and why do they differ?

Read the answer

Sequence models and transformers L3 Long Mat
521
LoRA computes h=W0x+αrBAx, where B∈Rd×r is initialised to zero and A∈Rr×k is random. How do you show that at initialisation the model equals the pre-trained one, what are the gradients ∂L/∂A and ∂L/∂B at the start, and what is the α/r factor for?

Read the answer

Sequence models and transformers L3 Long Mat
522
For a vanilla RNN with ht=tanh⁡(Wht−1+Uxt), show that ∥∂hT/∂h0∥≤(σmax⁡(W))T, where σmax⁡ is the largest singular value. What does this say for σmax⁡=0.9 and 1.1 over T=50 steps? How does gradient-norm clipping help, for example when the gradient norm is 25 and the threshold is 5?

Read the answer

Sequence models and transformers L3 Medium Mat
523
Let a=softmax(s) be attention weights over scores s. Derive the Jacobian ∂ai/∂sj and the backward rule ∂L/∂s=a⊙(g−(a⊤g)1) where g=∂L/∂a. For a=(0.7,0.2,0.1) and g=(1,0,−1), compute ∂L/∂s, and again for the peaky a=(0.98,0.01,0.01). What does this say about saturated attention?

Read the answer

Sequence models and transformers L3 Long Mat
524
A decoder has 32 layers, 32 query heads of dimension 128 (dmodel=4096) and stores keys and values in 16-bit floats (2 bytes). How large is the KV cache for one sequence of 4096 tokens with multi-head attention (MHA), grouped-query attention with 8 KV heads (GQA), and multi-query attention (MQA, one KV head)? How many parameters does GQA save in the K and V projections?

Read the answer

Sequence models and transformers L3 Medium Mat
525
Show that the cross-entropy of a model q on text from the true distribution p equals H(p)+KL(p∥q), so perplexity can never go below 2H(p). Why can the perplexities of two models with different tokenisers not be compared directly, and how do you convert to bits per character? For a model with perplexity 20 per token and 4.5 characters per token, what is the bits per character?

Read the answer

Sequence models and transformers L3 Long Th+Mat
526
Interpolated absolute discounting uses P(w∣v)=max⁡(c(vw)−d,0)c(v)+λ(v)Plow(w) with 0<d<1. Choose λ(v) so that the distribution sums to 1, and prove it. Then explain why Kneser–Ney replaces the lower-order unigram by the continuation probability Pcont(w)=N1+(∙w)N1+(∙∙), and check that this also sums to 1. If c(v)=10 with 4 distinct followers and d=0.75, what is λ(v)?

Read the answer

Sequence models and transformers L3 Long Th+Mat
527
In connectionist temporal classification (CTC), an acoustic model gives, for each of T=4 frames, a distribution over the symbols {a,b,blank}. How are alignments mapped to labels, how many alignments of length 4 collapse to the label "ab", how many to "aa", and what is the probability of "ab" if every frame is uniform over the three symbols?

Read the answer

Sequence models and transformers L3 Medium Mat
528
ALiBi adds no positional embedding. It adds a bias −m(i−j) to the attention score between query position i and key position j≤i, with a head-specific slope m. For a query at position 4 whose four raw scores are all equal, what attention weights result when m=0.5 and when m=1/16? Give the slopes for 8 heads, and explain why ALiBi can help a model run on longer sequences than it was trained on?

Read the answer

Sequence models and transformers L3 Medium Th+Mat
529
A unigram language-model tokeniser has the vocabulary and probabilities h 0.10, u 0.10, g 0.10, s 0.10, hu 0.10, ug 0.10, hug 0.20, gs 0.05, ugs 0.15. Which segmentation of "hugs" does it choose, how is it found efficiently, and how does this differ from BPE?

Read the answer

Sequence models and transformers L3 Medium Mat
530
A mixture-of-experts layer has 4 experts, each a feed-forward block with dmodel=1024 and hidden width 4096 (two weight matrices, no biases), and a router that picks the top 2 experts per token. For router logits (2,1,0.5,−1) over the four experts, what are the gate weights of the top-2 experts? Compare the total and active parameters of the layer with one dense feed-forward block, and compute the load-balancing loss N∑ifiPi for f=(0.4,0.3,0.2,0.1) and P=(0.35,0.30,0.20,0.15) for these N=4 experts?

Read the answer

Sequence models and transformers L3 Medium Mat
531
An encoder gives states h1=(1,0), h2=(0,1) and h3=(−1,1). The decoder state is s=(1,1). Bahdanau (additive) attention scores each state as ej=v⊤tanh⁡(Wss+Whhj), here with Ws=Wh=I and v=(1,−1). Compute the attention weights and the context vector, and say when additive attention is preferred to dot-product scoring?

Read the answer

Sequence models and transformers L3 Medium Mat
532
In an encoder–decoder transformer with dmodel=512 and 8 heads, a decoder layer cross-attends to an encoder output of length S=50 while it has T=20 target tokens. What are the shapes of Q, K and V and of the score matrix, which projections cost the most, and why does cross-attention need no causal mask?

Read the answer

Sequence models and transformers L3 Medium Mat
533
How much GPU memory do model states take when fine-tuning a 7-billion-parameter model with mixed-precision Adam under (a) full fine-tuning, (b) LoRA with 20 million trainable adapter parameters on an fp16 base, and (c) QLoRA with a 4-bit NormalFloat base? How do NF4, double quantisation and paged optimisers work, and what is the trade-off?

Read the answer

Sequence models and transformers L3 Medium Mat
534
Why is autoregressive LLM decoding at batch size 1 memory-bandwidth bound? For a 7-billion-parameter fp16 model (14 GB) on a GPU with 2 TB/s memory bandwidth and 300 TFLOP/s of fp16 compute, what is the upper bound on tokens/s at batch size 1, what is the arithmetic intensity, and near what batch size does decoding reach the compute ridge point?

Read the answer

Sequence models and transformers L3 Medium Mat
535
In speculative decoding, a draft model proposes k tokens and each is accepted independently with probability α. How do you derive the expected number of tokens produced per target-model forward pass, what is its value for α=0.8 and k=4, and what is the expected speedup if one draft forward pass costs c=0.05 of a target forward pass?

Read the answer

Sequence models and transformers L3 Medium Mat
536
What is the sinusoidal positional encoding, and why is PEpos+k a linear function of PEpos? How do rotary position embeddings (RoPE) make attention scores depend only on relative position?

Read the answer

Sequence models and transformers L4 Medium Th+Mat
537
How can softmax attention be written as a kernel smoother? Why does replacing exp⁡(q⊤k) by a feature-map kernel ϕ(q)⊤ϕ(k) reduce the cost from O(n2d) to O(nd2)? How can causal linear attention be computed as an RNN, and what is lost?

Read the answer

Sequence models and transformers L4 Medium Mat
538
A transformer block can be written post-LN, xl+1=LN(xl+Fl(xl)), or pre-LN, xl+1=xl+Fl(LN(xl)). How do gradients flow back through L layers in the two, and why does post-LN usually need learning-rate warm-up?

Read the answer

Sequence models and transformers L4 Long Th+Mat
539
What is an induction head, and how can a two-layer attention-only transformer use a pair of heads to complete a pattern such as [A][B]…[A]→[B]? What evidence ties induction heads to in-context learning?

Read the answer

Sequence models and transformers L4 Long Th
540
How do you show that skip-gram with negative sampling, with K negatives per positive pair, has an optimum at w⊤c=PMI(w,c)−log⁡K for each (word, context) pair, so it implicitly factorises a shifted PMI matrix (Levy and Goldberg). What assumptions do you need?

Read the answer

Sequence models and transformers L4 Long Mat
541
Assume the loss follows L(N,D)=E+ANα+BDβ and training compute is C=6ND. Derive the compute-optimal N⋆(C) and D⋆(C) and their scaling exponents. What do α=0.34 and β=0.28 imply?

Read the answer

Sequence models and transformers L4 Long Mat
542
FlashAttention computes softmax attention one block of keys at a time, without storing the full score matrix. Derive the online softmax recurrence that keeps a running maximum m and a running sum ℓ, and test it on the scores (1,3,2,5) split into the blocks (1,3) and (2,5) with values (1,2,3,4)?

Read the answer

Sequence models and transformers L4 Long Th+Mat
543
Prove that a transformer encoder layer without positional encodings is permutation-equivariant: permuting the input tokens permutes the outputs in the same way. How do you show that a decoder with a causal mask and no positional encodings is not, and that it can still recover position information?

Read the answer

Sequence models and transformers L5 Long Th+Mat
544
In speculative decoding, a small draft model with next-token distribution q proposes a token x∼q, and the large target model with distribution p accepts it with probability min⁡(1,p(x)/q(x)). If it is rejected, a token is drawn from the residual ∝max⁡(0,p−q). Show that the output token is distributed exactly as p. For p=(0.5,0.3,0.2) and q=(0.2,0.5,0.3), find the acceptance probability and the expected number of tokens per target pass when k=4 tokens are drafted?

Read the answer

Sequence models and transformers L5 Long Mat
545
In reinforcement learning, what are the agent, environment, state, action, reward and policy, and how do they interact in one step of the loop?

Read the answer

Reinforcement learning L1 Short Th
546
What is the exploration–exploitation dilemma, and why can a purely greedy agent get stuck choosing a poor action?

Read the answer

Reinforcement learning L1 Short Th
547
Why do we use a discount factor γ<1 in reinforcement learning?

Read the answer

Reinforcement learning L1 One-liner Th
548
What is a Markov decision process, what are its components, and what objective does an agent optimise?

Read the answer

Reinforcement learning L1 Short Th
549
What is the difference between on-policy and off-policy learning, and why might you want to learn off-policy?

Read the answer

Reinforcement learning L1 Short Th
550
What is the difference between model-free and model-based reinforcement learning, and what is the main trade-off between them?

Read the answer

Reinforcement learning L1 Short Th
551
What are the three stages of reinforcement learning from human feedback (RLHF) used to fine-tune a language model, and what does each stage produce?

Read the answer

Reinforcement learning L1 Short Th
552
What is the difference between the state-value Vπ(s) and the action-value Qπ(s,a), and how are they related? If π(a1∣s)=0.7, π(a2∣s)=0.3, Qπ(s,a1)=4 and Qπ(s,a2)=2, what is Vπ(s)?

Read the answer

Reinforcement learning L1 Short Th+Mat
553
A deterministic MDP has two states, A and B, and γ=0.9. In A you can "stay" (reward 1, remain in A) or "go" (reward 0, move to B). In B the only action is "stay" (reward 2, remain in B). Starting from V0=0, what are the values after three iterations of value iteration, and what are V∗ and the optimal policy?

Read the answer

Reinforcement learning L2 Medium Mat
554
Write the Q-learning update. With α=0.1, γ=0.9, Q(s,a)=2, reward r=1 and max⁡a′Q(s′,a′)=5, compute the new Q(s,a). Why is Q-learning called off-policy?

Read the answer

Reinforcement learning L2 Short Th+Mat
555
An episode gives rewards r1=1, r2=0, r3=2, r4=3 and then ends. With γ=0.5, compute the returns G0,G1,G2,G3. Which recursion lets you compute them quickly?

Read the answer

Reinforcement learning L2 Short Mat
556
An agent receives reward +2 at every step forever, with γ=0.9. What is its return? How many steps does it take to collect at least 90% of that return, and what does this say about the "effective horizon" 1/(1−γ)?

Read the answer

Reinforcement learning L2 Short Mat
557
An agent has four actions with estimated values Q=(1,3,2,0) and uses ε-greedy with ε=0.2, where the random choice is uniform over all four actions. What is the probability of each action, and what is the expected estimated value of the chosen action?

Read the answer

Reinforcement learning L2 Short Mat
558
An arm gives rewards 4, 2, 9 in its first three pulls. Compute the estimate Q3 using (a) the sample-average update with step 1/n, and (b) a constant step size α=0.5 starting from Q0=0. Why would you prefer (b) when the arm's reward distribution drifts over time?

Read the answer

Reinforcement learning L2 Short Mat
559
In TD(0), the current estimate is V(s)=0.5. The agent moves from s to s′ with reward r=1, and V(s′)=2. With γ=0.9 and α=0.1, what are the TD target, the TD error and the updated V(s)?

Read the answer

Reinforcement learning L2 Short Mat
560
In state s the agent takes action a with Q(s,a)=1, gets reward 0 and lands in s′, where Q(s′,a1)=3 and Q(s′,a2)=5. The ε-greedy policy then picks the exploratory action a1. With α=0.5 and γ=0.9, compute the new Q(s,a) under SARSA and under Q-learning. Why do they differ?

Read the answer

Reinforcement learning L2 Short Mat
561
A corridor has three non-terminal cells 1, 2, 3 in a row, with a terminal cell L to the left of cell 1 and a terminal cell R to the right of cell 3. The policy moves left or right with probability 0.5 each. Moving into R gives reward +1, and every other move gives reward 0. With γ=1 and V0=0, compute V1,V2,V3 (synchronous sweeps) for cells 1, 2, 3. What do the values converge to?

Read the answer

Reinforcement learning L2 Medium Mat
562
After t=10 total pulls, a three-armed bandit with rewards in [0,1] has pull counts n=(5,3,2) and sample means μ^=(0.6,0.5,0.4). Which arm does UCB1 pull next, using the index μ^i+2ln⁡t/ni? What would a greedy agent do?

Read the answer

Reinforcement learning L2 Short Mat
563
A deterministic world has a terminal goal G and two states A and B, each with one action, "right". Right from B gives reward 1 and ends at G. Right from A gives reward 0 and moves to B. Start with Q=0 everywhere, α=0.5, γ=0.9. The agent experiences (B,right,1,G) and then (A,right,0,B), each with one Q-learning update, and stores them in a model. Then Dyna-Q does two planning updates, replaying (B,right) first and (A,right) second. What are Q(A,right) and Q(B,right) after each stage, and what did planning achieve?

Read the answer

Reinforcement learning L2 Medium Mat
564
One episode with γ=0.5 visits states A, B, A, C in that order and then ends. The rewards received after leaving each state are 2,0,4,−1 respectively. What are the returns from each time step and the first-visit and every-visit Monte Carlo estimates of V(A), V(B) and V(C) from this single episode?

Read the answer

Reinforcement learning L2 Medium Mat
565
In state s′ there are three actions with Q(s′,⋅)=(2,4,1) and the policy is ε-greedy with ε=0.1 (random choice uniform over all three actions). The agent took action a in s with Q(s,a)=3, got r=1, and moved to s′. With α=0.5 and γ=0.9, compute the Expected SARSA update. How does it compare to SARSA and Q-learning, and why does it have lower variance than SARSA?

Read the answer

Reinforcement learning L2 Medium Th+Mat
566
An episode has rewards r1=1, r2=2, r3=0, r4=3 and then ends, with γ=0.9. The current estimates are V(S1)=6, V(S2)=5 and V(S3)=4. What are the n-step returns G0(n) for n=1,2,3,4, and how does n trade off bias and variance?

Read the answer

Reinforcement learning L2 Medium Th+Mat
567
For a sampled transition, r=1, γ=0.99, and the next state s′ has online-network values Qθ(s′,⋅)=(2.0,3.0,2.5) and target-network values Qθ−(s′,⋅)=(2.8,2.2,3.4). Compute the target used by DQN and by double DQN. Why does the max in DQN cause over-estimation, and how does double DQN reduce it?

Read the answer

Reinforcement learning L2 Medium Th+Mat
568
How do you derive the REINFORCE policy-gradient estimator, and why does subtracting a baseline not introduce bias?

Read the answer

Reinforcement learning L3 Long Mat
569
Derive the Bellman expectation equation for Vπ. How does the Bellman optimality equation for V∗ differ, and why can the first be solved as a linear system but not the second?

Read the answer

Reinforcement learning L3 Medium Mat
570
Compare Monte Carlo and TD(0) value estimation in terms of bias and variance. Given eight episodes, one (A, 0, B, 0), six (B, 1) and one (B, 0), with γ=1, what do batch Monte Carlo and batch TD(0) give for V(A) and V(B)?

Read the answer

Reinforcement learning L3 Medium Th+Mat
571
In the cliff-walking gridworld (reward −1 per step, −100 for stepping off the cliff), an ε-greedy SARSA agent learns a safe path away from the edge, while Q-learning learns the path along the edge yet earns less reward per episode during training. Why?

Read the answer

Reinforcement learning L3 Medium Th+Mat
572
Write PPO's clipped surrogate objective. With ϵ=0.2, evaluate the per-sample objective, and say whether it has a non-zero gradient, when (a) A=+1, r=1.5; (b) A=−1, r=0.5; (c) A=−1, r=1.5. What is the clipping for?

Read the answer

Reinforcement learning L3 Medium Th+Mat
573
An MDP has two states X and Y and γ=0.5. In X, action a gives reward 2 and moves to Y, while action b gives reward 1 and stays in X. In Y, action c gives reward 0 and moves to X, while action d gives reward 3 and stays in Y. Run policy iteration from the policy "b in X, c in Y". What are the evaluation and improvement steps, and what are the optimal policy and values?

Read the answer

Reinforcement learning L3 Long Mat
574
An MDP has non-terminal states A and B, and γ=0.9. In A, action a1 gives reward 2 and ends the episode. Action a2 gives reward 0, and moves to B with probability 0.8 or stays in A with probability 0.2. In B, action b1 gives reward 4 and ends the episode. Action b2 gives reward 0 and moves to A. Starting from V0=0, what are the results of three sweeps of value iteration, and then what are V∗ exactly and the optimal policy?

Read the answer

Reinforcement learning L3 Long Mat
575
A Markov reward process has two states with transition matrix P=(010.50.5), expected rewards R=(0,1)⊤ and γ=0.5. What is the Bellman equation in matrix form, what is its solution for V, and why does a unique solution exist for any γ<1?

Read the answer

Reinforcement learning L3 Medium Mat
576
Four episodes are generated by a behaviour policy b. For a target policy π, the importance ratios ρ=∏tπ(at∣st)/b(at∣st) and the returns G are (ρ,G)=(4,8), (0,5), (2,3) and (4,2). Compute the ordinary and weighted importance-sampling estimates of Vπ at the start state. Which is biased, and which has higher variance?

Read the answer

Reinforcement learning L3 Medium Mat
577
A tabular value function is V=0 for states A, B, C. One episode goes A → B → C → end with rewards 0,0,1. Use TD(λ) with accumulating traces, γ=0.9, λ=0.8 and α=0.1, and update every state at every step. What is V after the episode? How does this differ from TD(0)?

Read the answer

Reinforcement learning L3 Medium Mat
578
A two-armed bandit policy is π(a)=softmax(θ)a with θ=(0,0). The agent samples arm 1 and receives reward R=4. Using the REINFORCE update θ←θ+α(R−b)∇θlog⁡π(a) with α=0.1, what is the update (a) with baseline b=0 and (b) with b=2? What is the gradient of log⁡π, and how do you show that the score function has zero mean?

Read the answer

Reinforcement learning L3 Medium Mat
579
A trajectory of three steps has rewards (1,0,2) and critic values V(s0),V(s1),V(s2)=(3,2,1). The episode ends after step 3, so the next value is 0. With γ=0.9 and λ=0.5, what are the TD errors and the generalised advantage estimates A^0,A^1,A^2?

Read the answer

Reinforcement learning L3 Medium Mat
580
Two Bernoulli arms start with uniform Beta(1,1) priors. Arm A has been pulled 4 times with 3 successes and 1 failure. Arm B has been pulled once with 1 success. Give each arm's posterior, mean and variance. What is the probability that Thompson sampling picks B next? Why is this different from a greedy choice?

Read the answer

Reinforcement learning L3 Medium Mat
581
A linear value function is V^(s)=w⊤ϕ(s) with w=(1,0)⊤. The agent moves from s to s′ with r=2, where ϕ(s)=(1,2)⊤ and ϕ(s′)=(0,1)⊤. With γ=0.9 and α=0.1, compute the semi-gradient TD(0) update, and compare with the residual-gradient update. Why is TD(0) called a "semi-gradient" method?

Read the answer

Reinforcement learning L3 Medium Mat
582
Show that generalised advantage estimation A^t=∑l≥0(γλ)lδt+l, with δt=rt+1+γV(st+1)−V(st), equals δt when λ=0 and the Monte Carlo advantage Gt−V(st) when λ=1. How do these limits explain the bias–variance role of λ? How do you check your claim on rewards (1,0,2) and values (3,2,1) with γ=0.9?

Read the answer

Reinforcement learning L3 Long Mat
583
In RLHF, a reward model gives scores rc=2.0 to the human-preferred answer and rr=0.5 to the rejected one. Under the Bradley–Terry model, P(chosen preferred)=σ(rc−rr). Compute this probability, the loss −log⁡σ(rc−rr), and the gradients with respect to rc and rr. What happens when the scores are the other way round, and why does the loss depend only on the difference?

Read the answer

Reinforcement learning L3 Medium Th+Mat
584
State and prove the policy improvement theorem. If qπ(s,π′(s))≥vπ(s) for every state s, why does it follow that vπ′(s)≥vπ(s) for every s? How does this justify greedy policy improvement in policy iteration?

Read the answer

Reinforcement learning L3 Long Mat
585
What is the "deadly triad" in reinforcement learning? How do you show with a two-state example, with V^(s1)=w and V^(s2)=2w, a single weight w, and reward 0 everywhere, that off-policy semi-gradient TD(0) can diverge when only the transition s1→s2 is updated?

Read the answer

Reinforcement learning L4 Medium Th+Mat
586
Starting from ∇θJ(θ)=Eτ[∑t∇θlog⁡πθ(at∣st)∑krk+1], prove that rewards received before time t can be dropped from the factor multiplying ∇θlog⁡πθ(at∣st). What does this give you, and what is a subtle mistake with the discount factor?

Read the answer

Reinforcement learning L4 Long Mat
587
TRPO maximises a surrogate improvement subject to a KL bound. Linearise the objective as g⊤Δ and the constraint as 12Δ⊤FΔ≤δ, where g is the policy gradient and F is the Fisher information matrix. Derive the step Δ. For g=(1,1)⊤, F=diag(4,1) and δ=0.02, what is Δ, and how does its improvement g⊤Δ compare with a plain gradient step that uses the same KL?

Read the answer

Reinforcement learning L4 Long Mat
588
Sketch why UCB1 has regret growing only like O(ln⁡T). For a suboptimal arm i with gap Δi=μ∗−μi, how do you show that it is pulled about 8ln⁡T/Δi2 times at most, and what does this give for Δi=0.5 and T=1000?

Read the answer

Reinforcement learning L4 Long Mat
589
A replay buffer holds N=4 transitions with absolute TD errors (4,2,1,1). Prioritised experience replay samples transition i with probability P(i)=piα/∑kpkα with pi=∣δi∣ and α=0.5. Compute the sampling probabilities and the importance-sampling weights wi=(NP(i))−β (normalised by their maximum) for β=1 and β=0.5. Why are the weights needed?

Read the answer

Reinforcement learning L4 Medium Th+Mat
590
A duelling DQN has a value stream and an advantage stream. For one state, V=3 and A=(1,−1,3) for three actions. Compute Q using (a) Q=V+A, (b) Q=V+A−1∣A∣∑a′A(a′) and (c) Q=V+A−max⁡a′A(a′). Why is (a) not identifiable, and what do (b) and (c) fix?

Read the answer

Reinforcement learning L4 Medium Th+Mat
591
For the policy-gradient estimate g^=(R−b) ∇θlog⁡πθ(a), derive the constant baseline b∗ that minimises variance. Then take a one-state problem with π(a1)=σ(θ)=0.8, π(a2)=0.2, rewards R(a1)=1 and R(a2)=0. Compute b∗ and the variance for b=0, b∗ and b=E[R]. Is the average reward the best baseline?

Read the answer

Reinforcement learning L4 Long Mat
592
A shaped reward is r′(s,a,s′)=r(s,a,s′)+γΦ(s′)−Φ(s) for some potential function Φ. Prove that the optimal policy does not change. If γ=0.9, Φ(s)=10 and Φ(s′)=20, what bonus does the agent get on the move s→s′, and what does the bonus sum to along a whole episode?

Read the answer

Reinforcement learning L4 Medium Th+Mat
593
How do you prove that the Bellman optimality operator is a γ-contraction in the max-norm, and what does this tell you about value iteration converging to a unique V∗ and when to stop it?

Read the answer

Reinforcement learning L5 Long Mat
594
Show that the policy maximising Ey∼π[r(y)]−β KL(π ∥ πref) is π∗(y)=πref(y) er(y)/β/Z with Z=∑yπref(y)er(y)/β. For πref=(0.5,0.5), r=(1,0), find π∗ and the optimal objective value for β=1, and π∗ for β=0.5. What happens as β→0 and β→∞, and how does this lead to direct preference optimisation (DPO)?

Read the answer

Reinforcement learning L5 Long Mat
595
Prove the performance difference lemma: for two policies π and π′ with J(π)=Es0[Vπ(s0)], J(π′)−J(π)=11−γ Es∼dπ′, a∼π′[Aπ(s,a)], where dπ′(s)=(1−γ)∑t≥0γtP(st=s∣π′). What does it imply for policy improvement and for TRPO?

Read the answer

Reinforcement learning L5 Long Mat
596
For on-policy linear TD(0) with features ϕ, show that the expected update is α(b−Aw) and that the fixed point is wTD=A−1b, where A=E[ϕ(ϕ−γϕ′)⊤] and b=E[rϕ]. For the Markov reward process with P=(010.50.5), R=(0,1), γ=0.5 and a single feature ϕ=(1,0), what is wTD, and how does it compare with the best least-squares fit of the true values V=(0.8,1.6) under the stationary distribution?

Read the answer

Reinforcement learning L5 Long Mat
597
What does the Markov property mean for a sequence such as daily weather? If it is sunny today, the chance that tomorrow is sunny is 0.8 and the chance it is rainy is 0.2. Assume the same rule applies every day, so a sunny day is followed by a sunny one with chance 0.8. Given that today is sunny, what is the probability that tomorrow and the day after are both sunny?

Read the answer

Probabilistic models L1 Short Th+Mat
598
What is a latent (hidden) variable in a probabilistic model, and why might we add one? Heights of students are recorded, but not whether each student is in the junior batch or the senior batch. If half are juniors averaging 160 cm and half are seniors averaging 170 cm, what is the overall average height?

Read the answer

Probabilistic models L1 Short Th+Mat
599
What is a conjugate prior, and why is the Beta prior for a coin's heads probability easy to interpret as 'imaginary extra tosses'? What is the posterior for a Beta(1, 1) prior after 3 heads and 1 tail?

Read the answer

Probabilistic models L1 Short Th+Mat
600
What is a Bayesian network, and why does it need far fewer parameters than the full joint distribution?

Read the answer

Probabilistic models L1 Short Th
601
What is a hidden Markov model? What are its hidden states and observations, and which three sets of probabilities define it?

Read the answer

Probabilistic models L1 Short Th
602
Why do we discard the first few samples (the burn-in) of an MCMC run, and why are the remaining samples not independent draws?

Read the answer

Probabilistic models L1 Short Th
603
Two weather forecasters both predict tomorrow's temperature correctly, but one made a vague forecast and the other a specific one. Why does the specific one deserve more credit, and how does this explain why Bayesians say a model that can explain almost anything is penalised without any extra penalty?

Read the answer

Probabilistic models L1 Short Th
604
If we believe a quantity changes smoothly, so that inputs close together have similar outputs, how can we turn the distance between two inputs into a similarity score between 0 and 1, and what does the length-scale control?

Read the answer

Probabilistic models L1 Short Th+Mat
605
In a topic model, why do we describe each document as a mixture of topics, and each topic as a list of favourite words, and what is a tiny example?

Read the answer

Probabilistic models L1 Short Th
607
How is naive Bayes drawn as a graphical model, and what is its independence assumption? A spam filter has P(spam)=0.4. The word "offer" appears in 60% of spam and 10% of ham (non-spam) emails; the word "meeting" appears in 30% of spam and 50% of ham. Using only these two words, what is P(spam∣offer,meeting) for an email that contains both?

Read the answer

Probabilistic models L2 Medium Th+Mat
608
An HMM has hidden states Rainy (R) and Sunny (S), initial probabilities π=(0.6,0.4), transitions P(R→R)=0.7, P(R→S)=0.3, P(S→R)=0.4, P(S→S)=0.6, and emissions P(walk∣R)=0.1, P(shop∣R)=0.4, P(walk∣S)=0.6, P(shop∣S)=0.3. Using the Viterbi algorithm, what is the most likely hidden sequence for the observations (walk, shop)?

Read the answer

Probabilistic models L2 Medium Mat
609
What is the conditional distribution of a partitioned multivariate Gaussian? If (x1,x2) is jointly Gaussian with means μ1=1, μ2=2, variances Σ11=4, Σ22=2 and covariance Σ12=2, what is p(x1∣x2=3)?

Read the answer

Probabilistic models L2 Medium Mat
610
Explain the three basic connections in a Bayesian network (chain, fork, collider) and when each one blocks a path. In the graph A→C←B, C→D, is A⊥B? Is A⊥B∣D?

Read the answer

Probabilistic models L2 Medium Th
611
How does a Markov random field (an undirected graphical model) differ from a Bayesian network, and what is the partition function?

Read the answer

Probabilistic models L2 Short Th
612
What is a factor graph, and why is it the natural structure on which to run message passing?

Read the answer

Probabilistic models L2 Short Th
613
A Bayesian network has five discrete variables: A (2 states), B (3 states), C (2 states), D (2 states) and E (4 states). The arrows are A→C, B→C, C→D, B→E and D→E. How many free parameters does it need, and how does this compare with the full joint table?

Read the answer

Probabilistic models L2 Medium Mat
614
In the DAG with edges A→C, B→C, C→D and C→E, decide whether each statement is true, using d-separation: (i) A⊥B; (ii) A⊥B∣D; (iii) A⊥D∣C; (iv) D⊥E∣C; (v) D⊥E; (vi) A⊥E∣B?

Read the answer

Probabilistic models L2 Medium Th+Mat
615
In the chain A→B→C of binary variables, P(A=1)=0.3, P(B=1∣A=1)=0.8, P(B=1∣A=0)=0.1, P(C=1∣B=1)=0.9 and P(C=1∣B=0)=0.2. Use variable elimination to find P(C=1). Why is this cheaper than summing the full joint?

Read the answer

Probabilistic models L2 Medium Mat
616
You use a Metropolis random-walk sampler for the unnormalised target p~(x)=e−x2/2. The current state is x=1. Find the acceptance probability for the proposals x′=−0.5 and x′=2. If the uniform random number is u=0.3 for x′=2, is it accepted? Why is the normalising constant not needed?

Read the answer

Probabilistic models L2 Short Mat
617
Three binary variables x1,x2,x3∈{0,1} form a chain MRF x1−x2−x3 with p(x)=1Zψ(x1,x2) ψ(x2,x3), where ψ(a,b)=3 if a=b and ψ(a,b)=1 if a≠b. What are Z, p(x2=0), p(x1=x2=x3=0) and p(x1=x3)?

Read the answer

Probabilistic models L2 Medium Mat
618
A scalar state follows xt=xt−1+wt with wt∼N(0,1), and we observe yt=xt+vt with vt∼N(0,4). After step t−1 the belief is xt−1∼N(2,3). The new observation is yt=5. What are the predicted and the updated beliefs?

Read the answer

Probabilistic models L2 Short Mat
619
A 1D Gaussian mixture has two components with unit variance, means μ1=0 and μ2=4, and weights π1=0.7 and π2=0.3. For the data points x=3 and x=1, what are the responsibilities of component 1? What are the M-step updates of μ1 and π1 using only these two points (keeping the other parameters fixed)?

Read the answer

Probabilistic models L2 Medium Mat
620
In the model y=wx+ε with prior w∼N(0,1) and noise ε∼N(0,0.25), you observe (x,y)=(1,2) and (2,3). Find the posterior mean and variance of w. How is the posterior mean related to ridge regression?

Read the answer

Probabilistic models L2 Short Mat
621
A coin has unknown heads probability θ with prior θ∼Beta(2,2). After 10 tosses you see 7 heads and 3 tails. Find the posterior, the MLE, the MAP estimate and the posterior mean. What is the probability that the next toss is heads, and the probability that the next two tosses are both heads?

Read the answer

Probabilistic models L2 Medium Mat
622
You want samples from p(x)=6x(1−x) on [0,1] (the Beta(2,2) density) using a Uniform(0,1) proposal. Find the smallest valid envelope constant M, the acceptance rule and the acceptance probability. What changes if you only know the unnormalised density p~(x)=x(1−x)?

Read the answer

Probabilistic models L2 Medium Mat
623
How do you derive the evidence lower bound (ELBO), and what is the gap?

Read the answer

Probabilistic models L3 Long Th+Mat
624
How is the forward recursion for a hidden Markov model derived? For the HMM with states Rainy (R) and Sunny (S), π=(0.6,0.4), transitions P(R→R)=0.7, P(R→S)=0.3, P(S→R)=0.4, P(S→S)=0.6, and emissions P(walk∣R)=0.1, P(shop∣R)=0.4, P(walk∣S)=0.6, P(shop∣S)=0.3, what is P(walk,shop)?

Read the answer

Probabilistic models L3 Medium Mat
625
How do you derive the E-step and M-step of the EM algorithm for a Gaussian mixture model with K components?

Read the answer

Probabilistic models L3 Long Mat
626
Why does an iteration of the EM algorithm never decrease the observed-data log-likelihood?

Read the answer

Probabilistic models L3 Medium Mat
627
What are the posterior predictive mean and variance of Gaussian process regression, and how are they derived? With one training point x1=0, y1=1, noise variance σn2=0.1 and kernel k(x,x′)=exp⁡ ⁣(−(x−x′)2/2), what are they at x∗=1?

Read the answer

Probabilistic models L3 Long Mat
628
How does the Bayesian model evidence p(D∣M) penalise an over-complex model, without any explicit penalty term?

Read the answer

Probabilistic models L3 Short Th
629
What does a Gaussian process define, and how does the length-scale ℓ of the RBF kernel k(x,x′)=σf2exp⁡ ⁣(−(x−x′)22ℓ2) change the functions it prefers?

Read the answer

Probabilistic models L3 Short Th
630
What is the generative story of latent Dirichlet allocation (LDA), and what do θd and ϕk represent?

Read the answer

Probabilistic models L3 Short Th
631
An HMM has two states, initial probabilities π=(0.5,0.5), transition matrix A=(0.70.30.40.6), and emissions P(a∣1)=0.9, P(b∣1)=0.1, P(a∣2)=0.2, P(b∣2)=0.8. For the observations (a,b), what are the backward variables, P(O) and the posterior P(z1=1∣O)?

Read the answer

Probabilistic models L3 Medium Mat
632
The unnormalised density p~(θ)=θ4(1−θ)2 on (0,1) is a Beta(5,3) density. What is its Laplace approximation, and how does its variance compare with the exact one?

Read the answer

Probabilistic models L3 Medium Mat
633
In a network B→A←E (burglary, alarm, earthquake), P(B=1)=0.01 and P(E=1)=0.02. The alarm probabilities are P(A=1∣B=1,E=1)=0.95, P(A=1∣B=1,E=0)=0.94, P(A=1∣B=0,E=1)=0.29 and P(A=1∣B=0,E=0)=0.001. What are P(B=1∣A=1) and P(B=1∣A=1,E=1), and why do they differ?

Read the answer

Probabilistic models L3 Long Mat
634
A Bayesian network has a root X0 and n children X1,…,Xn, with arrows X0→Xi, all variables binary. To compute P(X1) with no evidence, compare the cost of eliminating X0 first against eliminating Xn,…,X2 first. What is the induced width in each case?

Read the answer

Probabilistic models L3 Medium Th+Mat
635
Three binary variables form a chain x1−x2−x3 with unary factors ϕ1=(1,2), ϕ2=(1,1), ϕ3=(3,1) (for values 0 and 1), and the same pairwise factor on both edges, ψ(a,b)=2 if a=b and 1 otherwise. Using sum-product messages, what are p(x2) and p(x3)?

Read the answer

Probabilistic models L3 Medium Mat
636
A binary chain x1−x2−x3 has unary factors ϕ1=(1,3), ϕ2=(2,1), ϕ3=(3,1), and both pairwise factors are ψ(a,b)=2 if a=b and 1 otherwise. Use max-product to find the MAP assignment and its unnormalised value. How does this relate to the Viterbi algorithm?

Read the answer

Probabilistic models L3 Medium Mat
637
How does the Baum–Welch algorithm (EM for an HMM) derive its updates for the transition probabilities aij and emission probabilities bj(k)?

Read the answer

Probabilistic models L3 Long Mat
638
For the linear-Gaussian model xt=Axt−1+wt with wt∼N(0,Q), and yt=Hxt+vt with vt∼N(0,R), how do you derive the Kalman filter predict and update equations from the conditioning rule for Gaussians?

Read the answer

Probabilistic models L3 Long Mat
639
For a mixture of Bernoulli distributions on binary vectors x∈{0,1}D, with p(x)=∑kπk∏dμkdxd(1−μkd)1−xd, how do you derive the E-step and M-step updates of EM?

Read the answer

Probabilistic models L3 Long Mat
640
For Bayesian linear regression with prior w∼N(0,α−1I) and likelihood t∼N(Φw,β−1I), how do you derive the posterior p(w∣t) by completing the square, and how does its mean relate to ridge regression?

Read the answer

Probabilistic models L3 Long Mat
641
Show that the predictive distribution of Bayesian linear regression at a new input x has variance σN2(x)=1β+ϕ⊤SNϕ, where ϕ=ϕ(x) is the feature vector. How do you show that the second term can only shrink when a new data point is added?

Read the answer

Probabilistic models L3 Medium Mat
642
A GP with kernel k(x,x′)=exp⁡(−(x−x′)2/2) and noise variance σ2=0.1 is trained on (x,y)=(0,1) and (1,2). What are the predictive mean and variance at x∗=0.5?

Read the answer

Probabilistic models L3 Long Mat
643
A target distribution on three states is π=(0.5,0.3,0.2). A Metropolis sampler proposes one of the two other states with probability 12 each, and accepts with probability min⁡(1,πj/πi). What is the transition matrix, and how do you check that π is stationary and that detailed balance holds?

Read the answer

Probabilistic models L3 Medium Mat
644
For a bivariate Gaussian with zero means, unit variances and correlation ρ, derive the Gibbs conditionals. Show that the sequence of x1 values from a Gibbs sampler is an AR(1) process with coefficient ρ2. How many Gibbs steps per effectively independent sample are needed for ρ=0.9?

Read the answer

Probabilistic models L3 Long Mat
645
In collapsed Gibbs sampling for LDA, the topic zi of a word is resampled from p(zi=k∣z−i,w)∝(ndk−i+α) nkw−i+βnk−i+Vβ. Where does each factor come from? What is its value for K=2, V=3, α=0.1, β=0.5, with nd⋅−i=(3,1), n⋅w−i=(4,0) and n⋅−i=(10,6)?

Read the answer

Probabilistic models L3 Long Th+Mat
646
The data are x1,…,xn∼N(μ,σ2) with known σ2=1, and the prior is μ∼N(0, 4). For n=4 and sample mean xˉ=2, what is the posterior of μ and what is the predictive distribution of a new observation? How do you show that the posterior mean is a precision-weighted average?

Read the answer

Probabilistic models L3 Medium Mat
647
In the Bayesian network with edges A→C, B→C, C→D, E→D and D→F, what is the Markov blanket of C? Prove from the factorisation that C is independent of all other variables given its blanket. Why is the co-parent E included?

Read the answer

Probabilistic models L3 Medium Th+Mat
648
You want Ep[X] for p=N(0,1) but you sample from q=N(1,1) and get x=0.5, 1.0, 2.0, −0.5. What are the importance weights, the self-normalised estimate and the effective sample size, and what does a small effective sample size tell you?

Read the answer

Probabilistic models L3 Medium Mat
649
An MCMC chain has n=10,000 post-burn-in draws of a quantity with variance σ2=1 and autocorrelations ρk=0.9k. What is the effective sample size neff, how does the Monte Carlo standard error compare with the naive σ/n, and what happens to the information if you thin the chain by keeping every 20th draw?

Read the answer

Probabilistic models L3 Medium Mat
650
How does the Metropolis–Hastings acceptance probability follow from detailed balance, and why is Gibbs sampling a special case whose proposals are always accepted?

Read the answer

Probabilistic models L4 Long Mat
651
In mean-field variational inference, with q(z)=∏jqj(zj), show that the optimal factor satisfies ln⁡qj∗(zj)=Ei≠j[ln⁡p(x,z)]+const. How is this used as an algorithm?

Read the answer

Probabilistic models L4 Long Mat
652
For Bayesian linear regression with prior w∼N(0,α−1I) and noise precision β, derive the log evidence ln⁡p(t∣α,β). Which terms reward fit, and which penalise complexity?

Read the answer

Probabilistic models L4 Long Mat
653
Derive the log marginal likelihood of a GP regression model with y∼N(0,Ky), Ky=K+σ2I, and its gradient with respect to a kernel hyperparameter θ. How do the data-fit and complexity terms trade off as the length-scale grows?

Read the answer

Probabilistic models L4 Long Mat
654
The target is a bivariate Gaussian with zero mean, unit variances and correlation ρ=0.9. A mean-field approximation q(z1,z2)=q1(z1)q2(z2) is fitted by minimising KL(q ∥ p). What are the factor variances, and why are they much smaller than the true marginal variances?

Read the answer

Probabilistic models L4 Medium Th+Mat
655
Two chains, each with n=4 post-burn-in draws of a scalar, give (1,2,3,2) and (3,4,5,4). Compute the Gelman–Rubin R^ and say what it indicates. Why is R^≈1 still not a proof of convergence?

Read the answer

Probabilistic models L4 Medium Th+Mat
656
Use the Laplace approximation to the posterior to approximate the log evidence ln⁡p(D) for N i.i.d. data points and M parameters. How does this lead to the BIC, and when does it break down?

Read the answer

Probabilistic models L4 Long Mat
657
Why does the plain HMM forward algorithm underflow for long sequences, and how does the scaled forward algorithm fix it? How can you illustrate this using the HMM with π=(0.5,0.5), A=(0.70.30.40.6), P(a∣1)=0.9, P(a∣2)=0.2, P(b∣1)=0.1, P(b∣2)=0.8 and observations (a,b)?

Read the answer

Probabilistic models L4 Medium Th+Mat
658
Show that a single-site Gibbs update is a Metropolis–Hastings move that is always accepted, and that it leaves the target p(x) invariant. Why does a fixed-order sweep not give a reversible chain, and can you give an example where Gibbs sampling fails to converge?

Read the answer

Probabilistic models L4 Long Mat
659
Show that Bayesian linear regression with features ϕ(x) and weight prior w∼N(0,Σp) is a Gaussian process, and that its predictive mean and variance equal the GP formulas with k(x,x′)=ϕ(x)⊤Σpϕ(x′). What does this imply for the RBF kernel?

Read the answer

Probabilistic models L5 Long Mat
660
Let p(x)=1Z∏CψC(xC) factorise over the cliques of an undirected graph G. Prove that if a set S separates A from B in G (every path from A to B passes through S), then A⊥B∣S. Where does the converse need extra assumptions?

Read the answer

Probabilistic models L5 Long Mat
661
What is the difference between a model's training error and its true (population) error, and what does a generalisation guarantee promise about the gap between them?

Read the answer

Learning theory L1 Short Th+Mat
662
What does the no free lunch theorem say, and why does it not mean that learning is impossible?

Read the answer

Learning theory L1 Short Th
663
What is the mistake-bound (online learning) model, and how is it different from PAC learning? If a secret rule is one of 8 candidate rules and each mistake lets you throw away at least half of the candidates, how many mistakes can you make at most?

Read the answer

Learning theory L1 Short Th+Mat
664
What does it mean for a hypothesis class to be PAC (probably approximately correct) learnable, and what roles do ϵ and δ play?

Read the answer

Learning theory L1 Short Th
665
For a class of classifiers, what is the growth function, i.e. how many different ways can the class label m points? For the one-dimensional thresholds ht(x)=1[x≥t], how many labellings can they make on 3 points?

Read the answer

Learning theory L1 Short Th+Mat
666
What does it mean for a set of classifiers to shatter a set of points, and how do one-dimensional threshold rules ht(x)=1[x≥t] (which predict 1 if x≥t and 0 otherwise) shatter a single point?

Read the answer

Learning theory L1 Short Th+Mat
667
What is the difference between the realisable and the agnostic settings in PAC (probably approximately correct) learning?

Read the answer

Learning theory L1 Short Th
668
In the bias–complexity trade-off, what are the approximation error and the estimation error, and how does each change as the hypothesis class gets richer?

Read the answer

Learning theory L1 Short Th
669
In online prediction with expert advice, what is regret, and what does it mean for an algorithm to have sublinear regret?

Read the answer

Learning theory L1 Short Th
670
Using Hoeffding's inequality, how large must a test set be so that the measured error of a fixed classifier is within 0.02 of its true error with probability at least 95%?

Read the answer

Learning theory L2 Short Mat
671
What is the VC dimension of the class of closed intervals ha,b(x)=1[a≤x≤b] on the real line, and why?

Read the answer

Learning theory L2 Medium Th+Mat
672
The halving algorithm is run on a finite class of 1000 hypotheses and the labels are realisable (some hypothesis in the class is always correct). What is the largest number of mistakes it can make, and why?

Read the answer

Learning theory L2 Short Mat
673
A learner must find a conjunction of literals over n=10 Boolean variables (each variable may appear positively, negated, or not at all) in the realisable setting. Treat the class as having 310+1 hypotheses (the extra one is the always-false conjunction). How many examples guarantee error at most 0.1 with probability at least 0.95?

Read the answer

Learning theory L2 Short Mat
674
A perceptron is run on linearly separable data with ∥xi∥≤5 for all i. Some unit vector w∗ separates it with margin yi w∗ ⁣⋅xi≥0.5. What upper bound does Novikoff's theorem give on the number of mistakes? What changes if all inputs are multiplied by 10?

Read the answer

Learning theory L2 Short Mat
675
Run the weighted majority algorithm by hand with 5 experts, all starting with weight 1, and penalty factor β=12 (the weight of a wrong expert is multiplied by β). In round 1, experts 1,2,3 predict 1 and experts 4,5 predict 0, and the true label is 0. In round 2, experts 1,2 predict 0 and experts 3,4,5 predict 1, and the true label is 1. What does the algorithm predict, and what are the weights, after each round?

Read the answer

Learning theory L2 Medium Mat
676
A class has VC dimension 3. By Sauer's lemma, at most how many different labellings can it produce on 10 points? What fraction of all 210 labellings is that, and what does the bound say for m=3?

Read the answer

Learning theory L2 Short Mat
677
In kernel ridge regression, predictions take the form f(x)=∑i=1nαik(xi,x) with weights α=(K+λI)−1y, where Kij=k(xi,xj) is the kernel matrix, y is the vector of targets, λ>0 is the regularisation parameter and I is the identity matrix. For two training points with K=(10.50.51), y=(1,0)⊤ and λ=0.5, what are α and the prediction f(x) at a new point with k(x1,x)=0.8 and k(x2,x)=0.2?

Read the answer

Learning theory L2 Medium Mat
678
Why is VCdim⁡(H)≤log⁡2∣H∣ for a finite class H, and is the bound tight?

Read the answer

Learning theory L2 Short Th+Mat
679
Linear classifiers x↦sign⁡(w⋅x) with ∥w∥≤1 are trained on m=104 points with ∥x∥≤R=1. A classifier has margin at least ρ=0.1 on 95% of the training points. Using LD≤L^ρ+2Rρm+ln⁡(1/δ)2m with δ=0.05, what true-error bound do you get? What if m were four times larger?

Read the answer

Learning theory L2 Medium Mat
680
A coin is tossed n=100 times and p^ is the fraction of heads. Using Chebyshev with variance at most 1/4, and Hoeffding, bound P(∣p^−p∣≥ϵ) for ϵ=0.1 and ϵ=0.2. Which bound is tighter in each case? Also, for a non-negative X with mean 50, what does Markov say about P(X≥100)?

Read the answer

Learning theory L2 Medium Mat
681
Show that for a finite hypothesis class H in the realisable setting, any learner that outputs a hypothesis consistent with the training data is PAC with m≥1ϵ(ln⁡∣H∣+ln⁡1δ) samples. How many samples are needed when ∣H∣=106, ϵ=0.05 and δ=0.01?

Read the answer

Learning theory L3 Medium Mat
682
In the agnostic setting, why does empirical risk minimisation (ERM) return a hypothesis within ϵ of the best in H when every h∈H satisfies ∣LS(h)−LD(h)∣≤ϵ/2? What sample complexity does this give for finite H, and how does the excess risk split into approximation and estimation error?

Read the answer

Learning theory L3 Medium Mat
683
In AdaBoost each weak learner has weighted error ϵt=0.4. Using the bound exp⁡(−2γ2T) on training error, how many rounds T guarantee training error below 1%? How does the exact product of the Zt compare with the bound?

Read the answer

Learning theory L3 Medium Mat
684
What is the VC dimension of axis-aligned rectangles in R2, and how do you prove it?

Read the answer

Learning theory L3 Medium Th+Mat
685
How do you prove the perceptron convergence theorem (Novikoff): if ∥xi∥≤R and some unit vector w∗ has yi w∗ ⁣⋅xi≥γ>0 for all i, then the perceptron makes at most R2/γ2 mistakes?

Read the answer

Learning theory L3 Long Mat
686
How do you show that if H has VC dimension d, then every deterministic online learner can be forced to make at least d mistakes even in the realisable setting?

Read the answer

Learning theory L3 Medium Th+Mat
687
How do you derive the mistake bound of the weighted majority algorithm, with N experts, penalty factor β∈(0,1), and an expert that makes m mistakes, so that the algorithm makes at most ln⁡N+mln⁡(1/β)ln⁡21+β mistakes?

Read the answer

Learning theory L3 Medium Mat
688
Show that for m≥d≥1, ∑i=0d(mi)≤(emd)d. Why does this bound matter for generalisation?

Read the answer

Learning theory L3 Medium Mat
689
How do you show that the empirical Rademacher complexity of F={x↦w⋅x:∥w∥2≤B} on a sample x1,…,xm with ∥xi∥2≤R is at most BRm?

Read the answer

Learning theory L3 Medium Mat
690
For a learning algorithm A and a training set of m i.i.d. examples, let the leave-one-out error be L^loo=1m∑i=1mℓ(A(S∖i),zi). Prove that its expectation equals the expected true risk of A trained on m−1 examples. Why is it not an unbiased estimate of the risk for m examples, and why can its variance still be large?

Read the answer

Learning theory L3 Medium Th+Mat
691
Three nested hypothesis classes have VC dimensions d=3, 10, 40 and the best training errors on m=1000 examples are 0.12, 0.06, 0.04. Using the penalised bound L^+dln⁡(m/d)+ln⁡(1/δ)m with δ=0.05, which class does structural risk minimisation pick? Why is picking the lowest training error wrong?

Read the answer

Learning theory L3 Medium Mat
692
A PAC-Bayes bound says that, with probability at least 1−δ over m examples, every posterior Q satisfies L(Q)≤L^(Q)+KL(Q∥P)+ln⁡(2m/δ)2m. Take P=N(0,I100) and Q=N(w,I100) with ∥w∥2=100. Compute the KL, and the bound for m=10000, δ=0.05 and L^(Q)=0.08. Why does the bound beat a naive one for a large network?

Read the answer

Learning theory L3 Medium Th+Mat
693
What is the empirical Rademacher complexity of a function class, and why does it measure capacity? What is it for (a) a class containing one function and (b) the class of all ±1 labellings of m distinct points, and what generalisation bound does it give?

Read the answer

Learning theory L4 Medium Th+Mat
694
What is double descent? Why can test error fall again once a model has more parameters than training points, and how does this fit with the classical bias–variance picture?

Read the answer

Learning theory L4 Medium Th+Mat
695
What is the VC dimension of the class of disks (interior and boundary) in R2, with points inside labelled 1, and how do you prove it?

Read the answer

Learning theory L4 Long Th+Mat
696
How do you derive the regret bound for the Hedge (exponential weights) algorithm, with N experts, losses in [0,1] and learning rate η, so that RegretT≤ln⁡Nη+ηT8, and what is the best η?

Read the answer

Learning theory L4 Long Mat
697
What is uniform stability of a learning algorithm A, and how do you prove that a β-uniformly stable algorithm has expected generalisation gap at most β? What is an example of a stable algorithm with its β?

Read the answer

Learning theory L4 Long Th+Mat
698
How do you state and prove the representer theorem: for a kernel k with RKHS H, every minimiser of ∑i=1mℓ(f(xi),yi)+g(∥f∥H) with g strictly increasing has the form f=∑iαik(xi,⋅)?

Read the answer

Learning theory L4 Long Mat
699
The class of thresholds ht(x)=1[x≥t] on [0,1] has VC dimension 1. Show that no online learner can guarantee a finite number of mistakes on it in the realisable setting. What does this say about the relation between VC dimension and online learnability?

Read the answer

Learning theory L4 Medium Th+Mat
700
Let F={f∈Hk:∥f∥H≤B} be a ball in an RKHS, with k(x,x)≤R2. Show that R^S(F)≤Bmtr⁡K≤BRm, where K is the kernel matrix of the sample. Why is this significant for the Gaussian kernel?

Read the answer

Learning theory L4 Medium Mat
701
For convex losses ft with gradients satisfying ∥gt∥≤G, online gradient descent plays wt+1=Π(wt−ηgt), where Π projects onto the ball {∥w∥≤D}. Prove that regret against any u in the ball is at most ∥u−w1∥22η+ηG2T2. What are the best η and the resulting bound for D=1, G=2, T=10000?

Read the answer

Learning theory L4 Long Mat
702
Cover's counting function says that N points in general position in Rd have C(N,d)=2∑k=0d−1(N−1k) dichotomies realisable by a hyperplane through the origin. Derive it from the recurrence C(N+1,d)=C(N,d)+C(N,d−1), and compute the fraction of the 2N labellings that are separable for d=3 and N=4,6,8. What does this say about capacity?

Read the answer

Learning theory L4 Long Mat
703
State McDiarmid's bounded-differences inequality. For a loss in [0,1] and a hypothesis class H, show that Φ(S)=sup⁡h(L(h)−L^S(h)) satisfies bounded differences with constant 1/m. Hence, how do you show that, with probability at least 1−δ, Φ≤E[Φ]+ln⁡(1/δ)2m, and what is the deviation term for m=2000 and δ=0.01?

Read the answer

Learning theory L4 Long Mat
704
What is the VC dimension of linear classifiers (with a bias term) in d-dimensional space Rd, and how do you prove it?

Read the answer

Learning theory L5 Long Mat
705
Define the growth function τH(m). State and prove Sauer's lemma: if VCdim⁡(H)=d, then τH(m)≤∑i=0d(mi). Why does this matter for generalisation?

Read the answer

Learning theory L5 Long Mat
706
How do you prove the no free lunch theorem: for any learning algorithm A for binary classification with the 0-1 loss over a domain X, and any training size m<∣X∣/2, there is a distribution D and a labelling function f with LD(f)=0 such that with probability at least 17 over S∼Dm, LD(A(S))≥18?

Read the answer

Learning theory L5 Long Mat
707
How do you prove that for a class of functions F with values in [0,1], with probability at least 1−δ over a sample S of size m, every f∈F satisfies E[f]≤E^S[f]+2Rm(F)+ln⁡(1/δ)2m, where Rm is the expected Rademacher complexity?

Read the answer

Learning theory L5 Long Mat
708
How do you prove Massart's finite class lemma: for a finite set A⊂Rm with ∥a∥2≤r for all a∈A, Eσsup⁡a∈A1m∑iσiai≤r2ln⁡∣A∣m. How do you use it with Sauer's lemma to bound the Rademacher complexity of a class of VC dimension d?

Read the answer

Learning theory L5 Long Mat
709
How do you show that no online algorithm can guarantee regret o(T) against even N=2 experts, by constructing a loss sequence for which every algorithm has expected regret at least T/8?

Read the answer

Learning theory L5 Long Mat
710
In plain words, what are precision and recall for a binary classifier? A spam filter flags 10 emails and 8 of them are truly spam, while the inbox holds 16 spam emails in all. What are its precision and recall?

Read the answer

ML systems and evaluation L1 Short Th+Mat
711
What is a confusion matrix for a binary classifier, and what do its four cells mean? A spam filter checks 100 emails, 20 of which are spam. It flags 18 emails as spam, and 15 of those really are spam. What goes in each cell?

Read the answer

ML systems and evaluation L1 Short Th+Mat
712
What is an online A/B test, why are users split at random between the two versions, and what does 'statistically significant' roughly mean? If version A gets 50 clicks from 1000 users and B gets 60 from 1000, can you already say B is better?

Read the answer

ML systems and evaluation L1 Short Th+Mat
713
What is training–serving skew?

Read the answer

ML systems and evaluation L1 One-liner Th
714
What is stratified k-fold cross-validation, and why is it preferred over ordinary k-fold on imbalanced classification datasets?

Read the answer

ML systems and evaluation L1 One-liner Th
715
What is the difference between demographic parity and equalised odds, and why can a perfect classifier violate demographic parity?

Read the answer

ML systems and evaluation L1 Short Th
716
What is a confounding variable, and how does randomising treatment assignment in an experiment remove confounding bias?

Read the answer

ML systems and evaluation L1 Short Th
717
What is the difference between a shadow deployment and a canary rollout when releasing a new ML model?

Read the answer

ML systems and evaluation L1 Short Th
718
What is the difference between interpretability and explainability in machine learning, and what risks arise when relying on post-hoc explanations?

Read the answer

ML systems and evaluation L1 Short Th
719
When would you prefer PR-AUC over ROC-AUC?

Read the answer

ML systems and evaluation L2 Medium Th
720
What is the difference between covariate (data) drift and concept drift, what is an example of each, and how would you detect each in production?

Read the answer

ML systems and evaluation L2 Short Th
721
A search system returns four documents whose graded relevance, in rank order, is [3,2,0,1] (higher is more relevant; 0 is irrelevant). What are precision@3 and NDCG@4, using DCG@k=∑i=1krelilog⁡2(i+1)?

Read the answer

ML systems and evaluation L2 Medium Mat
722
Why is ordinary shuffled k-fold cross-validation wrong for time-series data, and what should you do instead?

Read the answer

ML systems and evaluation L2 Short Th
723
What does it mean for a classifier to be calibrated? Compute the expected calibration error (ECE) for two confidence bins: 60 predictions with mean confidence 0.9 and accuracy 0.75, and 40 predictions with mean confidence 0.6 and accuracy 0.55. How does temperature scaling fix miscalibration?

Read the answer

ML systems and evaluation L2 Medium Th+Mat
724
A binary classifier outputs predicted probabilities [0.90,0.80,0.70,0.60,0.40,0.20] for six test examples with true labels [1,0,1,1,0,0]. What are the (FPR,TPR) points on the ROC curve, and what is the exact ROC-AUC?

Read the answer

ML systems and evaluation L2 Medium Mat
725
A disease screening model tested on 200 patients produces TP=36, FN=4, FP=24 and TN=136. What are precision, recall, F1 and F2, and why does a screening task favour β>1?

Read the answer

ML systems and evaluation L2 Medium Mat
726
On four test examples with true labels y=[1,1,0,0], Model A predicts probabilities [0.90,0.90,0.10,0.99] and Model B predicts [0.70,0.70,0.30,0.55]. Both achieve 75% accuracy at threshold 0.5; what is the binary log loss of each model, and why do they differ so sharply?

Read the answer

ML systems and evaluation L2 Medium Mat
727
A regression model predicts y^=[2,4,6,8] for true targets y=[2,4,6,12]. What are the MAE and RMSE, why is RMSE strictly larger here, and when is each metric preferred?

Read the answer

ML systems and evaluation L2 Short Th+Mat
728
A search engine returns 4 results for three queries with binary relevance [0,1,0,1], [1,0,1,0] and [0,0,1,0], where 1 means relevant and each query has exactly 2 relevant documents in the corpus. What are MRR and MAP, and when would you prefer each?

Read the answer

ML systems and evaluation L2 Medium Mat
729
You are training a pneumonia detector on 5,000 chest X-rays collected from 500 patients (10 scans per patient). Why does standard or stratified k-fold cross-validation overestimate test accuracy, and how does group k-fold fix it?

Read the answer

ML systems and evaluation L2 Short Th
730
An online A/B test configured for a 50/50 split logs 50,800 users in control and 49,200 in treatment out of 100,000 total. What does a χ2 goodness-of-fit test at α=0.01 (critical value χ1,0.992=6.635) show about sample ratio mismatch (SRM), and why must metric analysis stop if SRM fails?

Read the answer

ML systems and evaluation L2 Medium Mat
731
What is the difference between unstructured magnitude pruning and structured pruning, and why does 80% unstructured sparsity often give little wall-clock speedup on standard GPUs?

Read the answer

ML systems and evaluation L2 Short Th+Mat
732
A three-class classifier produces confusion matrix rows (true classes A, B, C; predicted columns A, B, C) of [45,5,0], [6,21,3] and [4,4,12]. What are macro-F1 and micro-F1, why does micro-F1 equal overall accuracy here, and when is macro-F1 preferred?

Read the answer

ML systems and evaluation L2 Medium Mat
733
An A/B test evaluates 20 independent metrics at significance level α=0.05 when the treatment actually has zero effect on all of them. What is the probability of getting at least one false positive, how does Bonferroni correction adjust the threshold, and why does sequential peeking cause a similar problem?

Read the answer

ML systems and evaluation L2 Medium Mat
734
A loan classifier is evaluated on two demographic groups of 100 applicants each: Group A has TP=48,FN=12,FP=12,TN=28 and Group B has TP=24,FN=6,FP=21,TN=49. What are the positive prediction rate, TPR, FPR and PPV for each group, and which fairness criteria are satisfied or violated?

Read the answer

ML systems and evaluation L2 Medium Mat
735
A credit score model’s training score distribution across four equal-frequency bins is [0.25,0.25,0.25,0.25], while live production traffic shifts to [0.10,0.20,0.30,0.40]. What is the population stability index (PSI), how severe is the drift under standard thresholds, and why should rising PSI trigger investigation rather than automatic blind retraining?

Read the answer

ML systems and evaluation L2 Medium Th+Mat
736
A classifier gets 340 of 400 test examples right. Give an approximate 95% confidence interval for its true accuracy. How large must the test set be to estimate accuracy to within ±2 percentage points at 95% confidence, if you have no prior idea of the accuracy?

Read the answer

ML systems and evaluation L2 Medium Mat
737
Two classifiers A and B are evaluated on the same 200 test examples. Both are right on 150, both are wrong on 15, only A is right on 25 and only B is right on 10. Test at the 5% level, using McNemar's statistic χ2=(b−c)2/(b+c) (where b and c count the examples on which only one of the two classifiers is right) and the 5% critical value 3.84, whether the difference in accuracy is real. Why not simply compare the two accuracies?

Read the answer

ML systems and evaluation L2 Medium Th+Mat
738
A classifier on 1,000 test examples has TP = 10, FN = 10, FP = 5 and TN = 975. Compute the accuracy, the F1 score and the Matthews correlation coefficient, MCC=TP⋅TN−FP⋅FN(TP+FP)(TP+FN)(TN+FP)(TN+FN). What do these give for a model that always predicts negative?

Read the answer

ML systems and evaluation L2 Medium Mat
739
How do you evaluate the retriever in a RAG (retrieval-augmented generation) system separately from the generator? Suppose three queries have relevant chunk IDs R1={c2,c5}, R2={c8,c9,c10} and R3={c12}, and the retriever returns top-5 lists L1=[c1,c2,c4,c5,c7], L2=[c8,c1,c3,c6,c11] and L3=[c3,c4,c7,c9,c15]. What are the recall@5, precision@5, hit rate@5 and MRR (mean reciprocal rank), and how does scoring both retrieval and generation let you separate a retrieval miss from a generation error?

Read the answer

ML systems and evaluation L2 Medium Mat
740
How do you monitor a deployed ML (machine learning) model when ground-truth labels arrive weeks late or never arrive at all?

Read the answer

ML systems and evaluation L2 Medium Th
741
A 1000×1000 weight matrix is stored densely in fp16 (2 bytes per number). To store an unstructured-pruned copy in CSR (compressed sparse row) format you keep, for each non-zero, its fp16 value (2 bytes) and its column index (int32, 4 bytes), plus one int32 row pointer per row plus one. How many bytes does the sparse copy use at 80% and 95% sparsity, and at what sparsity does it break even with the dense copy?

Read the answer

ML systems and evaluation L2 Medium Mat
742
How do accuracy, F1 score and ROC-AUC compare as evaluation metrics for a binary classifier, and when is each appropriate, considering threshold dependence, class imbalance and whether each measures ranking quality or decision quality (use a small confusion-matrix example)?

Read the answer

ML systems and evaluation L3 Long Th+Mat
743
Your current click-through rate is 10%. How many users per arm does an A/B test need to detect an absolute increase to 11%, with a two-sided significance level of 5% and 80% power?

Read the answer

ML systems and evaluation L3 Medium Mat
744
A calibrated fraud model outputs p=P(fraud∣x). Missing a fraud costs ₹10,000 and flagging a legitimate transaction costs ₹1,000 in review effort. Derive the cost-minimising threshold. What would you do if the model were not calibrated?

Read the answer

ML systems and evaluation L3 Medium Mat
745
For true values y=[2,4,6,8] and linear-regression predictions y^=[3,3,7,7] (fitted with p=1 feature), what are R2 and adjusted R2, how can test-set R2 become negative, and why does adding a pure-noise feature never reduce training R2 whereas adjusted R2 penalises it?

Read the answer

ML systems and evaluation L3 Medium Th+Mat
746
A student standardises features and applies PCA on the full dataset before running 5-fold cross-validation, obtaining 92% accuracy, whereas fitting both inside each fold yields 81%. Why does the first setup leak information, how does a pipeline fix it, and why is supervised feature selection before CV even more damaging?

Read the answer

ML systems and evaluation L3 Short Th+Mat
747
Why does reporting the best validation score from k-fold hyperparameter tuning give an optimistically biased error estimate, how does nested cross-validation fix this, and how many total model fits are required for 5 outer folds, 4 inner folds and 6 hyperparameter candidates?

Read the answer

ML systems and evaluation L3 Medium Th+Mat
748
On four binary outcomes y=[1,0,1,0], Forecaster A predicts p^A=[0.8,0.2,0.8,0.2] and Forecaster B predicts p^B=[1.0,0.5,0.5,0.0]. What are their Brier scores, and how do you prove that the Brier score is a strictly proper scoring rule?

Read the answer

ML systems and evaluation L3 Medium Mat
749
How does permutation feature importance measure a feature’s contribution, why must it be computed on held-out validation data rather than training data, and what happens when two strongly correlated features (x1≈x2) are evaluated with it?

Read the answer

ML systems and evaluation L3 Medium Th+Mat
750
A weight tensor of 100 million parameters stored in FP32 (4 bytes each) spans the range [−0.64,+1.91]. What are the unsigned INT8 ([0,255]) affine scale s and zero-point z, what are the quantised and dequantised values and error for w=0.314, and how much parameter memory is saved?

Read the answer

ML systems and evaluation L3 Medium Mat
751
What are the Shapley value formula and its four uniqueness axioms, and for a 3-feature model F={1,2,3} with coalition values v(∅)=10, v({1})=14, v({2})=12, v({3})=11, v({1,2})=20, v({1,3})=15, v({2,3})=13 and v({1,2,3})=25, what are the exact Shapley attributions ϕ1,ϕ2,ϕ3 (verifying efficiency)?

Read the answer

ML systems and evaluation L3 Long Mat
752
In online A/B testing, CUPED reduces metric variance by replacing the outcome Y with Ycuped=Y−θ(X−E[X]), where X is a pre-experiment covariate unaffected by treatment. How do you show that E[Ycuped]=E[Y] (unbiasedness), derive the variance-minimising θ∗, and prove that the minimum variance is Var⁡(Y)(1−ρ2) where ρ=Corr⁡(X,Y)?

Read the answer

ML systems and evaluation L3 Long Mat
753
Under covariate shift, how do you derive the importance-weighted loss Etest[ℓ]=Etrain[w(x) ℓ] and estimate w(x) using a domain classifier? Given ntrain=800 training points and ntest=200 unlabelled test points, four training examples receive calibrated domain probabilities P(test∣x)=[0.2,0.2,0.5,0.8] and per-example losses [0.1,0.2,0.3,0.8]: what are their importance weights, the weighted loss, and the ESS (effective sample size), and why does this fail under concept drift?

Read the answer

ML systems and evaluation L3 Medium Mat
754
How do you use the two-sample KS (Kolmogorov–Smirnov) test to detect drift in a model's prediction scores? Suppose 6 reference scores are [0.10,0.20,0.30,0.40,0.50,0.75] and 6 live scores are [0.55,0.65,0.70,0.80,0.85,0.95]: what are the empirical CDFs (cumulative distribution functions), the KS statistic D, and the comparison against the large-sample α=0.05 critical value, and why do production teams alert on effect size rather than p-values?

Read the answer

ML systems and evaluation L3 Medium Mat
755
How does FedAvg (federated averaging) train a shared model without centralising raw data, and what privacy risks remain? In one round, three clients with n1=100, n2=300 and n3=600 examples return scalar weights 0.8, 0.5 and 0.2: what is the aggregated weight, and how do secure aggregation, differential privacy and non-IID (non-independent and identically distributed) data affect the protocol?

Read the answer

ML systems and evaluation L3 Medium Th+Mat
756
A new recommender model improves offline AUC on logged data, but an online A/B test shows no gain. What are the likely reasons, and how can you make offline evaluation more predictive of online results?

Read the answer

ML systems and evaluation L4 Medium Th+Mat
757
How do partial dependence plots (PDP) and LIME explain a black-box model, why do correlated features mislead both via out-of-distribution extrapolation, and how do individual conditional expectation (ICE) plots fix a separate weakness of PDPs?

Read the answer

ML systems and evaluation L4 Medium Th
758
In knowledge distillation, the student minimises L=(1−α)LCE(y,pS)+αT2KL(pT(T)∥pS(T)), where p(T)=softmax⁡(z/T) uses temperature T>1. How do you derive the gradient of KL(pT(T)∥pS(T)) with respect to student logit zi in the high-temperature limit to show why the T2 multiplier is needed?

Read the answer

ML systems and evaluation L4 Medium Mat
759
In a hospital study of 1,000 patients split evenly between mild (Z=0) and severe (Z=1) cases, recovery rates for treated (T=1) vs untreated (T=0) patients are 90/100 vs 320/400 among mild cases and 200/400 vs 40/100 among severe cases. How do these numbers exhibit Simpson’s paradox, what is the causal DAG and backdoor-adjusted effect P(Y=1∣do⁡(T=1))−P(Y=1∣do⁡(T=0)), and why does adjusting for a collider instead of a confounder introduce bias?

Read the answer

ML systems and evaluation L4 Long Th+Mat
760
What is ε-differential privacy, and why does the Laplace mechanism satisfy it? For a counting query (sensitivity Δf=1) released with the Laplace mechanism at ε=0.5, what are the noise scale b, variance, standard deviation, and tail probability P(∣noise∣>5), and how do privacy and accuracy change across repeated queries?

Read the answer

ML systems and evaluation L4 Medium Mat
761
How does DP-SGD (differentially private stochastic gradient descent) bound per-example influence and add noise during training? In a batch of size B=100 with clipping threshold C=1 and noise multiplier σ=1.2, two per-example gradients have ℓ2 norms 5 and 0.5: what are their clipping scale factors, what is the per-coordinate noise standard deviation on the averaged gradient, and why do per-example clipping, subsampling, and larger batches matter?

Read the answer

ML systems and evaluation L4 Medium Th+Mat
762
For a probabilistic binary classifier issuing discrete forecast values f1,…,fK with bin sizes n1,…,nK (summing to N), bin observed frequencies oˉk=1nk∑i∈Bkyi and overall base rate oˉ=1N∑i=1Nyi, how do you derive Murphy’s three-term decomposition of the Brier score into reliability, resolution and uncertainty, and what does each term measure?

Read the answer

ML systems and evaluation L5 Long Mat
763
For a binary classifier evaluated on a demographic group with base rate p=P(Y=1∣A=a)∈(0,1), how do you derive Chouldechova’s identity relating false positive rate (FPR), false negative rate (FNR), positive predictive value (PPV) and p, and why does it prove that an imperfect classifier cannot satisfy both predictive parity and equalised odds when two groups have unequal base rates?

Read the answer

ML systems and evaluation L5 Long Mat
764
In off-policy evaluation with context x, action a, reward r, logging policy μ(a∣x)>0 and target policy π(a∣x), the inverse propensity scoring (IPS) estimator is V^IPS=1n∑i=1nriπ(ai∣xi)μ(ai∣xi) and the doubly robust (DR) estimator is V^DR=1n∑i=1n[V^r^(xi)+π(ai∣xi)μ^(ai∣xi)(ri−r^(xi,ai))], where V^r^(x)=∑aπ(a∣x)r^(x,a). How do you prove that IPS is unbiased, and why is DR unbiased whenever either the propensity model μ^=μ or the reward model r^(x,a)=E[r∣x,a] is exact?

Read the answer

ML systems and evaluation L5 Long Mat
765
What are the main parts of a machine learning system in production, and how do they connect in a loop?

Read the answer

ML system design L1 Short Th
766
How should you structure an answer to a machine learning system design question, and how should you pace it in a 45-minute interview?

Read the answer

ML system design L1 Short Th
767
Why should you start an ML (machine learning) system design with a simple baseline, such as rules, popularity or logistic regression, before building a deep neural network?

Read the answer

ML system design L1 Short Th
768
How do you turn a vague business goal such as 'increase engagement on a video app' into an ML objective, offline metrics, online metrics and guardrail metrics?

Read the answer

ML system design L1 Short Th
769
What do latency, throughput, p50 and p90 mean? Given 10 request latencies of 12,18,10,45,14,15,120,11,20,15 milliseconds, what are the p50 and p90, and why do production systems promise p99 rather than the average?

Read the answer

ML system design L1 Short Th+Mat
770
When can you cache a machine learning model's predictions to save compute, and when is caching a bad idea?

Read the answer

ML system design L1 Short Th
771
Why do we sometimes train one model on several GPUs at once, and what is the simplest way to share the work between them?

Read the answer

ML system design L1 Short Th
772
An ML service has 100 million daily active users, and each user triggers 20 model requests per day. Peak traffic is 3× the daily average, and one server handles 500 QPS (queries per second) within the latency target. What are the average QPS, peak QPS, minimum servers needed, and servers needed with 30% headroom? Why do you size for peak rather than average?

Read the answer

ML system design L2 Short Mat
773
When should you choose batch (offline, precomputed) inference over online (real-time) inference, and how do hybrid designs combine the two?

Read the answer

ML system design L2 Short Th
774
What is a feature store, what problems does it solve in production ML, and when is it unnecessary?

Read the answer

ML system design L2 Short Th
775
Why does pure collaborative filtering fail on cold start, and how do you handle cold start for both new users and new items in a recommender system?

Read the answer

ML system design L2 Short Th
776
A model serves 1,000 requests per second, and you log 1 KB (kilobyte, 1,000 bytes) per prediction (inputs, output and model version). How much storage does this take per day, per 30 days and per year (365 days), why do we log predictions at all, and how can you cut the cost?

Read the answer

ML system design L2 Short Mat
777
How would you design a spam filter for a small college email server that receives 5,000 emails a day, of which about 20% are spam? If your model achieves 95% recall and a 0.5% false-positive rate, how many spam emails are missed and how many legitimate emails are wrongly flagged per day?

Read the answer

ML system design L2 Medium Th+Mat
778
How would you design a movie recommendation system for a small app with 10,000 users and 2,000 movies? Using a 3×3 rating table where Movie A has ratings (3,4,0), Movie B has (4,3,0) and Movie C has (0,3,4) from three users, what is the cosine similarity between Movie A and Movie B, and how much storage is needed to precompute 20 recommendations per user nightly?

Read the answer

ML system design L2 Medium Th+Mat
779
What are data, tensor and pipeline parallelism in distributed training, and when should you use each?

Read the answer

ML system design L3 Medium Th
780
You run data-parallel training on N=8 GPUs for a model with P=1 billion parameters and fp16 gradients (2 bytes each). Using ring all-reduce, how many bytes does each GPU send per step, and how long does communication take at 100 GB/s per link?

Read the answer

ML system design L3 Medium Mat
781
Mixed-precision Adam requires 16 bytes per parameter (2 B fp16 weights, 2 B fp16 gradients, 4 B fp32 master weights, and 4 B each for Adam moments m and v). For a 7-billion-parameter model across N=8 GPUs, how much per-GPU memory do model states take under plain data parallelism and ZeRO stages 1, 2 and 3?

Read the answer

ML system design L3 Medium Mat
782
What do p50 and p99 latency mean? Suppose a request fans out to 50 shards in parallel and waits for all of them, and each shard is slow (>100 ms) independently on 1% of calls. What fraction of requests is slow, how would you split a 200 ms p99 latency budget across ML serving stages, and how can you reduce tail latency?

Read the answer

ML system design L3 Medium Mat
783
Why must training features be joined “as of” each label’s timestamp, and how does a point-in-time join work? Using a small user timeline, why do naive joins inflate offline metrics and then fail online, and what is one serving-time alternative?

Read the answer

ML system design L3 Medium Th+Mat
784
Why do large recommenders and search engines split prediction into candidate generation (retrieval) followed by ranking? Suppose a catalogue has 10 million items and a heavy ranking model takes 50 µs per item; how does scoring the whole catalogue compare with using a two-tower model and approximate nearest neighbour (ANN) search to retrieve 1,000 candidates first?

Read the answer

ML system design L3 Medium Mat
785
How much memory does an approximate nearest neighbour (ANN) index of 100 million 256-dimensional item embeddings require in fp32 (32-bit floating point), in fp16 (16-bit floating point), and with product quantisation (PQ) using 32 sub-quantisers of 1 byte each? How does PQ achieve this compression, and what are the trade-offs?

Read the answer

ML system design L3 Short Mat
786
What artefacts and metadata must you version so that a trained ML model can be reproduced and safely rolled back in production, and why can bit-exact reproduction still fail?

Read the answer

ML system design L3 Medium Th
787
How do you design a CI/CD (continuous integration and continuous delivery) pipeline for a production ML system, and how does it differ from ordinary software CI/CD?

Read the answer

ML system design L3 Medium Th
788
How do you decide how often to retrain a production ML model, and what are degenerate feedback loops and how can you mitigate them?

Read the answer

ML system design L3 Medium Th
789
Clicks from a ranked list are biased by display position. Under the examination hypothesis P(click∣item,pos)=P(examined∣pos)×P(relevant∣item), with position propensities [1.0,0.6,0.3] for positions 1–3, how do you show that inverse propensity weighting (IPW) gives an unbiased estimate of relevance, and what are the naive click-through rate (CTR) and the IPW estimate for an item shown 100 times at position 1 (30 clicks), 100 times at position 2 (18 clicks), and 200 times at position 3 (18 clicks)?

Read the answer

ML system design L4 Medium Mat
790
A production model's request error rate is 2%. A canary deployment receives 5% of 1,000 queries per second (QPS). Using a one-sided test at significance level α=0.05 and power 0.8 (with zα=1.645 and zβ=0.8416), how many canary requests are needed to detect a rise in error rate to 2.5% against the baseline fleet, and how long does that take? Why does peeking repeatedly at canary metrics inflate false alarms?

Read the answer

ML system design L4 Medium Mat
791
How would you design a spam detection system for a large messaging or email platform?

Read the answer

ML system design L4 Long Th+Mat
792
How would you design a video recommendation system for a large video platform?

Read the answer

ML system design L4 Long Th+Mat
793
How would you design an ad click-through rate (CTR) prediction system?

Read the answer

ML system design L4 Long Th+Mat
794
How would you design a search ranking system for a large e-commerce site?

Read the answer

ML system design L4 Long Th+Mat
795
How would you design a real-time payment fraud detection system?

Read the answer

ML system design L4 Long Th+Mat
796
How would you design a retrieval-augmented question answering system over a company's internal documents? As part of the prompt budget, if the model has an 8,000-token context window, 1,000 tokens are reserved for system instructions and the user question, and 500 tokens are reserved for the answer, how many 400-token chunks fit?

Read the answer

ML system design L4 Long Th+Mat
797
How would you design a visual search system that finds products looking like an uploaded photo? Assuming 500 images/s per GPU (graphics processing unit) and USD 2 per GPU-hour, how much GPU time and cost does it take to re-embed a 500-million-image catalogue when upgrading the embedding model?

Read the answer

ML system design L4 Long Th+Mat
798
How would you design a system to serve a 7B-parameter large language model (LLM) chat service at scale? For a 32-layer model with hidden size 4,096 in 16-bit floating point (fp16, 14 GB of weights), what are the key–value (KV) cache memory per token, the memory for a 4,096-token sequence, roughly how many full-length sequences fit on an 80 GB GPU (graphics processing unit), and what is the serving cost per million output tokens if a GPU costs USD 2 per hour and sustains 2,500 output tokens/s?

Read the answer

ML system design L5 Long Th+Mat
799
How would you plan the infrastructure for training a 70B-parameter language model on 1.4 trillion tokens? Using C≈6ND FLOPs (floating-point operations, for N parameters and D tokens) and 16 bytes per parameter for mixed-precision AdamW model states, how much model-state memory does it need, how long does it take on 1,024 GPUs (graphics processing units, 312 TFLOP/s peak each at 40% model FLOPs utilisation, MFU), what data-pipeline throughput is required, and how do you handle parallelism, checkpointing and failure recovery?

Read the answer

ML system design L5 Long Th+Mat