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
      57 of 102

      Smooth the noise

      A sensor’s readings jump around. Keep a smoothed value that updates with every new reading. Write smooth(previous, reading, keep): the new smoothed value, where previous is the smoothed value so far and keep (0 to 1) is how much of it to hold on to.

      A thermometer reads 21, then 25, 19, 23, 20, 24. The smoothed value starts at 21, and after each new reading smooth(previous, reading, keep) gives the next one, here with keep 0.8. What should they be?

      a noisy thermometer, keep 0.8● reading◆ smoothedsmoothedstart#1#2#3#4#521

      click a smoothed value to see the call that made it

      Your functionsmooth(previous, reading, keep)
      previousthe smoothed value so fare.g. 5
      readingthe newest reading from the sensore.g. 5
      keep0 to 1, how much of previous to hold on toe.g. 0.9
      returnsthe new smoothed value
      solution.pyLoading Python
      Sign in for an AI hint
      ← Shrink toward zeroThe ball keeps rolling →