projects / proj-math-010
Next task →
Projects/Foundations/Rank-revealing factorizations versus normal equations — real-data stress test
Level 4 · advanced · ~12 h

Rank-revealing factorizations versus normal equations — real-data stress test

Compare SVD, QR with column pivoting and the normal equations for rank detection on ill-conditioned design matrices from UCI datasets. Repeat on a real dataset, report a table with confidence intervals over three trials, and explain which assumption broke.
Add to portfolio →

Problem statement

  • 01Compare SVD, QR with column pivoting and the normal equations for rank detection on ill-conditioned design matrices from UCI datasets. Repeat on a real dataset, report a table with confidence intervals over three trials, and explain which assumption broke.

Real-world motivation

  • 01Squaring the condition number in normal equations silently destroys small singular values. The real-data stress test setting forces concrete choices about data, scale and evaluation.

Learning objectives

  • 01Implement rank estimates from each factorization
  • 02Solve least squares with each method
  • 03Compare residual and coefficient error
  • 04Report wall-clock seconds on one pinned CPU core alongside the baseline metrics.

Technical architecture

  • 01three factorization pipelines
  • 02singular value spectrum plot
  • 03condition number estimator

Mathematical foundations

  • 01$\kappa_2(A^\top A)=\kappa_2(A)^2$
  • 02truncated SVD solution $x=V\Sigma^{-1}U^\top b$

Dataset and sources

  • 01MNIST 70k subset
  • 02UCI Sparse Matrix collection

Step-by-step tasks

  • 01Frame the task and freeze the real-data stress test evaluation protocol with a fixed random seed.
  • 02Implementation 1: Use numpy.linalg.svd and scipy.linalg.qr(pivoting=True)
  • 03Implementation 2: Solve normal equations explicitly
  • 04Implementation 3: Vary matrix condition number
  • 05Verification 1: Check residual norms agree for well-conditioned cases
  • 06Verification 2: Verify rank estimate tolerance scales with eps*sigma_max
  • 07Run the ablation grid and report wall-clock seconds on one pinned CPU core over three independent trials.

Implementation requirements

  • 01Use numpy.linalg.svd and scipy.linalg.qr(pivoting=True)
  • 02Solve normal equations explicitly
  • 03Vary matrix condition number
  • 04Log all hyperparameters and the random seed for the real-data stress test run.

Testing requirements

  • 01Check residual norms agree for well-conditioned cases
  • 02Verify rank estimate tolerance scales with eps*sigma_max
  • 03Measure wall-clock seconds on one pinned CPU core over at least three seeds.

Evaluation metrics

  • 01coefficient error
  • 02relative residual
  • 03rank estimate
  • 04wall-clock seconds on one pinned CPU core

Expected outputs

  • 01spectrum plots
  • 02error-versus-condition table

Common failure modes

  • 01normal equations fail once cond(A) approaches 1/sqrt(eps)
  • 02pivoted QR can miss nearly equal singular values
  • 03real data violates the synthetic noise model and the baseline overfits

Stretch goals

  • 01implement randomized SVD
  • 02study rank-revealing LU
  • 03profile the method with cProfile and report the dominant kernel

Research extensions

  • 01compare randomized and deterministic rank estimation
  • 02derive error bounds for truncated solves

GitHub submission requirements

  • 01A repository whose README states the real-data stress test protocol and the exact command to reproduce it.
  • 02Source for the scratch implementation, a test file, and a results table with uncertainty estimates.
  • 03A two-page report explaining failures on MNIST 70k subset and what the ablation revealed.

Completion rubric

  • 01three methods correct
  • 02condition squaring demonstrated
  • 03rank tolerance justified
  • 04Extra credit: profile the method with cProfile and report the dominant kernel

Submit when every rubric item is satisfied and your repository contains runnable code plus a reproduction command.