Question Bank
Graded conceptual, numerical, PySpark, LSH, and streaming-sketch problems spanning Part 1 (Dr. Nyalala) and Part 2 (Dr. Mahendran V). Work through each step before expanding the solution.
Bayesian Decision Theory, MLE, Feature Selection, PCA & LDA
Given positive-class prior P(Y=1) = 0.2, false-negative cost 10, and false-positive cost 1, at what posterior probability P(Y=1 | x) should a Bayes-optimal classifier predict class 1?
Reveal Worked Solution
1 * (1 - p), whereas predicting class 0 incurs 10 * p. Predict class 1 when 1 - p < 10p, which yields threshold p > 1/11 = 0.0909.Contrast Principal Component Analysis (PCA) and Fisher's Linear Discriminant Analysis (LDA) in objective function, supervision requirement, and maximum output dimensions for C classes.
Reveal Worked Solution
Sigma, producing up to d components. Fisher LDA is supervised and maximizes between-class scatter over within-class scatter J(w) = (w^T S_B w)/(w^T S_W w) via S_W^{-1} S_B, yielding at most C - 1 non-zero discriminant axes.Explain why standardizing features and fitting PCA inside each cross-validation fold prevents data leakage, and write the exact MLE variance bias correction for Gaussian estimation.
Reveal Worked Solution
Pipeline fit solely on training folds. For Gaussian MLE, sigma_hat^2 = (1/n) * sum (x_i - mu_hat)^2 underestimates population variance by factor (n - 1)/n; Bessel's correction divides by n - 1.Class Imbalance, SMOTE, Decision Trees & Boosting Ensembles
In a dataset with 99% negative and 1% positive examples, why is accuracy misleading and why is Precision-Recall AUC preferred over ROC AUC?
Reveal Worked Solution
99% accuracy with zero recall. ROC false-positive rate divides by the huge negative count, masking large absolute false-positive volume, whereas Precision-Recall directly measures true positives among predicted positives.Compute the first AdaBoost learner weight alpha_1 when weighted training error is epsilon_1 = 0.20, and explain how sample weights change for misclassified points.
Reveal Worked Solution
alpha_1 = 0.5 * ln((1 - 0.20) / 0.20) = 0.5 * ln(4) = 0.693. Misclassified points have their weights multiplied by exp(+alpha_1) = 2 before normalization, focusing the next weak learner on hard boundary examples.Compare Bagging (Random Forests) and Gradient Boosting along bias-variance reduction, tree depth, and parallelizability.
Reveal Worked Solution
-dL/dF, cutting bias iteratively while requiring sequential stage updates and shrinkage learning rates to control overfitting.Data Cubes, MapReduce, PySpark RDDs & Locality-Sensitive Hashing
Why does PySpark's reduceByKey outperform groupByKey followed by mapValues(sum) on skewed datasets?
Reveal Worked Solution
reduceByKey runs map-side combining locally within each partition before shuffling over the network, reducing shuffle bytes to at most one key-value pair per partition. groupByKey ships all unaggregated values across the cluster, risking out-of-memory spills.An LSH index uses n = 100 MinHash rows partitioned into b = 20 bands of r = 5 rows. Calculate the candidate probability for two documents with Jaccard similarity s = 0.5.
Reveal Worked Solution
r = 5 rows match in one band is s^r = 0.5^5 = 1/32 = 0.03125. Probability of sharing at least one band across b = 20 bands is 1 - (1 - 0.03125)^20 = 1 - 0.530 = 0.470 (about 47%).Given documents D1 = {a, b, c} and D2 = {b, c, d, e}, compute their exact Jaccard similarity and verify how MinHash random permutations preserve that value in expectation.
Reveal Worked Solution
{b, c} has size 2; union {a, b, c, d, e} has size 5, so J(D1, D2) = 2/5 = 0.40. Under a uniformly random permutation of the 5 elements, the first element hitting D1 union D2 lies in D1 intersect D2 with probability 2/5 = 0.40, so Pr[h(D1) = h(D2)] = J(D1, D2).Frequent Pattern Mining, Bloom Filters & Scalable Clustering
Can a Bloom filter ever produce a false negative, and how do you compute its optimal number of hash functions k* for m bits and n inserted keys?
Reveal Worked Solution
k* = (m / n) * ln(2).In 10,000 market baskets, milk appears in 6,000 baskets, coffee in 2,000, and both in 1,800. Compute Support, Confidence, Lift, and Kulczynski for {coffee} -> {milk}.
Reveal Worked Solution
supp = 1800/10000 = 0.18; conf(coffee -> milk) = 1800/2000 = 0.90; Lift = 0.18 / (0.20 * 0.60) = 1.50; Kulczynski = 0.5 * (P(milk|coffee) + P(coffee|milk)) = 0.5 * (0.90 + 0.30) = 0.60.Explain how BIRCH maintains cluster summaries in a single scan using Clustering Feature (CF) tuples and why those tuples allow exact merging without raw data points.
Reveal Worked Solution
(N, LS, SS) where N is point count, LS is the vector sum, and SS is the sum of squared norms. Because sums are additive, merging two clusters adds their tuples component-wise: CF_1 + CF_2 = (N_1 + N_2, LS_1 + LS_2, SS_1 + SS_2), yielding exact merged centroid LS/N and radius in O(d) memory.Recommender Systems, Web Link Analysis & Streaming Sketches
In PageRank r = beta * M * r + (1 - beta)/N * 1, what two graph pathologies does teleportation factor (1 - beta) resolve?
Reveal Worked Solution
Using biased matrix factorization r_hat_ui = mu + b_u + b_i + q_i^T p_u with mu = 3.5, b_u = 0.4, b_i = -0.2, p_u = [0.6, 0.2], q_i = [0.5, -0.5], compute the predicted rating and SGD error against true rating 4.2.
Reveal Worked Solution
q_i^T p_u = 0.6*0.5 + 0.2*(-0.5) = 0.30 - 0.10 = 0.20. Predicted rating r_hat = 3.5 + 0.4 - 0.2 + 0.20 = 3.90. Residual error e_ui = 4.2 - 3.90 = +0.30.Explain how the DGIM algorithm bounds space to O(log^2 N) bits for counting 1s in the last N bits of a stream and guarantees relative error at most 50%.
Reveal Worked Solution
1, 2, 4, ..., 2^k <= N, keeping at most two buckets of each size and storing each bucket's timestamp in O(log N) bits. With O(log N) distinct bucket sizes, total memory is O(log^2 N) bits. When answering a window query, only the oldest overlapping bucket of size 2^j is uncertain; because all newer buckets sum to at least 2^j - 1, estimating half of the oldest bucket bounds absolute error below 50%.