6. Singular Value Decomposition and Statistical Foundations

Central Limit Theorem and Statistical Sampling

  • The Central Limit Theorem (CLT) dictates that as the sample size or the number of sampling repetitions (nn) increases, the sampling distribution of the sample mean approaches a normal distribution in probability space.

  • Estimating a population mean without full access to population-wide data is achieved by repeatedly taking small random samples (with potential repetition) and calculating their individual sample means.

  • Convergence Example:

    • Target population mean grade for Lab 1 assignment: 8080

    • First random sample of 5 individuals yields a sample mean grade of 7070

    • Second random sample yields a sample mean grade of 8585

    • Third random sample yields a sample mean grade of 8282

    • As the sampling repetitions (nn) increase, taking the overall average of all calculated sample means (7070, 8585, 8282, etc.) converges directly toward the true population mean of 8080

Feature Information, Variance, and Covariance

  • Variance:

    • Measures the dispersion or variation of a single random variable or feature (a single dataset column) around its mean value.

    • Represents the dispersion and total information content present within a single feature.

    • Sample variance formula for a feature xx with nn data points:     s2=∑i=1n(xi−xˉ)2n−1s^2 = \frac{\sum_{i=1}^{n} (x_i - \bar{x})^2}{n - 1}

  • Covariance:

    • Compares two random variables or features (xx and yy) to evaluate how they vary jointly (e.g., whether variable yy increases or decreases as variable xx increases).

    • Note that xx and yy denote two dataset features/columns, not independent and dependent variables.

    • Sample covariance formula between features xx and yy across nn data points:     Cov(x,y)=∑i=1n(xi−xˉ)(yi−yˉ)n−1\text{Cov}(x, y) = \frac{\sum_{i=1}^{n} (x_i - \bar{x})(y_i - \bar{y})}{n - 1}

    • A higher covariance magnitude indicates that the feature pair interacts or relates on a higher scale.

  • Covariance Matrix:

    • A square matrix of dimension d×dd \times d, where dd represents the number of random variables or dataset features.

    • Each position (i,j)(i, j) in the matrix contains the calculated covariance of the i-thi\text{-th} feature (xix_i) and j-thj\text{-th} feature (xjx_j):     Cov(xi,xj)\text{Cov}(x_i, x_j)

    • Symmetric matrix across the main diagonal, satisfying:     Cov(xi,xj)=Cov(xj,xi)\text{Cov}(x_i, x_j) = \text{Cov}(x_j, x_i)

    • Diagonal entries where i=ji = j represent the individual feature variances:     Cov(xi,xi)=Var(xi)\text{Cov}(x_i, x_i) = \text{Var}(x_i)

Singular Value Decomposition (SVD) Principles and Applications

  • Definition: SVD is a matrix factorization method that decomposes any arbitrary matrix AA of dimension m×nm \times n into simpler constituent matrices, analogous to a chemical decomposition reaction breaking down a compound into simpler elements.

  • SVD compresses data and extracts feature and sample importance, establishing ranking scales to separate essential features from redundant ones.

  • Applications:

    • Principal Component Analysis (PCA): Serves as the structural foundation for dimensionality reduction.

    • Image Compression: Reduces redundant pixel counts while preserving image content. For example, compressing a square image of 1600×16001600 \times 1600 pixels down to 80×8080 \times 80 pixels by removing redundant pixels and retaining high-importance features.

    • Recommender Systems: Encodes users, products, and objects into lower-dimensional compressed representations to enable fast pairwise comparisons against millions of catalog items (e.g., streaming platforms like Netflix matching user viewing histories to content distributions).

    • Data Denoising: Reduces feature dimensionality to extract signals and eliminate noise components.

