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

      Which fruit is it?

      Each fruit is two numbers, [size, redness]: size in cm, redness from 0 (green) to 10 (bright red). Write classify(point, known_points, labels): given a new fruit and the fruits you already know, return the label of the known fruit it’s most like.

      You know four fruits by size and redness. A new fruit turns up. Which known fruit is it most like? Move the new fruit, or guess.

      05100510size (cm) →↑ rednesssize 8, redness 7which fruit is it?it’s a ?
      Your functionclassify(point, known_points, labels)
      pointa new fruit, [size, redness]e.g. [7, 1]
      known_pointsfruits you already know, one [size, redness] eache.g. [[2, 9], [8, 8], [7, 1], [12, 3]]
      labelstheir names, e.g. "apple"e.g. ["cherry", "apple", "lemon", "grapefruit"]
      returnsthe label of the known fruit it's most like
      solution.pyLoading Python
      Sign in for an AI hint
      ← Do they move together?Shared interests →