PCA always looks clean on paper but I always second-guess myself on the 'why eigenvectors' part under pressure.
Start by defining the covariance matrix and its role in capturing feature relationships, then explain that its eigenvectors are the directions of maximum variance (principal components) and eigenvalues quantify the variance along those directions. Connect this to PCA by showing how projecting data onto the top eigenvectors reduces dimensionality while preserving the most variance, and mention explained variance as the ratio of each eigenvalue to the sum of all eigenvalues.
Pro tip: Emphasize that eigenvectors are orthogonal, which ensures principal components are uncorrelated—a key property for downstream models. Also, note that in practice, you often standardize features before PCA to avoid scale bias, and that explained variance helps decide how many components to retain.
Explain that the covariance matrix summarizes pairwise feature covariances, with variances on the diagonal and covariances off-diagonal. It is symmetric and positive semi-definite.
State that eigenvectors are the directions (linear combinations of features) along which the data varies most, and eigenvalues indicate the amount of variance in those directions.
Describe how the eigenvectors of the covariance matrix are the principal components. The first principal component is the eigenvector with the largest eigenvalue, representing the direction of maximum variance.
Define explained variance as the proportion of total variance captured by each principal component, calculated as the eigenvalue divided by the sum of all eigenvalues. This helps in selecting the number of components to keep.
Mention that PCA uses these concepts to reduce dimensionality, decorrelate features, and compress data while preserving as much information as possible. Highlight trade-offs like information loss vs. simplicity.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Start by formally defining Gini impurity as a measure of node impurity, then walk through a concrete computation example for a small dataset. Finally, explain how decision trees evaluate splits by comparing the weighted Gini impurity of child nodes to select the best split.
Pro tip: Mention that Gini impurity is often preferred over entropy because it avoids logarithmic calculations, making it computationally faster, and it tends to isolate the most frequent class in a node—a nuance that shows practical understanding.
State that Gini impurity measures the probability of incorrectly classifying a randomly chosen element if it were labeled according to the class distribution in the node. Formula: Gini = 1 - sum(p_i^2) for all classes i.
Use a simple example: if a node has 3 red and 2 blue samples, p_red = 0.6, p_blue = 0.4. Gini = 1 - (0.6^2 + 0.4^2) = 1 - (0.36 + 0.16) = 0.48. Show that a pure node has Gini 0.
For each candidate split, compute the weighted average Gini impurity of the child nodes (weighted by the proportion of samples in each child). The split with the lowest weighted Gini impurity is chosen.
Mention that Gini impurity is used in CART algorithm, is faster than entropy, and tends to favor splits that create one large and one small child node. Also note that it is insensitive to class scaling.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Blanked for a second on the optimality form.
Start by writing the Bellman equations clearly, distinguishing between policy evaluation and optimality forms. Then explain how policy evaluation uses the Bellman equation for a fixed policy to compute value functions, and policy improvement uses the optimality equation to derive better policies. Conclude by linking these to iterative algorithms like policy iteration and value iteration.
Pro tip: Emphasize the contraction mapping property of the Bellman operator, which guarantees convergence of iterative methods—this shows depth and connects to practical implementation.
State the general Bellman equation for a policy π: V^π(s) = Σ_a π(a|s) Σ_{s',r} p(s',r|s,a)[r + γ V^π(s')]. Also write the action-value form: Q^π(s,a) = Σ_{s',r} p(s',r|s,a)[r + γ Σ_{a'} π(a'|s') Q^π(s',a')].
Write the Bellman optimality equations: V*(s) = max_a Σ_{s',r} p(s',r|s,a)[r + γ V*(s')] and Q*(s,a) = Σ_{s',r} p(s',r|s,a)[r + γ max_{a'} Q*(s',a')].
Describe how policy evaluation uses the Bellman equation for a fixed policy to compute V^π iteratively, e.g., V_{k+1}(s) = Σ_a π(a|s) Σ_{s',r} p(s',r|s,a)[r + γ V_k(s')], until convergence.
Explain that policy improvement uses the optimality equation to derive a greedy policy: π'(s) = argmax_a Σ_{s',r} p(s',r|s,a)[r + γ V^π(s')], which is guaranteed to be at least as good as π.
Summarize how policy iteration alternates between policy evaluation and improvement, and value iteration combines both by directly applying the optimality equation as an update rule.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Start by defining dropout as a regularization technique that randomly deactivates neurons during training. Then explain the key difference: during training, dropout is applied with a probability p, while during inference, no neurons are dropped and weights are scaled by (1-p) to maintain expected output. Finally, discuss why this acts as a regularizer: it prevents co-adaptation of neurons, approximates ensemble learning, and adds noise for robustness.
Pro tip: Mention the inverted dropout implementation, which scales activations during training instead of inference, as it's the standard in modern frameworks and shows practical knowledge.
Explain that dropout is a regularization technique where during training, each neuron is randomly dropped with probability p, meaning its output is set to zero.
Describe that during training, dropout is active and introduces randomness; during inference, dropout is turned off and no neurons are dropped, but weights are scaled to account for the missing dropout.
Discuss the scaling factor: in standard dropout, weights are multiplied by (1-p) at inference; in inverted dropout, activations are scaled by 1/(1-p) during training, which is more common.
Explain that dropout prevents neurons from co-adapting, as they cannot rely on other neurons being present, leading to more robust features.
Mention that dropout can be viewed as training an ensemble of subnetworks and averaging their predictions at inference, which reduces variance.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Two-parter and I think I spent too long on clipping and rushed the residual connection explanation.
Start by defining gradient clipping and its purpose, then explain when to use it with concrete examples. Next, describe how residual connections mitigate vanishing gradients by providing a direct path for gradients. Finally, connect both concepts to practical training stability and model design trade-offs.
Pro tip: Emphasize that gradient clipping is a diagnostic tool, not a default—use it when you observe exploding gradients, but also monitor its impact on convergence. For residual connections, highlight that they enable training of very deep networks by preserving gradient flow, but they don't eliminate the need for other techniques like normalization.
Explain that gradient clipping caps the magnitude of gradients during backpropagation to prevent exploding gradients, either by value or norm.
Discuss scenarios like training RNNs, deep networks, or when loss spikes occur; mention that it's common in NLP and RL but not always necessary.
Describe how gradients become exponentially small in deep networks, making early layers hard to train.
Detail how skip connections create an identity path that allows gradients to flow directly to earlier layers, mitigating vanishing gradients.
Summarize that both techniques improve training stability and enable deeper models, but require tuning and are part of a broader toolkit.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
The non-convexity comes from the composition of nonlinear layers, there's no way around it.
Start by explaining why deep learning loss landscapes are non-convex due to the composition of nonlinear functions and high-dimensional parameter spaces. Then discuss the practical implications for optimization, emphasizing that saddle points are more problematic than local minima in high dimensions, and describe strategies to handle them.
Pro tip: Mention that in high-dimensional spaces, local minima are rare and often have loss values close to the global minimum, so the focus should be on escaping saddle points efficiently. This shows a nuanced understanding beyond textbook knowledge.
Describe how deep neural networks are compositions of nonlinear functions (e.g., ReLU, sigmoid) leading to highly non-convex loss surfaces with many critical points.
Clarify that in high-dimensional spaces, saddle points are far more common than local minima, and local minima often have loss values close to the global minimum.
Explain that first-order methods like SGD can get stuck at saddle points, but stochasticity and momentum help escape them; second-order methods can explicitly identify and escape saddle points.
Highlight techniques such as adding noise, using adaptive learning rates (Adam, RMSprop), and careful initialization to avoid poor critical points.
Summarize that while non-convexity poses challenges, modern optimizers and over-parameterization make training effective, and the focus should be on saddle points rather than local minima.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
The scaling thing is easy to memorize but the reason is actually interesting.
Start by defining scaled dot-product attention mathematically, then explain how multi-head attention extends it by running multiple attention functions in parallel. Finally, justify the scaling factor by analyzing the variance of dot products and its effect on softmax gradients.
Pro tip: Mention that without scaling, large dot products push softmax into saturated regions with tiny gradients, and that the 1/sqrt(d_k) factor keeps the variance of the dot products at 1, stabilizing training. This shows you understand both the math and the practical training dynamics.
Write the formula: Attention(Q, K, V) = softmax(QK^T / sqrt(d_k)) V. Explain that Q, K, V are linear projections of the input, and the output is a weighted sum of values based on query-key similarity.
Describe how multiple attention heads run in parallel with different learned projections, allowing the model to attend to information from different representation subspaces. The outputs are concatenated and linearly transformed.
Explain that if Q and K have independent components with zero mean and unit variance, their dot product has variance d_k. Dividing by sqrt(d_k) scales the variance back to 1, preventing softmax saturation and vanishing gradients.
Highlight that scaling enables stable training with larger d_k, which is crucial for deep transformers. Without it, the model would require careful initialization or smaller learning rates.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.