Skip to content
nonconvexcard

Implement random projection and measure the distortion

CodingIntermediate⏱ 1 hourHigh-Dim Probabilityjlimplementationdistortionempirical

Problem

Implement Gaussian random projection and measure, for a cloud of NN points in RD\R^D:

  1. The maximum and mean pairwise distortion as a function of kk.
  2. Verify that the maximum distortion decays like 1/k1/\sqrt k and that the mean decays likewise but with a much smaller constant.
  3. Verify that varying DD at fixed kk barely changes the distortion.
  4. Compare Gaussian entries with Rademacher entries.

Implement it, then check the implementation against something you can verify independently.

Write it

Solve it here4 tests · Python runs in your browser
⌘/Ctrl + ↵ to run · limit 40s · draft saved in this browser
4 tests will run against your code. The first run downloads the Python runtime — several megabytes, once per browser.

Hints

Hints — 0 of 3 revealed

Solution

Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.

Related problems

All problems
SolvedProblemFieldTypeDifficultyTime
Johnson–Lindenstrauss dimension arithmeticHigh-Dim ProbabilityNumericalBeginner15 min
From distance preservation to inner-product preservationHigh-Dim ProbabilityProofIntermediate30 min
Implement backpropagation from scratch runDeep LearningCodingIntermediate3 hours
Implement kernel ridge regression runClassical MLCodingIntermediate1 hour
Implement multi-head attention from scratch runDeep LearningCodingIntermediate3 hours