📝 tldr;
Whether or not you need a break from the ads, here's how Spotify recommends their next song:
They use an algorithm called ANNOY (Approximate Nearest Neighbors Oh Yeah).
ANNOY relies on objects (songs in this case) represented as “vectors”. Vectors are points in an n-dimensional space where points closer to each other are considered more similar than points far away from each other.
Instead of scanning the entire vector space to find the exact nearest neighbors of your song (which would need O(N) time), ANNOY uses a binary-tree-based approach to find the approximate nearest neighbors which brings down the time complexity to O(log N).
🙋♀️ Credit to our Contributing Author
Bhavana wrote this amazing article to share with our 21,001+ readers! If you’re also interested in being a byte-sized design writer, consider applying here!
Bhavana Hindupur is a Principal Software Engineer at Microsoft. She brings experience from her tenure at tech giants Google and Amazon, where she designed and implemented several large-scale solutions in the cloud.
Read more from her at thepeoplessoftwareengineer
💡 What are Vectors?
In the context of search, vectors are a way of representing data as points in a multidimensional space where the distance between the points is an indicator of similarity.
Keep reading with a 7-day free trial
Subscribe to Byte-Sized Design to keep reading this post and get 7 days of free access to the full post archives.