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 114

      Did it see the ear?

      A cat detector looks at a photo and scores every spot: how much it looks like the tip of an ear (high is ear-like, below zero clearly not). To look wider, the next layer needs that map a quarter the size: each 2 × 2 window of spots becomes one spot. Write shrink(window): given one window’s four scores, return the one score that stands for them, without losing an ear.

      Two cats and a cat detector’s map of them: each spot scored for how much it looks like the tip of an ear. Shrinking the map by averaging each 2 × 2 window loses the kitten’s ears. The goal is the small map it ends on. Your shrink(window) gets one window’s four scores.

      Two cats: a big one, and a kitten tilting its head.the photo
      Your functionshrink(window)
      window2x2 ear scores (a numpy array), four neighbouring spots of the detector's map window[0] is its top row, window[1][1] its bottom-right spote.g. [[0, 0], [0, 0]]
      returnsone score for the whole window, for the map a quarter the size
      solution.pyLoading Python
      Sign in for an AI hint
      ← Fix the colorsOutput size →