Let's talk ↗
← All projects

Bootcamp · Apr 2026

Music Recommender Simulation

I filled in a song recommender that scores a catalog from genre, mood, and a few audio numbers, then returns the top five.

I filled in a song recommender that scores a catalog from genre, mood, and a few audio numbers, then returns the top five. I wanted a score you can read: why this song, and by how much.

The problem

A ranked list with no arithmetic behind it is a shuffle with confidence. You cannot argue with it, and you cannot tell whether genre mattered more than tempo. The person it frustrates is the one who wanted a loud song and got a quiet one with the right genre, or the reverse, and has no way to see which term won.

The score had to be a sum I could point at. It was worth writing the weights down because a recommender that will not show its arithmetic is not one I can finish, or fix.

How I built it

An exact genre match adds 2.0. An exact mood match adds 1.0. Genre is worth twice a mood on purpose, so a genre hit beats a mood hit when the two disagree. Energy, valence, danceability, and acousticness each add 1 minus the absolute difference. A perfect match on one of those adds a full point. A miss adds less.

Tempo is the awkward one. It adds 1 minus the BPM gap divided by 200, which squeezes a tempo difference into the same 0-to-1 band as the other audio numbers. A close BPM can still lose to a genre match, because genre is 2.0 and tempo cannot exceed 1.

I added 10 songs, so the catalog is 20. The run I saved is a terminal print of the top five, with the scores, so the ranking is a number you can recompute from the weights rather than a list the program asserts.

Challenges and what I learned

The weights are the product. Once genre is twice a mood, and tempo is crushed into the same band as energy, the top five is explained. I would rather defend that arithmetic than a ranking I cannot add up. The catalog is small because the point was the score, not a library.

RECOMMENDED

More like Music Recommender Simulation