Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      59 of 102

      One step size per direction

      You’re walking down a long, narrow valley in the fog (“Walk downhill”). Across the valley the ground is 100× steeper than along it, so plain steps of step_size × slope bounce from wall to wall while you crawl along the floor. Write steps(slopes_seen, step_size): slopes_seen has, for each direction, every slope you’ve felt so far, oldest first. Return the step to take now in each direction, using step_size as the biggest step you’d ever take.

      A long, narrow valley seen from above, 100× steeper across than along. A plain step is step_size × slope in each direction, with one step size for both. Watch where that gets you, try other step sizes, then write a step that works in each direction.

      A long, narrow valley from above. Across it the ground is 100× steeper than along it.along the floor →↕ across: 100× steeperthe bottomsteps(slopes_seen, step_size 0.015) → across ?, along ??
      Your functionsteps(slopes_seen, step_size)
      slopes_seenone list per direction, every slope felt so fare.g. [[3, 2, 4], [−0.03, −0.02, −0.04]]
      step_sizethe biggest step you'd ever takee.g. 0.1
      returnsthe step to take now in each direction
      solution.pyLoading Python
      Sign in for an AI hint
      ← The ball keeps rollingSame step, smaller batches →