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.
rescale(known, listings)| known | the 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… |
| listings | this week's new listings, the same three columns (a numpy array) | e.g. [[312000, 2, 0.5], [520000, 3, 6], [250000… |
| returns | known, listings: both tables, rescaled so every column counts fairly | |