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

      Who should “it” listen to?

      Reading the cat sat on the mat because it was tired, the word it has to work out which word it means. Each word has a key: two numbers for how much it’s an animal and how much it’s a place. it has a query: what it’s looking for. Write listen(query, keys): how much “it” listens to each word, as shares.

      Each word’s key is [animal, place]. “it” looks for [1, 0], an animal. It has 100% of its attention to share out among cat, sat and mat: how much should each get?

      “it” looks for an animalthecat?[2,0]sat?[0,0]onthemat?[0,2]becauseitlooks for [1,0]wastiredsharekeyits attention100% to share out: how much to each word?
      Your functionlisten(query, keys)
      querywhat "it" is looking for, [animal, place]e.g. [1, 0]
      keysone row per word, what each word is, [animal, place]e.g. [[2, 0], [0, 0], [0, 2]]
      returnsone share per word: how much "it" listens to it
      solution.pyLoading Python
      Sign in for an AI hint
      ← Merge the most common pairListen and collect →