lesson 2 of 4 · dimensionality and distance trapslesson 2 of 4 · dimensionality and distance trapslesson 2 of 4 · dimensionality and distance trapslesson 2 of 4 · dimensionality and distance trapslesson 2 of 4 · dimensionality and distance trapslesson 2 of 4 · dimensionality and distance trapslesson 2 of 4 · dimensionality and distance trapslesson 2 of 4 · dimensionality and distance trapslesson 2 of 4 · dimensionality and distance trapslesson 2 of 4 · dimensionality and distance trapslesson 2 of 4 · dimensionality and distance traps
Checkpoint
One last thing before we move on. pass this to mark the lesson done, or skip and keep moving. hop to the next when you're ready.
Measure the curse of dimensionality yourself. Write contrast(d, n=60): seed already set — drop n random d-dimensional points and one query (all coordinates random.random()), then return nearest distance / farthest distance from the query. Print the ratio for dims=2 and dims=500 (exact format: f"dims=2 nearest/farthest = {low:.2f}" / f"dims=500 nearest/farthest = {high:.2f}"), then print whether contrast shrank (high > low + 0.3).