Projects/Foundations/Power iteration PageRank on a Wikipedia link subgraph — controlled synthetic benchmark
Level 1 · foundational · ~7 h
Power iteration PageRank on a Wikipedia link subgraph — controlled synthetic benchmark
Build a directed link graph from a Wikipedia dump subset and compute PageRank by power iteration, tracking convergence and dangling-node handling. Use a fixed seed, a controlled ground truth, and an ablation grid over the key hyperparameter.
Prerequisites
Problem statement
- 01Build a directed link graph from a Wikipedia dump subset and compute PageRank by power iteration, tracking convergence and dangling-node handling. Use a fixed seed, a controlled ground truth, and an ablation grid over the key hyperparameter.
Real-world motivation
- 01PageRank is a large sparse eigenvector problem where the stochastic matrix and dangling nodes dictate correctness. The controlled synthetic benchmark setting forces concrete choices about data, scale and evaluation.
Learning objectives
- 01Parse links into a sparse adjacency
- 02Construct the Google matrix
- 03Verify convergence and rank stability
- 04Report relative error against the analytic ground truth alongside the baseline metrics.
Technical architecture
- 01sparse adjacency in CSR
- 02dangling-node correction
- 03power iteration with residual monitoring
Mathematical foundations
- 01$G=\alpha S+(1-\alpha)\frac{1}{n}\mathbf{1}\mathbf{1}^\top$
- 02$p_{k+1}=Gp_k$, convergence rate $\alpha$
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: Stream a 50k-page Wikipedia subset
- 03Implementation 2: Normalize outgoing links, add dangling rows
- 04Implementation 3: Iterate until L1 residual < 1e-8
- 05Verification 1: Verify p sums to one every iteration
- 06Verification 2: Check ranks against networkx.pagerank
- 07Run the ablation grid and report relative error against the analytic ground truth over three independent trials.
Implementation requirements
- 01Stream a 50k-page Wikipedia subset
- 02Normalize outgoing links, add dangling rows
- 03Iterate until L1 residual < 1e-8
- 04Log all hyperparameters and the random seed for the controlled synthetic benchmark run.
Testing requirements
- 01Verify p sums to one every iteration
- 02Check ranks against networkx.pagerank
- 03Measure relative error against the analytic ground truth over at least three seeds.
Evaluation metrics
- 01L1 residual
- 02iterations to converge
- 03top-k rank overlap
- 04relative error against the analytic ground truth
Expected outputs
- 01top-50 page table
- 02residual curve
Common failure modes
- 01spider traps concentrate all mass
- 02dangling nodes cause mass loss
- 03ill-conditioning above 1e3 makes double precision futile
Stretch goals
- 01implement personalized PageRank
- 02compare with HITS hubs and authorities
- 03repeat in float32 and quantify the extra error floor
Research extensions
- 01study sensitivity to the damping factor
- 02derive convergence under node perturbation
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
- 01stochastic matrix correct
- 02dangling handling correct
- 03residual-based stopping
- 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.