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

      Don’t wait for the end

      You’re learning what each square of a board game is worth: all the rewards still to come from it, counted as in “A reward now or later”. You just stepped off a square: you got reward, and you guess the square you landed on is worth guess_next. Write update(guess_here, reward, guess_next, patience, rate): your new guess for the square you just left, without waiting for the game to end. rate (0 to 1) is how far one step may move a guess.

      You thought the square you’re on was worth 4. You step off it, get a reward of 1, and land on a square you think is worth 10. What should you now guess the square you left is worth?

      one step of the gamethe boardpatience 0.9rate 0.1guess4you leftguess10you landedreward +1the guess for the square you left
      Your functionupdate(guess_here, reward, guess_next, patience, rate)
      guess_hereyour guess of what the square you just left is worthe.g. 10
      rewardwhat you got for this stepe.g. 1
      guess_nextyour guess of what the square you landed on is worth (0 if the game ended)e.g. 10
      patiencewhat a reward one step later is worth, as a share of one nowe.g. 0.9
      ratehow far one step may move a guess (0 to 1)e.g. 0.1
      returnsyour new guess for the square you just left
      solution.pyLoading Python
      Sign in for an AI hint
      ← A reward now or laterTry the unknown →