Projects/Foundations/Rank-revealing factorizations versus normal equations — controlled synthetic benchmark
Level 3 · intermediate · ~10 h
Rank-revealing factorizations versus normal equations — controlled synthetic benchmark
Compare SVD, QR with column pivoting and the normal equations for rank detection on ill-conditioned design matrices from UCI datasets. Use a fixed seed, a controlled ground truth, and an ablation grid over the key hyperparameter.
Prerequisites
Problem statement
- 01Compare SVD, QR with column pivoting and the normal equations for rank detection on ill-conditioned design matrices from UCI datasets. Use a fixed seed, a controlled ground truth, and an ablation grid over the key hyperparameter.
Real-world motivation
- 01Squaring the condition number in normal equations silently destroys small singular values. The controlled synthetic benchmark 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 relative error against the analytic ground truth 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
- 01synthetic matrices generated with numpy.random.default_rng(42)
- 02condition numbers 1, 10, 100, 1000
Step-by-step tasks
- 01Frame the task and freeze the controlled synthetic benchmark 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 relative error against the analytic ground truth 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 controlled synthetic benchmark run.
Testing requirements
- 01Check residual norms agree for well-conditioned cases
- 02Verify rank estimate tolerance scales with eps*sigma_max
- 03Measure relative error against the analytic ground truth over at least three seeds.
Evaluation metrics
- 01coefficient error
- 02relative residual
- 03rank estimate
- 04relative error against the analytic ground truth
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
- 03ill-conditioning above 1e3 makes double precision futile
Stretch goals
- 01implement randomized SVD
- 02study rank-revealing LU
- 03repeat in float32 and quantify the extra error floor
Research extensions
- 01compare randomized and deterministic rank estimation
- 02derive error bounds for truncated solves
GitHub submission requirements
- 01A repository whose README states the controlled synthetic benchmark 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 synthetic matrices generated with numpy.random.default_rng(42) and what the ablation revealed.
Completion rubric
- 01three methods correct
- 02condition squaring demonstrated
- 03rank tolerance justified
- 04Extra credit: repeat in float32 and quantify the extra error floor
Submit when every rubric item is satisfied and your repository contains runnable code plus a reproduction command.