Music Genre Classification

Classification model to predict the genre of a Spotify song based on its audio features. Final project for CIS 5450 (Big Data Analytics).

Project Overview & Motivation

The goal of this project was to gain insight on the relationship between a song’s audio features and its genre. Specifically, we were interested in which audio features are most import in distinguishing between different genres, beyond what comes naturally to the ear. I was curious to explore a new way of comparing genres quantitatively. Check out the project notebook here.

Methods

We started with extensive preprocessing and EDA on a few Spotify audio features datasets from Kaggle to address class imbalance, clean the data, and perform feature engineering to prepare the data for our models. We then implemented machine learning models (random forest, XGBoost, neural network) to compare their performance in classifying songs into one of six genre categories. Finally, we used hypothesis testing to evaluate patterns we observed in the data.

Results

We found that each model performed moderately well in classifying songs into genres, but there was overlap between some genres that limited their performance. As an introductory ML project, this work helped me piece together a lot of the different techniques I have learned individually.

Confusion matrix from our Random Forest model. Indicated some overlap between genres, but otherwise had decent performance.
Radar plots of rock vs. classical audio features. Interestingly, these graphs are almost opposites of each other.
PCA also showed overlap between genres, with classical being a more distinct group.

Skills Used

  • Programming: scikit-learn, PyTorch, Plotly, Pandas, NumPy
  • ML concepts: PCA, t-SNE, XGBoost, Random Forest, deep learning, SMOTE, hyperparameter tuning