Question 141 · Feature Engineering: The Art of Making Data ML-Ready · hard
A Class 10 student is building a linear regression model to predict the service charge on an IRCTC train ticket booking, using a categorical feature 'booking_channel' with 4 categories: Mobile App, Website, Kiosk, and Travel Agent. She one-hot encodes all 4 categories (creating 4 dummy columns, each 0 or 1) and also keeps the intercept column of 1s in her design matrix X. When she tries to solve the normal equation β = (XᵀX)⁻¹Xᵀy, the matrix XᵀX turns out to be singular and cannot be inverted. What causes this, and how should she fix her feature set?
The four one-hot columns sum to a constant vector of 1s that exactly equals the intercept column, making X's columns linearly dependent and X^T X singular; the fix is to drop one category (k-1 dummy encoding) or drop the intercept.
Binary-valued (0/1) columns always yield a singular X^T X regardless of category count, since determinants of 0/1 matrices are always zero; the fix is to standardize the dummy columns to continuous z-scores before regression.
X^T X becomes ill-conditioned rather than singular, because Mobile App usage and Website usage are empirically correlated in the training data; the fix is to run PCA on the four dummy columns to decorrelate them first.
The closed-form normal equation cannot solve problems where one-hot encoding raises the feature count beyond what a single step of gradient descent can update; the fix is to replace the normal equation with mini-batch gradient descent.
Answer: A. The four one-hot columns sum to a constant vector of 1s that exactly equals the intercept column, making X's columns linearly dependent and X^T X singular; the fix is to drop one category (k-1 dummy encoding) or drop the intercept.
ExplanationFor every row in the design matrix, exactly one of the four booking_channel dummy variables equals 1 and the rest equal 0, since each booking uses exactly one channel. So, row by row, Mobile App + Website + Kiosk + Travel Agent = 1 always — the sum of the four dummy columns equals the intercept column, which is itself a column of all 1s. This means the intercept column can be written as an exact linear combination of the other four columns, so the columns of X are linearly dependent and X does not have full column rank. Because rank(X) is less than the number of columns, X^T X is a singular matrix (determinant zero, at least one zero eigenvalue), so (X^T X)^{-1} does not exist — this is the classic "dummy variable trap." The standard fix is to use only k − 1 = 3 dummy columns, dropping one category (say, Travel Agent) whose effect is then absorbed into the intercept as the baseline/reference level, or alternatively to drop the intercept term entirely and keep all 4 dummy columns — either change restores full column rank and makes X^T X invertible.
Question 142 · AI Bias and Fairness: Building Ethical AI Systems · hard
An Indian fintech's AI credit-scoring model flags loan applicants as "high default risk" (predicted positive) or "low risk" (predicted negative). Two applicant groups, Group A and Group B, each have 100 applicants, and in both groups exactly 20 people are actual future defaulters (actual positive) while 80 are actual non-defaulters (actual negative) — so the base rate of default is identical across groups. Group A's confusion matrix: 15 true positives, 5 false negatives, 8 false positives, 72 true negatives. Group B's confusion matrix: 19 true positives, 1 false negative, 12 false positives, 68 true negatives. Both groups have the same overall accuracy of 87%. Which statement correctly computes the false positive rate (FPR) for each group and correctly identifies the fairness violation this reveals?
FPR_A = 8/100 = 8% and FPR_B = 12/100 = 12%, so Group A is favoured by a 4-percentage-point gap in false positive rate, which violates demographic parity but leaves equalized odds untouched.
FPR_A = 8/80 = 10% and FPR_B = 12/80 = 15%, so Group B's creditworthy applicants are wrongly denied loans at 1.5 times the rate of Group A's — equal accuracy and equal base rates do not guarantee equalized odds, since the model trades false positives against false negatives differently across the two groups.
FPR_A = 5/20 = 25% and FPR_B = 1/20 = 5%, so Group A applicants face a much higher false positive rate than Group B, showing the model unfairly flags safe Group A borrowers as defaulters far more often.
Since both groups have identical overall accuracy (87%) and identical actual default rates (20%), the model is fair by construction, and no further fairness metric needs to be checked because accuracy parity guarantees equalized odds.
Answer: B. FPR_A = 8/80 = 10% and FPR_B = 12/80 = 15%, so Group B's creditworthy applicants are wrongly denied loans at 1.5 times the rate of Group A's — equal accuracy and equal base rates do not guarantee equalized odds, since the model trades false positives against false negatives differently across the two groups.
ExplanationFalse positive rate is defined as FP divided by all actual negatives (FP + TN) — not by the total sample size, and not by the count of actual positives. For Group A, the 80 actual non-defaulters split into 8 false positives and 72 true negatives, giving FPR_A = 8/80 = 10%. For Group B, the 80 actual non-defaulters split into 12 false positives and 68 true negatives, giving FPR_B = 12/80 = 15%. Both groups have identical overall accuracy — (15+72)/100 = 87% for Group A and (19+68)/100 = 87% for Group B — and identical base rates of default (20/100 in each group). Yet the model reaches that shared accuracy through very different error trade-offs: Group A's false negative rate is 5/20 = 25%, while Group B's is only 1/20 = 5%, meaning the model catches Group B's actual defaulters far more aggressively, at the cost of wrongly flagging creditworthy Group B applicants 1.5 times as often as creditworthy Group A applicants (FPR 15% vs 10%, since 15/10 = 1.5). This is exactly what the Kleinberg-Chouldechova impossibility result warns about: when base rates are equal but the classifier is imperfect, matching accuracy across groups does not force false positive and false negative rates to match, so equalized odds can still be violated even while accuracy parity holds. A lender that only checks an aggregate accuracy number would completely miss that deserving Group B borrowers are being turned away noticeably more often than deserving Group A borrowers.
Question 143 · Building a Complete Data Preprocessing Pipeline · hard
A pipeline for detecting fraudulent UPI transactions uses a single feature: transaction amount in rupees. You have 8 transactions collected in chronological order: ₹200, ₹400, ₹400, ₹400, ₹500, ₹500, ₹700, ₹900. To prevent information from the future leaking into training, you perform a chronological split — the first 6 transactions form the training set and the last 2 form the test set — and then fit a StandardScaler (which computes the population standard deviation, dividing the sum of squared deviations by N, exactly as scikit-learn's StandardScaler does) following correct pipeline design. Using this correctly-fit scaler, what is the standardized z-score of the test transaction worth ₹700?
1.0, obtained by fitting the StandardScaler on the full set of 8 transactions (mean ₹500, std ₹200) before splitting into train and test
3.0, obtained by fitting the StandardScaler only on the 6 training transactions (mean ₹400, population std ₹100) and using those statistics to transform the test point
2.74, obtained by fitting the StandardScaler on the training transactions using the sample standard deviation with Bessel's correction (dividing the sum of squared deviations by 5 instead of 6)
-1.0, obtained by fitting a separate StandardScaler on the 2 test transactions alone (mean ₹800, std ₹100) and using its own statistics to transform itself
Answer: B. 3.0, obtained by fitting the StandardScaler only on the 6 training transactions (mean ₹400, population std ₹100) and using those statistics to transform the test point
ExplanationThe pipeline must fit the scaler only on the training set, then apply those exact statistics to transform the test set — this is the only way to avoid data leakage, since the test set is meant to simulate genuinely unseen future data whose distribution the model has not seen during fitting.
Training set (first 6, chronological): ₹200, 400, 400, 400, 500, 500.
Mean = (200+400+400+400+500+500)/6 = 2400/6 = ₹400.
Deviations from the mean: -200, 0, 0, 0, 100, 100.
Sum of squared deviations = 40000+0+0+0+10000+10000 = 60000.
Population variance = 60000/6 = 10000 (scikit-learn's StandardScaler divides by N, not N-1).
Population standard deviation = √10000 = ₹100.
Transforming the ₹700 test transaction using these train-only statistics:
z = (700 − 400)/100 = 300/100 = 3.0.
Fitting the scaler on all 8 transactions instead (mean ₹500, std ₹200) gives z = (700−500)/200 = 1.0 — the classic leakage mistake, where the test set's own values silently influence the very statistics used to transform it, making the pipeline's evaluation overly optimistic about how well the model will generalize to genuinely new transactions.
Using Bessel's correction (dividing the training sum of squared deviations by 5 instead of 6) produces std = √(60000/5) = √12000 ≈ ₹109.54 and z ≈ 300/109.54 ≈ 2.74; this is not what scikit-learn's StandardScaler computes by default, since it uses the population (biased, divide-by-N) estimator rather than the sample (divide-by-N-1) estimator.
Fitting a separate scaler on the 2-point test set alone (mean ₹800, std ₹100) gives z = (700−800)/100 = −1.0; this is doubly wrong because it never uses the training statistics at all, so the transformed test values would sit on a completely different scale than the transformed training values — meaningless input for a model that learned its weights on the training set's scale.
Question 144 · K-Nearest Neighbors: The Simplest ML Algorithm That Actually Works · hard
A telecom analytics team wants to predict whether a new customer (Age = 30 years, Annual Income = ₹5,00,000) will churn (Yes) or stay (No), using 3-NN on the following training data:
| Customer | Age (yrs) | Income (₹) | Churn |
|---|---|---|---|
| P1 | 32 | 6,00,000 | Yes |
| P2 | 55 | 5,05,000 | No |
| P3 | 29 | 20,00,000 | No |
| P4 | 31 | 4,90,000 | Yes |
| P5 | 58 | 5,10,000 | No |
The team first runs 3-NN using plain (unscaled) Euclidean distance on Age and Income directly, then separately runs 3-NN after min-max normalising both Age and Income to the range [0, 1] using the min/max from this training set. What is the correctly predicted churn class after min-max normalisation, and why does it differ from the unscaled result?
No — the three nearest neighbours by raw (unscaled) Euclidean distance are P2, P4 and P5, giving two No votes against one Yes.
Yes — after min-max normalisation, the three nearest neighbours become P4, P1 and P2, giving two Yes votes against one No.
Yes — normalisation makes P3 and P5 the closest neighbours to the query, overriding P2's raw-distance advantage.
The prediction stays No even after min-max normalisation; only z-score standardisation removes the income-scale bias, so the answer remains No.
Answer: B. Yes — after min-max normalisation, the three nearest neighbours become P4, P1 and P2, giving two Yes votes against one No.
ExplanationWith raw, unscaled features the income difference dominates the squared Euclidean distance because income spans roughly ₹4,90,000 to ₹20,00,000 while age spans only 29 to 58: a ₹5,000 income gap alone contributes 5000² = 2,50,00,000 to the squared distance, dwarfing even a 28-year age gap, which contributes only 28² = 784. Computing d² = (Δage)² + (Δincome)² for each training point gives distances of about 5000.06 (P2), 10000.00 (P4), 10000.04 (P5), 1,00,000.00 (P1) and 15,00,000.00 (P3). The 3 nearest are therefore P2, P4, P5 — two No votes to one Yes — so the raw model predicts No almost entirely on the basis of income, effectively ignoring age.
Min-max normalising each feature to [0,1] using the training set's own min and max (age: min 29, max 58, range 29; income: min ₹4,90,000, max ₹20,00,000, range ₹15,10,000) rescales both features to comparable magnitude. The query (30, 5,00,000) becomes (0.0345, 0.0066) in normalised coordinates. Recomputing Euclidean distance in this rescaled space gives approximately 0.0351 to P4, 0.0956 to P1, 0.8621 to P2, 0.9655 to P5 and 0.9940 to P3. The 3 nearest neighbours are now P4, P1 and P2 — a 2-Yes-to-1-No majority — flipping the prediction to Yes. P3 and P5 are in fact the two farthest points after normalisation, not the closest, since P3's income and P5's age are each extreme outliers relative to the query, so they cannot be its nearest neighbours. Min-max scaling alone is sufficient here because the problem was purely a magnitude mismatch between the two features' numeric ranges, not a distributional shape issue — z-score standardisation would achieve a similar rebalancing, but it is not the only fix, so the claim that min-max normalisation cannot correct the bias is false. This is exactly why feature scaling is a mandatory preprocessing step before applying any distance-based algorithm such as k-NN: without it, whichever feature happens to have the largest numeric range silently dominates every distance calculation.
Question 145 · Building a Neural Network from Scratch: The Complete Implementation · hard
A Grade 10 student building a tiny 2-layer neural network from scratch (to flag suspicious UPI transactions) uses the following forward pass:
```
Input: x = 2
Hidden layer: z1 = w1*x + b1, a1 = sigmoid(z1)
Output layer: z2 = w2*a1 + b2, a2 = sigmoid(z2)
Loss: L = 0.5*(a2 - y)^2
```
Given w1 = 0.5, b1 = 0, w2 = 0.4, b2 = 0.1, target y = 1, and the already-computed forward-pass values a1 ≈ 0.7311 and a2 ≈ 0.5969, what is ∂L/∂w1 (rounded to four decimal places), computed by backpropagating through both layers using σ'(z) = σ(z)(1 − σ(z))?
≈ -0.0153, from the five-factor chain (a2 - y) · a2(1 - a2) · w2 · a1(1 - a1) · x, which correctly propagates the error back through the output layer's weight w2 before reaching w1
≈ -0.0381, from chaining (a2 - y) · a2(1 - a2) · a1(1 - a1) · x while skipping the multiplication by w2, since w1 is not directly connected to the output
≈ -0.0076, from the correct five-factor chain rule product but leaving out the final multiplication by the input x = 2, since dz1/dw1 = x
≈ +0.0153, from the correct five-factor chain rule magnitude but using (y - a2) instead of (a2 - y) as the loss derivative, which flips the sign of the gradient
Answer: A. ≈ -0.0153, from the five-factor chain (a2 - y) · a2(1 - a2) · w2 · a1(1 - a1) · x, which correctly propagates the error back through the output layer's weight w2 before reaching w1
ExplanationBackpropagation for w1 requires chaining gradients through both layers, since w1 only reaches the loss via a1 and then a2. Using σ'(z) = σ(z)(1 − σ(z)): the output layer contributes ∂L/∂a2 = (a2 − y) = 0.5969 − 1 = −0.4031, and ∂a2/∂z2 = a2(1 − a2) = 0.5969 × 0.4031 ≈ 0.2406. To reach w1, this signal must still pass through the output weight, ∂z2/∂a1 = w2 = 0.4, then through the hidden layer's own activation derivative, ∂a1/∂z1 = a1(1 − a1) = 0.7311 × 0.2689 ≈ 0.1966, and finally ∂z1/∂w1 = x = 2. Multiplying all five factors — (−0.4031)(0.2406)(0.4)(0.1966)(2) — gives ∂L/∂w1 ≈ −0.0153. Skipping the w2 factor treats the hidden weight as if it fed the loss directly, understating how far back the error must travel and giving a gradient roughly 2.5 times too large in magnitude. Dropping the final ×x term forgets that a linear pre-activation's derivative with respect to its weight is exactly the input feeding it, giving only −0.0076. And swapping the loss derivative to (y − a2) reverses the sign of every downstream gradient to +0.0153, which would make gradient descent push w1 in exactly the wrong direction.
Question 146 · Matrix Decomposition and SVD: The Swiss Army Knife of Linear Algebra · hard
ISRO's Cartosat satellite beams down a 4×4 block of pixel intensities from a terrain scan, stored as matrix A. Ground-station software computes its SVD and finds the singular values, in decreasing order, are σ₁ = 20, σ₂ = 12, σ₃ = 5, σ₄ = 1. To compress the block, the onboard algorithm keeps only the two largest singular values, forming the rank-2 approximation A₂ = σ₁u₁v₁ᵀ + σ₂u₂v₂ᵀ. By the Eckart-Young-Mirsky theorem, what is the Frobenius-norm compression error ‖A − A₂‖_F?
√26 ≈ 5.10, the square root of the sum of squares of the two discarded singular values σ₃ and σ₄
6, the direct sum of the two discarded singular values σ₃ + σ₄ without squaring them
5, the single largest discarded singular value σ₃, ignoring σ₄ entirely
√570 ≈ 23.87, the full Frobenius norm of A computed from all four singular values σ₁ through σ₄
Answer: A. √26 ≈ 5.10, the square root of the sum of squares of the two discarded singular values σ₃ and σ₄
ExplanationFor any matrix A ∈ ℝ^(m×n) with SVD A = UΣVᵀ and singular values σ₁ ≥ σ₂ ≥ ... ≥ σᵣ ≥ 0, the Eckart-Young-Mirsky theorem states that among all matrices of rank ≤ k, the Frobenius-norm-closest one to A is A_k = Σᵢ₌₁ᵏ σᵢuᵢvᵢᵀ — built from the top k singular triplets — and the resulting minimum error is ‖A − A_k‖_F = √(Σᵢ₌ₖ₊₁ʳ σᵢ²), the square root of the sum of squares of the discarded singular values.
This follows from a key invariance: for any matrix M, ‖M‖_F² equals the sum of squares of M's own singular values (this is just the Frobenius norm computed in the orthonormal basis that diagonalizes M). Since U and V are orthogonal, ‖A − A_k‖_F² = ‖Σ − Σ_k‖_F², and Σ − Σ_k is diagonal with entries 0,...,0,σ_{k+1},...,σᵣ. So the squared error is exactly Σᵢ₌ₖ₊₁ʳ σᵢ², and no other rank-k matrix can do better — truncating the smallest singular values is provably optimal, not just a convenient heuristic.
Here r = 4, k = 2, and the singular values are 20, 12, 5, 1. Keeping σ₁ = 20 and σ₂ = 12 discards σ₃ = 5 and σ₄ = 1, so
‖A − A₂‖_F = √(σ₃² + σ₄²) = √(5² + 1²) = √(25 + 1) = √26 ≈ 5.10.
The energy that survives compression is captured by σ₁ and σ₂ (20² + 12² = 544), while the lost energy is 5² + 1² = 26 — together these account for the full ‖A‖_F² = 570, since Frobenius energy adds in quadrature across all singular values, kept or discarded.
The distractor of 6 comes from summing σ₃ and σ₄ directly (5 + 1) instead of summing their squares before taking a square root — this confuses the L1-style additivity of singular values with the L2 (quadratic) structure of the Frobenius norm, in which errors from independent orthogonal directions combine like a Euclidean hypotenuse, not a simple sum. The distractor of 5 comes from assuming only the next-largest singular value after the cutoff matters and forgetting that every discarded singular value, however small, contributes its own orthogonal share of leftover energy. The distractor of √570 ≈ 23.87 confuses the residual error with the total size of A itself — it sums the squares of all four singular values (including the two that were kept), which would only be the error of the trivial rank-0 approximation A₀ = 0, not of the rank-2 approximation A₂.
Question 147 · Convex Optimization: Why ML Problems Are (Sometimes) Easy to Solve · hard
A UPI fraud-detection team fits a single-parameter linear model ŷ = w·x (no intercept) to predict transaction risk scores from account velocity, and the resulting mean-squared-error loss function simplifies to L(w) = 3w² − 12w + 20. What is the true minimum value of L(w), and why can gradient descent be guaranteed to reach it regardless of the value of w it starts from?
Minimum loss is 8 at w = 2, and since L''(w) = 6 > 0 for every real w, L is strictly convex everywhere; this critical point is therefore the unique global minimum, so gradient descent converges to it from any starting value of w.
Gradient descent reaches loss 8 at w = 2 only when initialized near w = 2, because quadratic loss surfaces can still hide shallow local minima farther from the global optimum, making initialization critical even here.
Solving L'(w) = 6w + 12 = 0 gives w = −2, so the minimum loss is L(−2) = 56 — the correct value once the sign of the linear term's derivative is accounted for.
Since L(0) = 20 is the smallest loss among small integer trial values and the squared term 3w² is always non-negative, w = 0 gives the guaranteed minimum loss of 20.
Answer: A. Minimum loss is 8 at w = 2, and since L''(w) = 6 > 0 for every real w, L is strictly convex everywhere; this critical point is therefore the unique global minimum, so gradient descent converges to it from any starting value of w.
ExplanationL(w) = 3w² − 12w + 20 is a single-variable quadratic, so its derivative L'(w) = 6w − 12 has one stationary point: setting 6w − 12 = 0 gives w = 2, and L(2) = 3(2)² − 12(2) + 20 = 12 − 24 + 20 = 8. The second derivative L''(w) = 6 is a positive constant for every real w — not just near w = 2 — which is exactly the condition for strict convexity: the loss curve bends upward everywhere, like a single bowl with no dips, ridges, or flat plateaus anywhere else on the real line. Because a strictly convex function can have at most one stationary point, and that point must be a minimum, w = 2 is guaranteed to be the unique global minimum, not merely a local one. This is precisely the property that makes gradient descent reliable here: from any starting w₀, the negative gradient always points toward w = 2, so with a suitably small learning rate the iterates converge to loss 8 regardless of initialization — there is no other basin to get trapped in. Contrast this with the loss surfaces of deep neural networks, which are generally non-convex and can contain many local minima and saddle points, where the starting point genuinely changes where training ends up. Convexity is why problems like linear regression, ridge regression, and logistic regression are "easy" in a precise mathematical sense: optimization theory guarantees convergence to the single best solution, a guarantee that vanishes the moment the loss function stops being convex.
Question 148 · Capstone: Building a Complete ML Pipeline End-to-End · hard
You are building an end-to-end UPI fraud-detection pipeline. The training set contains four transaction amounts (in ₹): 100, 200, 300, 400. A transaction of ₹500 sits in the held-out test set. Following correct pipeline order — every preprocessing step is fit ONLY on training data, then applied unchanged to test data — you fit a StandardScaler (population standard deviation, sklearn's default) on the four training amounts and use it to transform the ₹500 test point. Which option gives the resulting z-score together with the method that correctly produces it?
z ≈ 2.24, obtained by fitting the scaler's mean and standard deviation using only the four training amounts (₹100, 200, 300, 400), then transforming the ₹500 test point with those fixed parameters
z ≈ 1.41, obtained by fitting the scaler's mean and standard deviation using all five amounts, including the ₹500 test transaction, before transforming any point
z ≈ 1.94, obtained by fitting the scaler on only the four training amounts but computing the standard deviation with the sample formula, dividing the sum of squared deviations by n−1 instead of n
z ≈ 1.33, obtained by applying min-max normalization with the training set's minimum and maximum (₹100 and ₹400) instead of standardization
Answer: A. z ≈ 2.24, obtained by fitting the scaler's mean and standard deviation using only the four training amounts (₹100, 200, 300, 400), then transforming the ₹500 test point with those fixed parameters
ExplanationThe golden rule of a leak-free pipeline is: fit every preprocessing transform on the training fold only, then apply the frozen parameters to anything downstream, including test data. Here the training mean is (100+200+300+400)/4 = 250. The squared deviations from this mean are (-150)² = 22500, (-50)² = 2500, (50)² = 2500, (150)² = 22500, summing to 50000. Dividing by n = 4 (population convention) gives a variance of 12500, so the standard deviation is √12500 = 50√5 ≈ 111.80. Transforming the test point: z = (500 − 250)/111.80 = 250/111.80 = √5 ≈ 2.24. Fitting the scaler on all five amounts instead (mean 300, std ≈141.42) leaks the test point's own value into the statistics used to score it, artificially compressing its z-score to ≈1.41 and quietly inflating apparent test performance — the single most common capstone bug. Using the sample standard deviation (dividing by n−1 = 3) instead of the population convention gives std ≈129.10 and z ≈1.94, a formula mismatch rather than a leakage error. Swapping in min-max scaling changes the preprocessing method entirely, giving (500−100)/(400−100) ≈1.33, and also exposes that ₹500 lies outside the training range, a separate pipeline concern.
Question 149 · Naive Bayes for Text Classification: Spam, Sentiment, and Language Detection · hard
A Grade 10 student is building an SMS spam filter (to catch fake UPI-cashback messages) using Multinomial Naive Bayes with Laplace (add-one) smoothing, trained on this small labelled corpus:
Spam (3 messages): "win money now", "win free money", "call now win"
Ham (2 messages): "call me now", "let us meet now"
The full vocabulary across both classes has V = 9 distinct words. Using P(word | class) = (count(word, class) + 1) / (N_class + V), where N_class is the total number of word-tokens in that class, and priors P(Spam) = 3/5 and P(Ham) = 2/5 estimated from the message counts, what is the exact posterior odds ratio P(Spam | "win now") : P(Ham | "win now"), and which class does the filter predict?
Since "win" never appears in the Ham training messages, the raw (unsmoothed) likelihood P(win | Ham) equals zero, so the message would be classified as Spam with infinite confidence regardless of the smoothing scheme used.
Dropping the class priors and comparing only the smoothed word likelihoods gives an odds ratio of 256 : 81 (approximately 3.16 : 1) in favour of Spam.
Because Ham's training messages contain fewer total word-tokens (7 vs 9) than Spam's, Laplace smoothing shifts the balance enough that the correct odds ratio is 27 : 128 in favour of Ham, and the filter predicts Ham.
Answer: A. P(Spam | "win now") : P(Ham | "win now") = 128 : 27 (approximately 4.74 : 1), so the Naive Bayes filter predicts Spam.
ExplanationAcross the 5 training messages the vocabulary has V = 9 distinct words: win, money, now, free, call, me, let, us, meet. Spam contributes N_spam = 9 word-tokens with counts win=3, money=2, now=2, free=1, call=1. Ham contributes N_ham = 7 word-tokens with counts call=1, me=1, now=2, let=1, us=1, meet=1. The priors from message counts are P(Spam) = 3/5 and P(Ham) = 2/5.
Applying Laplace smoothing, P(word | class) = (count + 1)/(N_class + V):
P(win|Spam) = (3+1)/(9+9) = 4/18 = 2/9
P(now|Spam) = (2+1)/18 = 3/18 = 1/6
P(win|Ham) = (0+1)/(7+9) = 1/16
P(now|Ham) = (2+1)/16 = 3/16
Notice P(win|Ham) = 1/16, not zero — smoothing has already absorbed the zero-frequency problem, which is why the message can still be scored under Ham at all.
Naive Bayes treats the words as conditionally independent given the class, so the unnormalized posterior score is the prior times the product of the per-word likelihoods:
Score(Spam) = (3/5)(2/9)(1/6) = 6/270 = 1/45
Score(Ham) = (2/5)(1/16)(3/16) = 6/1280 = 3/640
The normalizing constant P("win now") is the same positive number for both classes, so it cancels in the ratio, meaning the posterior odds equal the score ratio:
Score(Spam)/Score(Ham) = (1/45) ÷ (3/640) = (1/45)(640/3) = 640/135 = 128/27 ≈ 4.74
Since 128/27 > 1, the filter assigns "win now" to Spam, with exact posterior odds P(Spam|"win now") : P(Ham|"win now") = 128 : 27. Dropping the priors instead (comparing only (2/9)(1/6) = 1/27 against (1/16)(3/16) = 3/256) gives a different, smaller ratio of 256/81 ≈ 3.16 — a reminder that the prior is not a constant that can be ignored once the class sizes differ, even though it still happens to favour Spam here. Ham having fewer training tokens does not "shift the balance" toward Ham; a smaller N_class actually makes each smoothed probability estimate less concentrated (closer to the uniform 1/V), which is a separate effect from which class the odds ratio ultimately favours.
Question 150 · AI in Indian Healthcare: From Diagnosis to Drug Discovery · hard
An AI-based chest X-ray screening tool for tuberculosis, deployed under a district-level screening drive modelled on India's National TB Elimination Programme, has a sensitivity of 90% and a specificity of 95%. If the true TB prevalence in the screened population is 2%, what percentage of everyone the AI flags as "positive" actually has TB?
Approximately 90%, since a screening test's positive predictive value is equal to its sensitivity regardless of disease prevalence.
Approximately 95%, since a screening test's positive predictive value is equal to its specificity regardless of disease prevalence.
Approximately 26.9%, because with only 2% TB prevalence the 98,000 healthy people screened produce far more false positives than the 2,000 truly infected people produce true positives.
Approximately 2%, since the positive predictive value of any screening test converges to the disease prevalence in the population being screened.
Answer: C. Approximately 26.9%, because with only 2% TB prevalence the 98,000 healthy people screened produce far more false positives than the 2,000 truly infected people produce true positives.
ExplanationSensitivity and specificity describe the AI tool's behaviour given the true disease status, but the question asks the reverse: given a positive AI flag, what is the true disease status? That reversal needs Bayes' theorem, and the answer depends heavily on prevalence, not just on sensitivity or specificity alone.
Let D = "has TB" and T+ = "AI flags positive." We're given P(D) = 0.02, so P(not D) = 0.98; sensitivity P(T+|D) = 0.90; and specificity 0.95 means the false-positive rate is P(T+|not D) = 1 − 0.95 = 0.05.
Bayes' theorem gives:
P(D|T+) = [P(T+|D)·P(D)] / [P(T+|D)·P(D) + P(T+|not D)·P(not D)]
Numerator = 0.90 × 0.02 = 0.018
Denominator = 0.018 + (0.05 × 0.98) = 0.018 + 0.049 = 0.067
P(D|T+) = 0.018 / 0.067 ≈ 0.2687, i.e., about 26.9%.
A headcount check on 100,000 screened people confirms this. Of 2,000 people who truly have TB, 90% sensitivity catches 1,800 (true positives), missing 200. Of the 98,000 TB-free people, 95% specificity correctly clears 93,100, but the remaining 5% — 4,900 people — are false positives. The AI therefore flags 1,800 + 4,900 = 6,700 people in total, and only 1,800 of them are truly infected: 1,800 / 6,700 ≈ 26.9%.
This is precisely why population-scale AI screening tools used in programmes like India's National TB Elimination Programme are always paired with a confirmatory molecular test (such as CBNAAT/NAAT) before treatment begins: once prevalence drops to a few percent, the vastly larger healthy population generates more false alarms than the small infected population generates true detections, even at 95% specificity.
Question 151 · Mathematics for ML: A Comprehensive Review and Connections · hard
A Class 10 student is training a toy single-parameter linear regression model that predicts a shopkeeper's monthly UPI collection ŷ (in thousands of rupees) from a normalised "transaction activity score" x, using ŷ = w·x (no bias term, for simplicity). For one training example, x = 4 and the true monthly collection is y = 10. The current weight is w = 2. Using the squared-error loss L(w) = ½(ŷ − y)² and gradient descent with learning rate η = 0.1, what is the updated weight after exactly one gradient descent step?
w = 2.8, reached by subtracting the learning rate times the true gradient (ŷ − y)x from the current weight.
w = 1.2, reached by adding the learning rate times the gradient instead of subtracting it.
w = 3.6, reached by using the gradient of the unscaled squared error 2(ŷ − y)x instead of the ½-scaled version.
w = 2.2, reached by using only (ŷ − y) as the gradient and omitting the factor of x from the chain rule.
Answer: A. w = 2.8, reached by subtracting the learning rate times the true gradient (ŷ − y)x from the current weight.
ExplanationCompute the prediction first: ŷ = w·x = 2 × 4 = 8. The loss is L(w) = ½(ŷ − y)² = ½(8 − 10)² = ½ × 4 = 2. To update w, find dL/dw via the chain rule: dL/dŷ = (ŷ − y) — the ½ in the loss exists precisely to cancel the factor of 2 that the power rule brings down from squaring — and dŷ/dw = x (since ŷ = w·x). So dL/dw = (ŷ − y)·x = (8 − 10) × 4 = −8. Gradient descent moves the weight opposite to the gradient's direction: w_new = w − η·(dL/dw) = 2 − 0.1 × (−8) = 2 + 0.8 = 2.8. The negative sign of the gradient makes sense here: the model under-predicted (ŷ = 8 < y = 10), so the update correctly pushes w upward, toward a larger prediction. This single computation links three core ideas from mathematics for ML: the chain rule for composing the loss with the model, the ½ convention that keeps derivatives clean, and the geometric interpretation of gradient descent as moving against the direction of steepest increase.
Question 152 · AI for Indian Agriculture: From Soil to Satellite · hard
An agri-tech startup deploys a drone-mounted CNN to flag early bacterial blight in cotton fields across Vidarbha, Maharashtra, so smallholder farmers can spray before the infection spreads. On a held-out test set of 10,000 leaf images (500 images truly show blight; 9,500 are healthy), the model's confusion matrix is: predicted-blighted and actually-blighted = 350; predicted-healthy and actually-blighted = 150; predicted-blighted and actually-healthy = 250; predicted-healthy and actually-healthy = 9,250. The company's marketing states "96% accurate, trust the app." Based on this confusion matrix, what is the model's recall (sensitivity) for the blighted class, and what does that reveal about the marketing claim?
Recall = 350/500 = 70 percent: the 96 percent accuracy figure is dominated by the 9,500 healthy images and hides the fact that 150 of 500 truly blighted plants (30 percent) are misclassified as healthy, so nearly a third of infected fields would go unsprayed if farmers trusted the accuracy claim alone.
Recall = 96 percent, because once overall accuracy is high on a large enough test set, it already reflects how reliably the model detects the positive (blighted) class, so a separate recall calculation is not needed here.
Recall = 350/600 = 58.3 percent, since recall is defined as the fraction of images the model flagged as blighted that were truly blighted, which means the accuracy claim actually understates rather than overstates the model's real performance.
Recall cannot exceed the 5 percent prevalence of blight in the test set, so any reported detection rate for the blighted class above 5 percent would be mathematically impossible given this class imbalance.
Answer: A. Recall = 350/500 = 70 percent: the 96 percent accuracy figure is dominated by the 9,500 healthy images and hides the fact that 150 of 500 truly blighted plants (30 percent) are misclassified as healthy, so nearly a third of infected fields would go unsprayed if farmers trusted the accuracy claim alone.
ExplanationRecall (sensitivity) for the blighted class is TP/(TP+FN). From the confusion matrix, TP = 350 (blighted plants the model correctly caught) and FN = 150 (blighted plants the model missed), so recall = 350/(350+150) = 350/500 = 0.70, i.e. 70 percent. Compare this with accuracy, computed over all 10,000 images: (TP+TN)/Total = (350+9,250)/10,000 = 9,600/10,000 = 0.96, i.e. 96 percent — matching the marketing claim exactly. The two numbers diverge this sharply because the test set is heavily imbalanced (only 5 percent of images are truly blighted): a model can label almost every image "healthy" and still rack up a high accuracy score, since the 9,500 healthy images dominate the denominator. The 96 percent figure is technically correct but ethically misleading as a headline for this product, because the quantity that matters to a farmer deciding whether to trust an "all clear" reading is recall, not accuracy — and here 150 of 500 genuinely blighted plants (30 percent) are missed entirely. Bacterial blight spreads rapidly through a field once established, so an undetected 30 percent miss rate can mean the difference between an early, cheap spray and a late-stage yield loss, and smallholder farmers with the least financial cushion are the ones most exposed to that gap between the marketed number and the number that actually governs their risk. For reference, precision here is TP/(TP+FP) = 350/(350+250) = 350/600 ≈ 58.3 percent — a different, also-important quantity (how many "blighted" alerts are real), but not what the question asks for, and confusing it with recall is a common error since both have TP in the numerator. Prevalence (5 percent) is simply the base rate of the positive class in the data; it places no mathematical ceiling on recall, which depends only on how the TP and FN counts split within the positive class itself.
Question 153 · Singular Value Decomposition (SVD) Simplified · hard
A 2×2 linear map is given by the matrix
```
A = [ 3 0 ]
[ 4 5 ]
```
Singular values are the non-negative square roots of the eigenvalues of AᵀA. Carrying out that full procedure — transpose, multiply, find eigenvalues, then take square roots — what are the two singular values of A?
√5 and 3√5 (approximately 2.24 and 6.71)
5 and 45, the eigenvalues of AᵀA, without taking their square root
3 and 5, the eigenvalues of A read directly from its triangular structure
20 and 25, the off-diagonal and diagonal entries of AᵀA
Answer: A. √5 and 3√5 (approximately 2.24 and 6.71)
ExplanationSingular values of A are defined as the non-negative square roots of the eigenvalues of AᵀA (equivalently, of AAᵀ). Start by transposing A = [[3,0],[4,5]] to get Aᵀ = [[3,4],[0,5]]. Multiplying, AᵀA = [[3,4],[0,5]] · [[3,0],[4,5]] = [[3·3+4·4, 3·0+4·5], [0·3+5·4, 0·0+5·5]] = [[25,20],[20,25]].
This product is always symmetric, so its eigenvalues are real. The characteristic equation is det(AᵀA − λI) = (25−λ)² − 20² = 0, so (25−λ)² = 400, giving 25−λ = ±20, hence λ = 5 or λ = 45.
Taking square roots gives the singular values σ₁ = √45 = 3√5 ≈ 6.71 and σ₂ = √5 ≈ 2.24.
Two quick sanity checks confirm this without needing a calculator. The product of the singular values must equal |det A|: 3√5 · √5 = 3·5 = 15, and indeed det A = 3·5 − 0·4 = 15 — a match. The sum of their squares must equal the sum of squares of every entry of A (the squared Frobenius norm): 45 + 5 = 50, and 3² + 0² + 4² + 5² = 9+0+16+25 = 50 — another match.
The other choices come from stopping partway through this same computation. Quoting 5 and 45 skips the final square-root step, leaving the eigenvalues of AᵀA rather than the singular values themselves. Quoting 3 and 5 confuses singular values with the eigenvalues of A directly (trivially readable here since A is triangular); that shortcut only works when A is symmetric (or more generally normal), which this A is not. Quoting 20 and 25 mistakes the entries of the matrix AᵀA for its eigenvalues — a 2×2 matrix is generally not diagonal in the standard basis, so its entries are not automatically its eigenvalues.
Question 154 · PCA: Dimensionality Reduction Wizard · hard
A CBSE Grade 10 school in Pune tracks two mean-centered study metrics for students preparing for the Term 2 board exams — weekly self-study hours (X) and the number of NCERT practice questions solved (Y) — and finds their covariance matrix to be Σ = [[5, 2], [2, 2]]. To compress this 2D data with PCA, the school computes the eigenvalues of Σ by solving its characteristic equation. What percentage of the total variance in the data is captured by the first principal component (the eigenvector associated with the larger eigenvalue)?
Since the diagonal entries of Σ are 5 and 2, the principal components coincide with the original X and Y axes, so PC1 captures 5/7 ≈ 71.4% of the total variance.
Expanding det(Σ − λI) as λ² − 7λ + (ad − b) = λ² − 7λ + 8 = 0 (dropping the square on the covariance term) gives eigenvalues (7 ± √17)/2 ≈ 5.56 and 1.44, so PC1 captures ≈79.5% of the total variance.
The eigenvalues are 6 and 1, found from λ² − 7λ + 6 = 0 factoring as (λ − 6)(λ − 1) = 0, so PC1 captures 6/7 ≈ 85.7% of the total variance.
Total variance equals the sum of all four entries of Σ (5 + 2 + 2 + 2 = 11), so PC1 (eigenvalue 6) captures 6/11 ≈ 54.5% of the total variance.
Answer: C. The eigenvalues are 6 and 1, found from λ² − 7λ + 6 = 0 factoring as (λ − 6)(λ − 1) = 0, so PC1 captures 6/7 ≈ 85.7% of the total variance.
ExplanationFor a 2×2 symmetric covariance matrix Σ = [[a, b], [b, d]], the eigenvalues solve λ² − (a+d)λ + (ad − b²) = 0, because the trace a+d equals the sum of the eigenvalues and the determinant ad − b² equals their product. Here a = 5, d = 2, b = 2, so the characteristic equation is λ² − 7λ + (10 − 4) = λ² − 7λ + 6 = 0, which factors as (λ − 6)(λ − 1) = 0, giving λ₁ = 6 and λ₂ = 1. As a check, 6 + 1 = 7 matches the trace 5 + 2, and 6 × 1 = 6 matches the determinant, confirming the factorization is correct. The first principal component is the eigenvector for the larger eigenvalue: solving (Σ − 6I)v = 0 gives −v₁ + 2v₂ = 0, so v is proportional to (2, 1) — the direction along which the correlated data spreads out most. The variance explained by this axis is λ₁ / (λ₁ + λ₂) = 6/7 ≈ 85.7%. Notice that neither diagonal entry, 5 nor 2, is itself an eigenvalue: whenever the off-diagonal covariance b is nonzero, the positive correlation between X and Y tilts the principal axes away from the original coordinate directions, which is precisely why PCA requires diagonalizing Σ rather than simply ranking the individual variable variances. Total variance is the trace (sum of the variances on the diagonal), not the sum of every matrix entry — the off-diagonal covariance already appears twice in that sum, once as Cov(X,Y) and once as Cov(Y,X), and should not be added into the variance total at all.
Question 155 · Information Theory: Measuring Surprise · hard
A UPI payment gateway classifies every transaction into exactly one of four outcomes: Success (probability 0.5), Insufficient Balance (probability 0.25), Bank Server Timeout (probability 0.125), and Suspected Fraud Block (probability 0.125). Using Shannon's self-information, I(x) = -log₂ p(x), and entropy, H(X) = Σ p(x)·I(x), what are the entropy of this outcome distribution and the self-information carried by a single Suspected Fraud Block event?
Since there are four possible outcomes, H(X) equals log₂(4) = 2 bits, and the Suspected Fraud Block event also carries 2 bits of self-information.
Averaging the four self-information values (1, 2, 3, and 3 bits) gives H(X) = 2.25 bits, while the Suspected Fraud Block event still carries 3 bits of self-information.
The distribution's entropy H(X) equals 1.75 bits, and a single Suspected Fraud Block event carries exactly 3 bits of self-information.
H(X) works out to 1.75 bits overall, though the Suspected Fraud Block event itself carries only 2 bits of self-information.
Answer: C. The distribution's entropy H(X) equals 1.75 bits, and a single Suspected Fraud Block event carries exactly 3 bits of self-information.
ExplanationStart from the self-information of each outcome individually, I(x) = -log₂ p(x):
Success: p = 0.5 = 1/2, so I = -log₂(1/2) = 1 bit.
Insufficient Balance: p = 0.25 = 1/4, so I = -log₂(1/4) = 2 bits.
Bank Server Timeout: p = 0.125 = 1/8, so I = -log₂(1/8) = 3 bits.
Suspected Fraud Block: p = 0.125 = 1/8, so I = -log₂(1/8) = 3 bits.
A rarer outcome always carries more self-information — halving the probability adds exactly one bit, which is why the two 1/8-probability outcomes (3 bits each) are more "surprising" than Success (1 bit).
Entropy is the probability-weighted average of these self-information values, H(X) = Σ p(x)·I(x), not a plain average across the categories:
H(X) = 0.5(1) + 0.25(2) + 0.125(3) + 0.125(3)
= 0.5 + 0.5 + 0.375 + 0.375
= 1.75 bits.
So the outcome distribution has entropy 1.75 bits, and a single Suspected Fraud Block event, on its own, carries 3 bits of self-information — these are two different quantities answering two different questions ("how surprising is this one event?" versus "how surprising is the outcome on average, before we see it?").
The claim that H(X) = 2 bits comes from silently discarding the given probabilities and assuming all four outcomes are equally likely (log₂ 4 = 2); that would only be correct if every category truly had probability 0.25, which is not the case here — three of the four stated probabilities are not 0.25.
The claim that H(X) = 2.25 bits comes from averaging the four self-information numbers (1, 2, 3, 3) as if each category counted equally — (1+2+3+3)/4 = 2.25 — which ignores that Success happens far more often than Bank Server Timeout or Fraud Block. Entropy is an expectation, so frequent outcomes must be weighted more heavily than rare ones, not counted once each.
The claim that Fraud Block carries only 2 bits mistakes its probability for 0.25 instead of 0.125 — an easy slip since both are powers of two, but log₂(1/0.25) = 2 while log₂(1/0.125) = 3, and the problem states the probability is 0.125.
Question 156 · Maximum Likelihood Estimation (MLE) Basics · hard
IRCTC has numbered every coach in a special commemorative fleet consecutively from 1 to N, but N itself was never published anywhere. A ticket-checking inspector notes the serial numbers stamped on 5 coaches chosen at random (without replacement) from the fleet: 12, 23, 38, 45, and 61. Assuming every coach was equally likely to appear in the sample, what is the maximum likelihood estimate N̂ of the total fleet size N?
The maximum likelihood estimate is N̂ = 61 — the likelihood L(N) = 1/N⁵ for N ≥ 61 (and 0 otherwise) is a strictly decreasing function of N, so among all values of N consistent with the data it is maximized at the smallest one, namely the largest serial number actually observed.
Using the method-of-moments estimator N̂ = 2X̄ − 1 with the sample mean 35.8 gives N̂ ≈ 71, and this moment-matching value is what maximum likelihood estimation computes.
Applying the bias-corrected estimator N̂ = m(n+1)/n − 1 to the sample maximum m = 61 yields N̂ ≈ 72, since maximum likelihood estimation is defined to produce the unbiased estimate of N.
Doubling the largest serial number observed, 61, gives N̂ = 122 as the maximum likelihood estimate, on the reasoning that a random sample should on average cover about half of all the coaches in the fleet.
Answer: A. The maximum likelihood estimate is N̂ = 61 — the likelihood L(N) = 1/N⁵ for N ≥ 61 (and 0 otherwise) is a strictly decreasing function of N, so among all values of N consistent with the data it is maximized at the smallest one, namely the largest serial number actually observed.
ExplanationModel the fleet as coaches labeled 1, 2, …, N, with each coach equally likely to be selected. For a single draw, P(X = x) = 1/N for x ∈ {1,…,N} and 0 otherwise — crucially, this probability is 0 for any x > N, since a coach numbered higher than N cannot exist.
For the sample x₁,…,x₅ = 12, 23, 38, 45, 61, the likelihood as a function of the unknown parameter N is
L(N) = (1/N)⁵ if N ≥ max(x₁,…,x₅), and L(N) = 0 if N < max(x₁,…,x₅).
Here max(12, 23, 38, 45, 61) = 61, so any N < 61 gives L(N) = 0 — it is flatly inconsistent with having observed a coach numbered 61. For every N ≥ 61, L(N) = 1/N⁵, and this is strictly decreasing in N: as N grows, the same five specific numbers become progressively less probable, because they are being drawn from an ever-larger equally-likely set. (The same conclusion follows if you instead compute the exact without-replacement probability of this unordered sample, 1/C(N,5); that quantity is also strictly decreasing in N for N ≥ 5, so it too is maximized at the smallest permissible N.)
A strictly decreasing function on N ≥ 61 attains its maximum at the left endpoint, so
N̂_MLE = 61.
This is the classical "German tank problem," and the two wrong estimators here are not arbitrary — they are real, commonly-taught estimators for this exact problem, just not the maximum likelihood one. N̂ = 2X̄ − 1 ≈ 71 comes from method of moments (matching E[X] = (N+1)/2 to the sample mean); it is a different estimation principle that happens to use the mean instead of the max, and is not what the likelihood function is maximized by. N̂ = m(n+1)/n − 1 ≈ 72 is the classic bias-corrected version of the MLE, used precisely because the raw MLE m = 61 is a biased (systematic underestimate) of N — but "bias-corrected" and "maximum likelihood" are different concepts, and only m = 61 actually maximizes L(N). Doubling the max to get 122 has no likelihood justification at all — it treats "half the coaches were sampled" as a fact rather than an assumption, when in reality only 5 out of an unknown N were seen.
Question 157 · Monte Carlo: Learning Through Random Sampling · hard
A student writes a Monte Carlo program (the kind coding clubs across India run every Pi Day) that generates N points (x, y) drawn uniformly and independently from the unit square [0,1]×[0,1]. For each point she checks whether x² + y² ≤ 1 — that is, whether it falls inside the quarter circle of radius 1. Define X_i = 1 if the point lands inside and X_i = 0 otherwise; since the quarter circle has area π/4 and the square has area 1, each X_i is an independent Bernoulli trial with success probability p = π/4. Her estimator of π is π̂ = 4X̄, where X̄ = (1/N)ΣX_i is the sample proportion of points landing inside. For N = 10,000 points, what is the standard error of π̂ — the standard deviation of π̂ across repeated runs of the simulation — computed exactly using p = π/4?
With p = π/4 substituted into Var(π̂) = 16p(1−p)/N, the standard error works out to about 0.0164.
Treating the sample proportion's own standard error, √(p(1−p)/N) with p = π/4, as the final answer gives about 0.0041.
Substituting the maximum possible Bernoulli variance at p = 0.5 in place of p = π/4 gives a standard error of about 0.0200.
Computing Var(π̂) = 16p(1−p)/N with p = π/4 but omitting the square root gives a value of about 0.00027.
Answer: A. With p = π/4 substituted into Var(π̂) = 16p(1−p)/N, the standard error works out to about 0.0164.
ExplanationEach indicator X_i is Bernoulli with success probability p = π/4 ≈ 0.785398, because the quarter circle occupies a π/4 fraction of the unit square's area. The variance of a single Bernoulli trial is Var(X_i) = p(1 − p). Substituting p = π/4 gives an exact closed form:
Var(X_i) = π/4 − π²/16 = 0.785398 − 0.616850 = 0.168548
Since the N points are drawn independently, the sample mean X̄ has variance Var(X̄) = Var(X_i)/N = 0.168548/N.
The estimator is π̂ = 4X̄, and scaling a random variable by a constant a multiplies its variance by a²: Var(aY) = a²Var(Y). So
Var(π̂) = 4² · Var(X̄) = 16 × 0.168548/N = 2.696766/N
For N = 10,000:
Var(π̂) = 2.696766/10,000 = 0.00026968
The standard error is the square root of the variance (not the variance itself):
SE(π̂) = √0.00026968 ≈ 0.0164
Two structural facts are worth carrying forward. First, the factor of 16 (not 4) appears because variance scales with the square of a multiplicative constant — a common slip is to compute the standard error of X̄ itself, √(p(1−p)/N) ≈ 0.0041, and forget that π̂ is 4X̄, not X̄. Second, a Bernoulli variance p(1−p) is maximized at p = 0.5, so plugging in 0.5 instead of the actual p = π/4 overstates the true variance and inflates the standard error to 0.0200. The general lesson behind the arithmetic is the defining property of Monte Carlo estimation: since Var(π̂) ∝ 1/N, the standard error shrinks as 1/√N — to halve today's error of 0.0164, N would need to quadruple to 40,000, not merely double. This 1/√N convergence, independent of the dimensionality of the problem, is exactly why Monte Carlo methods (the same principle behind ISRO's simulation-based orbital collision-risk estimates) remain useful even for very high-dimensional integrals where other numerical methods become computationally infeasible.
Question 158 · EM Algorithm: Finding Hidden Patterns · hard
In the classic EM "two coins" setup, Coin A has P(heads) = 0.6 and Coin B has P(heads) = 0.5, with equal prior mixing weights P(A) = P(B) = 0.5. A single sequence of 5 tosses is observed: H, H, T, H, H (4 heads, 1 tail), but you are not told which coin produced it. Using Bayes' rule as in the EM E-step, what is the posterior probability (responsibility) that Coin A generated this exact sequence?
Approximately 62.4%, obtained by computing P(data|A) = 0.6⁴×0.4¹ = 0.05184 and P(data|B) = 0.5⁵ = 0.03125, then normalizing 0.05184 by their sum 0.08309.
Approximately 54.5%, obtained by comparing the two coins' single-toss head probabilities directly as 0.6 divided by the sum of 0.6 and 0.5.
Approximately 37.6%, obtained by normalizing P(data|B) = 0.03125 by the combined total 0.08309, which is actually the responsibility for Coin B rather than Coin A.
Exactly 80%, obtained by taking the observed fraction of heads in the sequence, 4 out of 5 tosses, as the posterior probability of Coin A.
Answer: A. Approximately 62.4%, obtained by computing P(data|A) = 0.6⁴×0.4¹ = 0.05184 and P(data|B) = 0.5⁵ = 0.03125, then normalizing 0.05184 by their sum 0.08309.
ExplanationIn an EM E-step, the responsibility of a component is the posterior probability that component generated the observed data, computed via Bayes' rule using the likelihood of the entire sequence, not any single toss in isolation. The sequence H,H,T,H,H contains 4 heads and 1 tail, so the likelihood under Coin A is 0.6⁴ × 0.4¹ = 0.1296 × 0.4 = 0.05184, and the likelihood under Coin B is 0.5⁵ = 0.03125 (the binomial coefficient C(5,4) counting toss orderings would appear identically in both likelihoods and cancels out of the ratio, so it can be dropped). Because the priors P(A) = P(B) = 0.5 are equal, they cancel too, leaving the posterior as the plain likelihood ratio: P(A | data) = 0.05184 / (0.05184 + 0.03125) = 0.05184 / 0.08309 ≈ 0.624, or 62.4%. This full-sequence likelihood computation is exactly what the real EM algorithm performs across every training example in its E-step for a Bernoulli/coin mixture. Averaging the coins' per-toss head probabilities instead of multiplying across the whole sequence, swapping which coin's likelihood lands in the numerator, or substituting the raw observed head-rate (4/5) for the posterior are all shortcuts that throw away how strongly the joint sequence of 5 tosses actually favors one coin over the other.
Question 159 · Kernel Methods: Working in Higher Dimensions · hard
Consider the polynomial kernel K(x, y) = (x · y)² defined on vectors in ℝ². For x = (3, 4) and y = (1, 2), which of the following statements about K(x, y) and its underlying feature map is correct?
K(x, y) equals 121, obtained from x · y = 11 and squaring; the feature map φ(x) = (x₁², √2 x₁x₂, x₂²) satisfies φ(x) · φ(y) = K(x, y) for every pair of vectors, since squaring a dot product algebraically expands into exactly this cross-term structure.
Dropping the √2 factor to use φ(x) = (x₁², x₁x₂, x₂²) instead still yields φ(x) · φ(y) = K(x, y) = 121 for this x and y, because scalar coefficients attached to a coordinate of φ have no effect on the resulting dot product.
Mapping x and y into ℝ³ via φ and then taking the dot product there is less computationally expensive here than evaluating (x · y)² directly in ℝ², since the kernel trick's advantage only appears once the implicit feature space exceeds three dimensions.
No dimensional lift is needed for this computation, since a kernel function by definition equals x · y evaluated in the original input space, giving K(x, y) = 11 for these particular vectors.
Answer: A. K(x, y) equals 121, obtained from x · y = 11 and squaring; the feature map φ(x) = (x₁², √2 x₁x₂, x₂²) satisfies φ(x) · φ(y) = K(x, y) for every pair of vectors, since squaring a dot product algebraically expands into exactly this cross-term structure.
ExplanationDirect evaluation: x · y = (3)(1) + (4)(2) = 3 + 8 = 11, so K(x, y) = (x · y)² = 11² = 121.
The feature map φ(x) = (x₁², √2 x₁x₂, x₂²) reproduces this value without ever needing to be constructed explicitly during training, because algebraic expansion shows (x₁y₁ + x₂y₂)² = x₁²y₁² + 2x₁x₂y₁y₂ + x₂²y₂², which is exactly φ(x) · φ(y) = (x₁²)(y₁²) + (√2 x₁x₂)(√2 y₁y₂) + (x₂²)(y₂²) — the two factors of √2 multiply to give the required coefficient of 2 on the cross term. Substituting the actual vectors confirms it: φ(x) = (9, 12√2, 16), φ(y) = (1, 2√2, 4), and φ(x) · φ(y) = 9 + (12√2)(2√2) + 64 = 9 + 48 + 64 = 121, matching K(x, y) exactly.
The √2 coefficient is not optional. Since the dot product multiplies corresponding coordinates, removing it changes the cross term's coefficient from 2 to 1: (9)(1) + (12)(2) + (16)(4) = 9 + 24 + 64 = 97, which is not 121. Scalar factors inside a feature map change the induced kernel; they do not cancel.
The kernel trick's actual advantage is that K(x, y) = 121 can be computed with a single dot product and a squaring operation in the original 2-dimensional space — never constructing the 3-dimensional φ at all. This saving exists precisely because explicit mapping is avoided, not because the target dimension happens to exceed three; even here, where the feature space is only ℝ³, direct evaluation is cheaper than explicit mapping, and the gap widens sharply as feature-space dimension grows (for degree-d polynomial kernels on n-dimensional inputs, φ has O(n^d) coordinates).
Finally, K(x, y) = (x · y)² is the degree-2 polynomial kernel, not the linear kernel x · y. The linear kernel would give 11 for these vectors, but the problem specifies squaring, so K(x, y) = 121.
Question 160 · Ensemble Methods: Wisdom of Crowds · hard
Five independent AI fraud-detection models each flag a UPI transaction as fraudulent or legitimate with 60% accuracy — each model is correct with probability p = 0.6, and the models' errors are statistically independent of one another. The bank's system combines their outputs using majority vote: the transaction is classified according to whichever label at least 3 of the 5 models agree on. Assuming the independence assumption holds exactly, what is the probability that this majority-vote ensemble produces the correct classification?
About 68.3% — the sum of P(X=3), P(X=4), and P(X=5) for X ~ Binomial(5, 0.6), since majority vote is correct whenever at least 3 of the 5 independent models are correct
Exactly 60% — an ensemble of independent models has the same accuracy as a single model, since averaging votes cannot shift the mean correctness rate
About 7.8% — this is 0.6 raised to the 5th power, the probability that all five models happen to be correct simultaneously
About 34.6% — this is C(5,3)·0.6³·0.4², the probability that precisely three of the five models are correct, treating exactly-3 as the full majority-vote condition
Answer: A. About 68.3% — the sum of P(X=3), P(X=4), and P(X=5) for X ~ Binomial(5, 0.6), since majority vote is correct whenever at least 3 of the 5 independent models are correct
ExplanationModel each classifier's correctness as an independent Bernoulli trial with success probability p = 0.6. Let X be the number of the 5 models that are correct on a given transaction; since the models are independent and identically accurate, X follows a Binomial(n = 5, p = 0.6) distribution. Majority vote gives the right answer precisely when at least 3 of the 5 models are correct, i.e., when X ≥ 3, so the ensemble's accuracy is P(X=3) + P(X=4) + P(X=5).
Using P(X=k) = C(5,k)·(0.6)^k·(0.4)^(5-k):
P(X=3) = C(5,3)·0.6³·0.4² = 10 · 0.216 · 0.16 = 0.3456
P(X=4) = C(5,4)·0.6⁴·0.4¹ = 5 · 0.1296 · 0.4 = 0.2592
P(X=5) = C(5,5)·0.6⁵ = 1 · 0.07776 = 0.07776
Summing: 0.3456 + 0.2592 + 0.07776 = 0.68256, so the majority-vote ensemble is correct roughly 68.3% of the time — noticeably higher than any single model's 60%. This is the Condorcet Jury Theorem at work: when independent voters are each individually better than chance, pooling their votes by majority pushes the group's accuracy above any individual member's, and the gap widens as more independent voters are added (and would approach 100% as n → ∞ for any fixed p > 0.5).
The 60% choice reflects a common misconception — that combining opinions is a wash because you're just "averaging" the same error rate. That reasoning ignores the independence assumption: when errors are uncorrelated, they tend to cancel across the group rather than reinforce each other, which is exactly why ensembling helps. The 7.8% choice computes 0.6⁵, which is the probability of unanimous correctness among all five models — a far stricter and unnecessary requirement, since majority vote only needs 3 of 5, not 5 of 5. The 34.6% choice correctly computes P(X=3) but then stops there, missing that "at least 3 correct" also includes the cases of 4 or 5 models being correct, both of which still produce a correct majority verdict.