← All work 2023Personal project

Spotify playlist recommendations

Give it a playlist and it suggests tracks that sound similar. I wanted hands-on practice with large datasets, and vector similarity was fresh from my final-year project.

  • Python
  • Pandas
  • NumPy
  • Scikit-learn
  • Matplotlib
  • Seaborn

What I built

  • Data preparation. Cleaned a Kaggle dataset of Spotify tracks, filled or dropped missing values and put the audio features (tempo, energy, danceability and so on) on a common scale.
  • Feature work. Looked at how the features relate and used PCA to shrink them before comparing tracks.
  • Recommender. A function, generate_playlist_recos, scores every track outside the playlist by cosine similarity to the playlist’s tracks and returns the closest ones with a similarity score.

Caveats

  • I judged the output by listening, not with an offline metric.
  • It only uses audio features. Connecting it to the Spotify API and trying learned models are the obvious next steps.