If we were trying to predict the salary of your neighbor, how would we go about solving this problem?

Well, if you knew the salaries of many others in the neighborhood already you could add those values to a map.

On that map, we could observe where the value that we’re trying to predict appears to be in relation to the data that is closest to it on that map. That map, might look something like the visual below.

On this map, we’re trying to predict the value for the green circle. To do so, we draw a circle around the “nearest neighbors” in order to make a data driven prediction for the value of the green circle or your neighbors salary.

Get our awesome product content delivered daily-ish to your inbox

If you understand this story then you understand how a popular algorithm used in machine learning works. That algorithm is called k-nearest neighbor.

There are lots of different algorithms to choose from to help solve our problems with artificial intelligence and machine learning. Determining which one to use is about understanding the problem we are trying to solve. You can think of them like tools to perform specific jobs.

PS. You can read more about the k-nearest neighbor algorithm here.