Anatomy and Mathematical Structure of SVD

  • Factoring an m×nm \times n matrix AA into three product matrices:   A=UΣVTA = U \Sigma V^T

  • Left Singular Matrix (UU):

    • Dimension: m×mm \times m square matrix.

    • Describes the sample space, corresponding to the mm records or rows in the data.

    • Columns are the left singular vectors u_i$.\n* **Right Singular Matrix (V)**:\n * Dimension: n \times n square matrix.\n * Describes the feature space, corresponding to the n features or columns in the data.\n * Columns are the right singular vectors v_i.</p></li></ul></li><li><p><strong>SingularValueMatrix(.</p></li></ul></li><li><p><strong>Singular Value Matrix (\Sigma$):

      • Dimension: m×mm \times m or m×nm \times n matrix (identical shape to original matrix AA).

      • Diagonal matrix containing singular values σi\sigma_i arranged along the main diagonal.

      • Describes the importance, strength, or scale of corresponding sample and feature directions.

    Step-by-Step Computational Procedure for SVD

    • Standard eigenvalue decomposition Av=λvA v = \lambda v requires a square matrix. SVD bypasses non-square restrictions for matrix AA (m×nm \times n) by computing square covariance matrices ATAA^T A (n×nn \times n) and AATA A^T (m×mm \times m).

    • Step 1: Compute Right Singular Vectors (VV):

      1. Construct the feature covariance matrix ATAA^T A of dimension n×nn \times n

      2. Solve the characteristic equation for eigenvalues λi\lambda_i:      det⁡(ATA−λI)=0\det(A^T A - \lambda I) = 0

      3. Solve for eigenvectors viv_i:      (ATA)vi=λivi(A^T A) v_i = \lambda_i v_i

      4. Normalize each eigenvector viv_i using its L2L_2 norm:      v^i=vi∥vi∥2\hat{v}_i = \frac{v_i}{\|v_i\|_2}      where for vector v=(abc)v = \begin{pmatrix} a \\ b \\ c \end{pmatrix}, the norm is:      ∥v∥2=a2+b2+c2\|v\|_2 = \sqrt{a^2 + b^2 + c^2}

      5. Set normalized vectors v^i\hat{v}_i as columns of matrix V=(v^1v^2…v^n)V = \begin{pmatrix} \hat{v}_1 & \hat{v}_2 & \dots & \hat{v}_n \end{pmatrix}. These vectors point in the direction of the data spread along features.

    • Step 2: Compute Singular Values (Σ\Sigma):

      1. Compute singular values as square roots of eigenvalues:      σi=λi\sigma_i = \sqrt{\lambda_i}

      2. Sort singular values in descending order:      σ1≥σ2≥⋯≥0\sigma_1 \ge \sigma_2 \ge \dots \ge 0

      3. Place sorted values σi\sigma_i on the main diagonal entries (i,i)(i, i) of an m×nm \times n matrix.

      4. The maximum number of available diagonal positions is bounded by min⁡(m,n)\min(m, n).

    • Step 3: Compute Left Singular Vectors (UU):

      1. Use the computational shortcut relating UU, AA, VV, and Σ\Sigma:      ui=1σiAviu_i = \frac{1}{\sigma_i} A v_i

      2. Compute vectors uiu_i for i=1,2,…,mi = 1, 2, \dots, m

      3. Form the m×mm \times m matrix U=(u1u2…um)U = \begin{pmatrix} u_1 & u_2 & \dots & u_m \end{pmatrix}

    Detailed Mathematical Worked Example

    • Consider a matrix AA of dimension 2×32 \times 3 (m=2m = 2 samples, n=3n = 3 features):

      • Dimension of AA: 2×32 \times 3

      • Dimension of covariance matrix ATAA^T A: 3×33 \times 3

    • Eigenvalue Calculation of ATAA^T A:

      • Diagonal/element entry evaluation snippet: 32+22=133^2 + 2^2 = 13

      • Solving the characteristic matrix yields three sorted eigenvalues:     λ1=25\lambda_1 = 25     λ2=9\lambda_2 = 9     λ3=0\lambda_3 = 0

    • Eigenvector Computation and Normalization:

      • For λ1=25\lambda_1 = 25, solve (ATA−25I)v1=0(A^T A - 25 I) v_1 = 0 to yield eigenvector v1=(abc)v_1 = \begin{pmatrix} a \\ b \\ c \end{pmatrix}

      • Normalize v1v_1 by dividing components by the vector norm:     a2+b2+c2\sqrt{a^2 + b^2 + c^2}

      • Repeating for λ2=9\lambda_2 = 9 and λ3=0\lambda_3 = 0 yields normalized column vectors v1,v2,v3v_1, v_2, v_3 forming the 3×33 \times 3 matrix VV

    • Singular Values and Matrix Σ\Sigma Construction:

      • Compute singular values:     σ1=25=5\sigma_1 = \sqrt{25} = 5     σ2=9=3\sigma_2 = \sqrt{9} = 3     σ3=0=0\sigma_3 = \sqrt{0} = 0

      • Construct 2×32 \times 3 matrix Σ\Sigma:     Σ=(500030)\Sigma = \begin{pmatrix} 5 & 0 & 0 \\ 0 & 3 & 0 \end{pmatrix}

      • Positions (1,1)=5(1, 1) = 5 and (2,2)=3(2, 2) = 3. The third singular value σ3=0\sigma_3 = 0 is redundant/omitted because matrix dimensions allow only min⁡(2,3)=2\min(2, 3) = 2 diagonal entries.

    • Left Singular Vectors (UU) Construction:

      • Matrix UU requires size m×m=2×2m \times m = 2 \times 2 (2 column vectors):     u1=15Av1u_1 = \frac{1}{5} A v_1     u2=13Av2u_2 = \frac{1}{3} A v_2

      • u3u_3 is not required because UU is bounded by m=2m = 2 vectors.

    • Matrix Dimension Verification:

      • AA: 2×32 \times 3

      • UU: 2×22 \times 2

      • Σ\Sigma: 2×32 \times 3

      • VTV^T: 3×33 \times 3

      • Multiplying UΣVTU \Sigma V^T reconstructs the original 2×32 \times 3 matrix AA

    Questions and Student Interactions

    • Question: For a 3×43 \times 4 matrix, when computing SVD, would the fourth column of the Σ\Sigma matrix consist entirely of zeros (i.e., (000)\begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix})?

    • Answer: Yes. For a 3×43 \times 4 matrix AA, the Σ\Sigma matrix maintains size 3×43 \times 4. Diagonal entries exist only up to index (3,3)(3, 3), meaning the fourth column consists entirely of zero entries (000)\begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}. The maximum number of singular values usable along the main diagonal is bounded by min⁡(m,n)=min⁡(3,4)=3\min(m, n) = \min(3, 4) = 3.