PCA Eigen-Directions, K-Means/DBSCAN Clustering & Neural Net Backpropagation
Covariance matrix eigenvectors & proportion of variance explained in PCA, K-Means Lloyd objective vs DBSCAN density reachability, MLP Softmax Cross-Entropy gradient, and CNN output shapes.
1. Principal Component Analysis (PCA)
Center data . Maximizing projected variance subject to via Lagrange multiplier gives:
- The -th principal component direction is the unit eigenvector corresponding to the -th largest eigenvalue of (equivalently, right singular vector of with ).
- Principal components are mutually orthogonal ( for ) and uncorrelated in projected space.
- Minimizing mean squared reconstruction error yields the exact same top- eigenvectors (discarded error )!
2. Clustering: K-Means vs Hierarchical vs DBSCAN
| Algorithm | Cluster Shape | Requires Upfront? | Handles Noise / Outliers? | Time Complexity |
|---|---|---|---|---|
| K-Means (Lloydβs) | Convex / Spherical (Voronoi) | β Yes | β Sensitive to outliers | |
| Agglomerative Hierarchical | Arbitrary (Single-Link) / Compact (Complete) | β Dendrogram cut | β οΈ Single-link chains on noise | |
| DBSCAN () | Arbitrary non-convex shapes | β No | β Labels sparse points as Noise | (spatial index) |
3. Neural Networks, Activations & Backpropagation
- Sigmoid : Derivative (at ). Multiplying across layers causes vanishing gradients!
- ReLU : Derivative is for (no saturation for positive activations!), for (Dying ReLU if learning rate is too high fixed by Leaky ReLU / GELU).
- Softmax + Cross-Entropy Clean Gradient: For logits , probabilities , and one-hot target :
Practice Questions on This Chapter (3)
The sample covariance matrix of a -dimensional centered dataset has eigenvalues . What percentage of total variance is preserved by projecting onto the first two Principal Components?
A 2D Convolutional layer takes an input volume of size and applies filters of spatial size with stride , padding , and one bias parameter per filter. What is the output shape and total trainable parameter count?
Which clustering algorithm can discover non-convex concentric ring clusters AND explicitly identify isolated noise / outlier points without pre-specifying the number of clusters ?