all lessons

algorithms

did you know Spotify can measure how similar two songs are?

songs and listeners can be placed as points in a giant mathematical space — and taste becomes a matter of distance.

taste, drawn as a map — a simplified sketch
youtaste, as coordinates

the idea

recommendation systems turn taste into geometry. songs become points in a high-dimensional space, listeners become points nearby, and “you might also like” becomes “what is close to you”.

how it works

one classic approach needs no understanding of music at all: if people who love the songs you love also love something you haven’t heard, that something is a good bet.

go deeper

taste has a shape

imagine every song as a dot on a map — not a map of places, but of qualities. songs that feel alike sit close together.

your listening history places you on that same map. recommendations are, roughly, the dots nearest to you that you haven’t heard yet.

similar listeners, similar songs

one classic approach needs no understanding of music at all: if people who love the songs you love also love something you haven’t heard, that something is a good bet.

millions of listening patterns compress each song and each listener into a list of numbers — a vector — capturing the shape of their taste.

similarity(a, b) = cos θ = (a · b) ÷ (|a| × |b|)

a simplified sketch. production systems blend many models and signals.

angles as a measure of taste

cosine similarity measures the angle between two vectors. an angle of zero means identical taste; ninety degrees means unrelated.

it ignores loudness and size and focuses purely on direction — which is exactly what you want when comparing patterns.

the eerie part: the dimensions have no names. the model invents whatever axes best separate listening behaviour, and we just call them coordinates.

cos θ = (a₁b₁ + a₂b₂ + … + aₙbₙ) ÷ (|a| × |b|)

things to wonder about next
  • the cold-start problem: brand-new songs have no listeners yet, so systems also analyse audio features to place them.
  • the same vector maths powers search, image recognition and large language models.
  • spotify has published engineering posts on how discover weekly and similar features evolved — worth a read.
sources & further reading

concepts: embeddings · cosine similarity · collaborative filtering

5 minute read