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
      71 of 130

      Miles vs millimetres

      An estate agent matches each new listing with the house on the books most like it: the nearest one, over three columns, price, rooms and km to the station. Write rescale(known, listings): give back both tables, the books and this week’s listings, rescaled so every column counts fairly in that distance. The puzzle does the matching on whatever you return.

      An estate agent’s books: six houses, each with a price, a number of rooms and how far it is from the station. A new listing comes in, and the agent wants the house most like it: the nearest one, column by column. In dollars, price decides everything. The goal is a match like the one it ends on. Your rescale(known, listings) puts the columns into fair units first.

      An estate agent’s books: six houses. A new listing: which is it most like?this week: 1 new listing$312kpriceroomskmrescaledapart:priceroomskmnew listing$312k20.5???Mill Lane$305k20.5???7,000Oak Avenue$312k64.5???5.66Elm Street$420k31???108kHill Road$250k46???62kPark Row$520k50???208kBay Street$360k20.5???48k
      Your functionrescale(known, listings)
      knownthe houses on the books, one row each: [price, rooms, km to the station] (a numpy array)e.g. [[305000, 2, 0.5], [312000, 6, 4.5], [4200…
      listingsthis week's new listings, the same three columns (a numpy array)e.g. [[312000, 2, 0.5], [520000, 3, 6], [250000…
      returnsknown, listings: both tables, rescaled so every column counts fairly
      solution.pyLoading Python
      Sign in for an AI hint
      ← Grading its own homeworkEveryone is far away →