Velocer › Tarjetas › University of Wisconsin–Madison › CS 540: Intro to AI (Kandasamy & Khodak) · UW-Madison
CS 540: Intro to AI (Kandasamy & Khodak) · UW-Madison
Putting my CS 540 flashcards up here. quick review before exams. · por mendota_notes · 121 tarjetas
- What is an outcome versus an event in probability?An outcome ω ∈ Ω is a single possible result of a random experiment; an event E ⊆ Ω is a subset of outcomes of interest.
- State the three Kolmogorov axioms of probability.Non-negativity: P(E) ∈ [0,1]; Normalization: P(Ω)=1 and P(∅)=0; Countable additivity for disjoint events: if E₁∩E₂=∅, then P(E₁∪E₂)=P(E₁)+P(E₂).
- What is the inclusion-exclusion identity for overlapping events?P(A ∪ B) = P(A) + P(B) − P(A ∩ B).
- What is a random variable?A function X: Ω → ℝ that maps set-theoretic outcomes onto the real line, enabling calculus and algebraic summaries.
- Define the cumulative distribution function (CDF).F_X(x) = P(X ≤ x); it is non-decreasing and right-continuous for both discrete and continuous random variables.
- What distinguishes a PMF from a PDF?Discrete RVs assign point masses p_X(a)=P(X=a) summing to 1; continuous RVs use a density f_X(x)=d/dx F_X(x) whose integral over intervals gives probability.
- Give the formulas for expectation and variance.E[X] = Σ a·P(X=a) (or E[g(X)] = Σ g(a)P(X=a)); Var(X) = E[(X−E[X])²] = E[X²] − (E[X])².
- For a fair Bernoulli coin flip (p=0.5), what are the expectation and variance?E[X] = 0.5 and Var(X) = p(1−p) = 0.25.
- What is marginalization (the sum rule)?Summing out nuisance variables recovers single-variable distributions: P(X=a) = Σ_b P(X=a, Y=b).
- State the conditional probability formula and the chain rule.P(X=a | Y=b) = P(X=a, Y=b)/P(Y=b); the chain rule: P(X₁,…,Xₙ) = P(X₁)P(X₂|X₁)⋯P(Xₙ|X₁,…,Xₙ₋₁).
- What is the probability of drawing 3 aces without replacement?(4/52)×(3/51)×(2/50) = 24/132600 ≈ 0.00018.
- Define independence and conditional independence of random variables.X ⊥ Y iff P(X,Y)=P(X)P(Y), equivalently P(X|Y)=P(X). Conditional independence X ⊥ Y | Z means P(X,Y|Z)=P(X|Z)P(Y|Z).
- How does independence reduce parameter storage for a joint distribution?A full joint table over n variables each with k values requires O(kⁿ) parameters; mutual independence reduces storage to O(nk).
- Give an example illustrating conditional independence.Ice-cream sales and drowning incidents are marginally correlated but conditionally independent once conditioned on summer weather Z.
- State the Law of Total Probability.For mutually exclusive, exhaustive events {B₁,…,Bₙ}: P(A) = Σᵢ P(A|Bᵢ)P(Bᵢ).
- State Bayes' Rule and label its components.P(H|E) = P(E|H)P(H)/P(E) = (Likelihood × Prior)/Evidence Marginal.
- Explain the base-rate fallacy with the sore throat/flu example.Even if P(Sore Throat|Flu)=0.90, with P(Flu)=0.01 and P(ST)=0.10, the posterior P(Flu|ST) = (0.90×0.01)/0.10 = 0.09, only 9%.
- What is the Naive Bayes assumption and its resulting formula?Features are conditionally independent given the class label: P(H|E₁,…,E_d) ∝ P(H)∏ᵢ P(Eᵢ|H).
- What is the difference between probability and statistics?Probability reasons forward (given a known model, compute likelihood of outcomes—used in inference); statistics reasons backward (given samples, infer model parameters—used in training).
- What does conditional probability P(Y|X) measure, and what does it not measure?It measures statistical association/correlation only, never causal direction; e.g., yellow fingers and lung cancer are both caused by confounding variable smoking.
- What is the Maximum Likelihood Estimate (MLE) for the probabilities of a k-sided die given counts n_i for each face?The MLE is the empirical frequency: p_i^MLE = n_i / n, where n = sum n_i.
- What is Laplace (additive) smoothing and what is its formula?Laplace smoothing adds a pseudocount α > 0 to each count to avoid zero probabilities: p_i^MAP = (n_i + α) / (n + kα).
- What is the trade-off when using Laplace smoothing?It introduces a small bias (pulling estimates toward a uniform prior 1/k) but significantly reduces variance.
- For i.i.d. samples from a 1D Gaussian, what is the unbiased estimator of the mean?The sample mean: μ̂ = (1/n) Σ x_i.
- Why does the MLE variance underestimate the true variance, and what is the unbiased estimator?The MLE variance divides by n, which slightly underestimates; dividing by n-1 gives the unbiased sample variance s² = (1/(n-1)) Σ (x_i - μ̂)².
- What does the Law of Large Numbers (LLN) guarantee?The sample mean μ̂_n converges to the true mean μ as n → ∞.
- What does the Central Limit Theorem (CLT) state about the sample mean?The standardized sample mean converges in distribution to a standard normal distribution.
- What is the geometric interpretation of a matrix A ∈ ℝ^{m×n}?It represents a linear transformation mapping ℝ^n to ℝ^m.
- Define the dot product and the Euclidean ℓ2 norm.The dot product is ⟨x, y⟩ = xᵀy = Σ x_i y_i; the ℓ2 norm is ‖x‖₂ = √(xᵀx).
- What does it mean for two vectors to be orthogonal? What is an orthonormal set?Two vectors are orthogonal if xᵀy = 0. A set {u_1, ..., u_m} is orthonormal if u_iᵀu_j = δ_ij (unit length and mutually perpendicular).
- What is the outer product x yᵀ and what are its properties?The outer product x yᵀ ∈ ℝ^{m×n} produces a rank-1 matrix where entry (i,j) is x_i y_j.
- Define eigenvalue and eigenvector for a square matrix A.A nonzero vector v is an eigenvector of A if Av = λv for some scalar λ (the eigenvalue), meaning A scales v without changing its direction.
- What is the goal of Principal Component Analysis (PCA)?PCA finds an m-dimensional linear subspace (m ≪ d) spanned by orthonormal axes that preserves maximum signal, i.e., maximizes the variance of projected data.
- Explain the geometric duality in PCA using the Pythagorean theorem.For centered data, ‖x_i‖² = (uᵀx_i)² + e_i², so minimizing the sum of squared projection errors is equivalent to maximizing the sample variance of projected points.
- What optimization problem does PCA solve for the first principal component?Maximize uᵀ S u subject to ‖u‖₂ = 1, where S is the sample covariance matrix.
- By the Rayleigh quotient theorem, what is the first principal component and the maximum variance achieved?The first principal component u₁ is the eigenvector of S corresponding to the largest eigenvalue λ₁, and the maximum variance is λ₁.
- What is a language model?A model that assigns a joint probability P(W) = P(w1, w2, ..., wT) to a sequence of tokens.
- What is the Markov assumption in n-gram models?The (n-1)-th order Markov assumption restricts context to the preceding k = n-1 tokens, approximating P(wt | w1...wt-1) by P(wt | wt-n+1...wt-1).
- What does a unigram model assume?Full token independence: P(w1, ..., wT) = product over t of P(wt).
- How is a bigram probability computed?P(wt | wt-1) = count(wt-1, wt) / count(wt-1).
- Why should you sum log-probabilities instead of multiplying probabilities in n-gram models?Multiplying many small conditional probabilities causes numerical underflow; summing log-probabilities avoids this.
- What problem does zero-count sparsity cause in n-gram models, and how is it fixed?A single unseen valid bigram sets the whole sentence probability to 0 and perplexity to infinity; apply Laplace/add-alpha smoothing.
- What is extrinsic evaluation of a language model?Measuring end-to-end performance on a downstream task (e.g., BLEU for machine translation or QA accuracy); accurate but computationally expensive.
- What is perplexity and how is it interpreted?Perplexity is the inverse geometric mean probability the model assigns to a held-out test sequence; lower perplexity is better, representing the effective branching factor or uncertainty per word.
- What is Bag of Words (BoW)?A document representation as a vocabulary-length vector of raw or normalized word counts, discarding word order.
- What does TF-IDF do and what is its formula?It downweights ubiquitous stop-words and highlights terms frequent in a document but rare across the corpus: TF-IDF_ij = TF_ij * log(N / df_i), where df_i is the number of documents containing word i.
- Why are one-hot vectors poor for capturing word similarity?They are sparse and orthogonal in R^|V|, so the inner product is 0 even for synonyms like cat and kitten.
- What is distributional semantics (Word2Vec)?Learning low-dimensional dense embeddings where words appearing in similar contexts have high inner product.
- How do pretrained Transformers like BERT and GPT differ from static embeddings?They use self-attention to produce contextualized embeddings that adapt to surrounding words.
- State Tom Mitchell's formalization of machine learning.An algorithm learns from experience E with respect to task class T and performance metric P if its performance P on T improves with E.
- What is supervised learning?Learning f: X -> Y from labeled pairs by minimizing empirical risk (1/n) sum of loss(f(xi), yi); classification uses 0-1 or cross-entropy loss, regression uses squared loss.
- What is unsupervised learning?Extracting latent structure from unlabeled points via clustering, dimensionality reduction (PCA), manifold visualization (t-SNE), or density estimation (KDE).
- What is a dendrogram in hierarchical clustering?A binary tree of nested partitions built without requiring k in advance; cutting it at any height yields a flat clustering.
- Compare single-linkage and complete-linkage clustering.Single-linkage uses minimum distance between clusters and can produce elongated chaining clusters; complete-linkage uses maximum distance and favors compact, spherical clusters of similar diameter.
- What objective does k-means minimize?The Within-Cluster Sum of Squares (WCSS/distortion): sum over clusters j and points assigned to j of ||xi - cj||^2.
- Describe Lloyd's algorithm for k-means.Alternate between assigning each point to its nearest centroid and recomputing each centroid as the mean of its assigned points.
- What are the convergence guarantees of k-means?It is guaranteed to converge in finite steps because there are finitely many assignments and both steps monotonically decrease WCSS, but it converges only to a local optimum.
- What is k-means++ used for?Sampling initial centers to improve k-means initialization and avoid poor local optima.
- What is the Elbow Method used for in k-means clustering?Choosing the number of clusters k by looking for the 'elbow' in the WCSS vs. k curve.
- Why is Normalized Cut (NCut) preferred over naive minimum graph cuts in spectral clustering?Naive minimum cuts often isolate a single outlier vertex, while NCut balances partition sizes using cut volume normalization.
- In spectral clustering, which eigenvectors of the graph Laplacian are used to build node embeddings?The bottom-k eigenvectors corresponding to the smallest k eigenvalues of the Laplacian.
- How does spectral clustering differ from PCA in terms of which eigenvectors are selected?PCA takes the largest-m eigenvectors of the feature covariance matrix to capture variance; spectral clustering takes the smallest-k eigenvectors of the graph Laplacian to capture connected components and non-convex manifolds.
- What are the three common forms of the graph Laplacian used in spectral clustering?Unnormalized L = D - A, symmetric normalized L_sym = I - D^(-1/2) A D^(-1/2), and random-walk normalized L_rw = I - D^(-1) A.
- In t-SNE, what distribution models low-dimensional pairwise similarities and why?A heavy-tailed Student-t distribution (1 degree of freedom / Cauchy), used to prevent the crowding problem.
- What objective does t-SNE minimize via gradient descent?The Kullback-Leibler (KL) divergence KL(P||Q) between high-dimensional and low-dimensional similarity distributions.
- How does Kernel Density Estimation (KDE) overcome the limitations of histograms?It places a smooth kernel (typically Gaussian with bandwidth σ) on every sample point, avoiding discontinuity and the empty-bin curse in high dimensions.
- What is the closed-form Normal Equations solution for ordinary least squares?θ_OLS = (X^T X)^(-1) X^T y, requiring X^T X to be invertible (full column rank).
- Under what probabilistic assumption is minimizing squared error equivalent to maximum likelihood estimation?When targets are generated with additive Gaussian noise: y_i = x_i^T θ + ε_i with ε_i ~ N(0, σ²).
- Why can't a linear threshold classifier with 0-1 loss be optimized directly?It is NP-hard and non-differentiable, with zero gradient almost everywhere.
- What is the logistic sigmoid function used in logistic regression?σ(z) = 1 / (1 + e^(-z)), which maps the linear logit z = θ^T x into (0, 1).
- What loss function does logistic regression minimize?Binary Cross-Entropy (negative conditional log-likelihood): L_BCE(θ) = -(1/n) Σ [y_i log σ(θ^T x_i) + (1-y_i) log(1 - σ(θ^T x_i))].
- Even though the sigmoid is nonlinear, what is the shape of the logistic regression decision boundary?A linear hyperplane, given by θ^T x + θ_0 = 0 (where P(y=1|x) = 0.5).
- What happens to a logistic regression decision boundary if all parameters are scaled by a positive constant c?The decision boundary and hard class predictions are unchanged; only the predicted probabilities become sharper.
- What is the difference between Ridge (ℓ2) and Lasso (ℓ1) regularization?Ridge adds an ℓ2 penalty on weights, while Lasso adds an ℓ1 penalty (which can drive weights to exactly zero, performing feature selection).
- What is the key difference between parametric and nonparametric models?Parametric models compress training data into a fixed-dimensional parameter vector; nonparametric/instance-based models let complexity grow with dataset size and store training instances directly.
- How does k-NN make a prediction for a test query x*?Compute distances to all n training points, select the k nearest neighbors, then output the majority vote (classification) or sample mean (regression).
- Why must features be standardized before using k-NN?k-NN is scale-sensitive, so features should be standardized to zero mean and unit variance to prevent large-scale features from dominating distances.
- When standardizing features for k-NN, on which data should the mean and standard deviation be computed?Compute them exclusively on the training set and apply those exact statistics to validation and test points; never recompute on test data.
- Why is adding irrelevant or noisy features harmful to k-NN?Uninformative features corrupt pairwise Euclidean distances and degrade accuracy—the curse of irrelevant features.
- How should the hyperparameter k in k-NN be chosen?Select k using a held-out validation (tuning) set—never on the training set (k=1 gives zero training error) or the final test set.
- What is the difference between discriminative and generative classifiers?Discriminative models directly model the decision boundary or P(Y|X); generative models model P(Y) and P(X|Y), then use Bayes' Rule at test time.
- How does the Naive Bayes conditional independence assumption reduce parameters?Modeling a full joint over K binary features for 2 classes needs 2(2^K − 1) parameters; the independence assumption reduces this to 2K plus the class prior.
- What is the perceptron learning rule when a sample is misclassified?Update w ← w + η(y_i − ŷ_i)x_i and b ← b + η(y_i − ŷ_i); if correctly classified, weights are unchanged.
- Why can't a single perceptron learn XOR?XOR's positive and negative examples are not linearly separable, so no single linear decision boundary can represent it.
- Why is nonlinearity mandatory in deep networks?Stacking linear layers collapses into a single linear model: w^(2)ᵀ(W^(1)x + b^(1)) + b^(2) = wᵀx + b, so depth adds no expressive power without nonlinear activations.
- Why can't the step function be used with gradient descent?Its derivative is zero everywhere except an undefined jump at 0, so gradient descent requires smooth or piecewise-linear activations like sigmoid.
- What is the sigmoid activation and its derivative?σ(z) = 1/(1+e^{−z}) ∈ (0,1), with derivative σ'(z) = σ(z)(1 − σ(z)).
- What is Ridge regression and its closed-form solution?Linear regression with an ℓ2 penalty: min (1/n)‖Xθ−y‖² + λ‖θ‖², with closed form θ̂ = (XᵀX + nλI)⁻¹Xᵀy (scaling-dependent).
- What distinguishes Lasso regression from Ridge?Lasso uses an ℓ1 penalty, has no closed-form solution (solved via sub-gradient descent), and induces sparse weight vectors for feature selection.
- What is a Voronoi tessellation in the context of 1-NN?For 1-NN, feature space is partitioned into convex Voronoi cells, each centered on a training point, defining its prediction region.
- What is the prediction cost of k-NN on a test query?O(nd): computing distances from the query to all n training points in d dimensions, with O(1) training (memorization).
- What is the formula for the sigmoid activation function and its output range?σ(z) = 1/(1+e^{-z}), which outputs values in (0, 1).
- What is the formula for the tanh activation function and its output range?tanh(z) = (1 - e^{-2z})/(1 + e^{-2z}) = 2σ(2z) - 1, which outputs values in (-1, 1) and is zero-centered.
- What is the ReLU activation function and why is it computationally advantageous?ReLU(z) = max(z, 0); its derivative is 1 for z>0 and 0 for z<0, making it fast to compute and helping mitigate vanishing gradients for positive inputs.
- How does the softmax layer convert logits into class probabilities?It computes p_k = exp(f_k(x)) / Σ_j exp(f_j(x)), producing a valid probability distribution over the K classes.
- What is the multi-class cross-entropy loss for a one-hot label vector y?ℓ(x, y) = -Σ_j y_j log p_j = -log p_c, where c is the true class.
- How does minibatch stochastic gradient descent update weights?It samples a random mini-batch B ⊂ D and updates w_t ← w_{t-1} - (η/|B|) Σ_{(x,y)∈B} ∇_w ℓ(x, y).
- What is forward propagation in a neural network?It evaluates intermediate pre-activations z^(ℓ) = W^(ℓ)a^(ℓ-1) + b^(ℓ) and activations a^(ℓ) = σ(z^(ℓ)) from input to loss, caching intermediate values.
- How does backpropagation compute gradients?It applies the multivariate chain rule backwards from the loss node to every weight, using cached forward values.
- For sigmoid output ŷ = σ(z) with binary cross-entropy loss, what is ∂ℓ/∂z?∂ℓ/∂z = ŷ - y, because the sigmoid derivative ŷ(1-ŷ) cancels terms in the loss gradient.
- What causes exploding gradients in deep networks?When the product of Jacobian singular values along layers exceeds 1 (e.g., 1.5^100), gradients grow exponentially and overflow.
- What causes vanishing gradients in deep networks?When layer derivatives are less than 1 (e.g., 0.8^100, or sigmoid saturation where σ'(z) ≤ 0.25), early layers receive near-zero gradients and fail to train.
- What does Bayes' Rule compute, and what are its three named components?It computes the posterior P(H|E) = P(E|H)P(H) / Σᵢ P(E|Hᵢ)P(Hᵢ). P(H) is the prior, P(E|H) is the likelihood, and P(H|E) is the posterior.
- Is linear regression (OLS/Ridge) parametric or nonparametric, and does it have closed-form training?Parametric (θ ∈ R^(d+1)) with closed-form training: (X^T X + nλI)^(−1) X^T y.
- What decision boundary shape does logistic regression produce, and does it have a closed-form solution?A linear hyperplane (θ^T x + θ_0 = 0); no closed form—it is convex and solved via GD/SGD.
- Is k-NN parametric or nonparametric, and what are its training/testing costs?Nonparametric (grows with n); O(1) fit and O(nd) test (no training phase).
- What decision boundary shape does k-NN produce?Piece-wise linear (Voronoi cells).
- Is Naive Bayes generative or discriminative, and does it have closed-form training?Generative (P(y)∏_k P(x_k|y)); yes, closed-form via empirical count ratios plus Laplace α.
- What decision boundary does Naive Bayes produce for discrete/multinomial features?Linear in log-odds.
- What is a key limitation of the single-layer perceptron?It produces only a linear hyperplane and cannot solve XOR.
- How does the MLP differ from the single-layer perceptron in boundary shape and training?The MLP has arbitrarily non-linear boundaries (solves XOR) and is trained with backprop + SGD on a non-convex objective.
- What happens if you compute the PCA covariance matrix without centering the data?The first principal component will point toward the global mean vector rather than the direction of maximum variance.
- Why is logistic regression's decision boundary linear despite using the nonlinear sigmoid function?Because σ(z) ≥ 0.5 iff z ≥ 0, so the boundary is θᵀx + θ₀ = 0, which is linear in x.
- How does multiplying all logistic regression weights and bias by a positive scalar c affect the decision boundary?It does not change the decision boundary or hard predictions.
- What is the effect of changing only the bias θ₀ in a linear classifier?It shifts the hyperplane parallel to itself without changing its orientation.
- What is the effect of changing a component of the weight vector θ in a linear classifier?It rotates the hyperplane's normal vector.
- When standardizing features for k-NN, which mean and standard deviation should be used to normalize test points?The training set's μ̂_train and σ̂_train; never compute statistics from the test set.
- Why does removing nonlinear activation functions between hidden layers collapse a deep neural network?Any L-layer network reduces to a single matrix multiplication W_eff x + b_eff and still cannot learn XOR.
- Why does zero initialization fail in MLPs?With zero initialization, all neurons in a layer learn identical features, breaking symmetry and preventing effective learning.
- What is the consequence of standardizing test data using the test set's own mean and standard deviation?It causes standardization leakage, giving incorrect normalization; test points must use the training set's μ̂ and σ̂.
- What does the logistic regression decision boundary equation θᵀx + θ₀ = 0 represent geometrically?A hyperplane that is strictly linear in x, separating classes at the point where the sigmoid output equals 0.5.
Velocer es gratis: repetición espaciada y tus propias tarjetas a partir de cualquier documento.
PDF to flashcards · Lecture to flashcards · Practice exam · Syllabus study plan · Anki import
Más barajas de University of Wisconsin–Madison
- comp sci 240 midterm 1
- comp sci 240 midterm 2
- COMP SCI 240 Midterm 3
- COMP SCI 240 Final
- comp sci 300 full course review
- CS 639: Introduction to Reinforcement Learning · UW-Madison
- CS 839: Reinforcement Learning · UW-Madison
- CS 544: Intro to Big Data Systems · UW-Madison
- CS 580: Intelligent Robotics · UW-Madison
- CS 784: Foundations of Data Management · UW-Madison
- CS 880: Quantum Algorithms · UW-Madison
- CS 765: Data Visualization · UW-Madison