This project analyzes Spotify track-level audio features and genre information to study what drives track popularity and to build predictive models for popularity scores.
The work combines exploratory data analysis, statistical testing, feature-based modeling, and machine learning methods to understand the relationship between track characteristics and popularity.
Start here: Final Report PDF
The analysis focuses on a Spotify dataset containing audio and metadata features such as:
- valence
- acousticness
- danceability
- explicit flag
- track genre
- loudness
- popularity
The project uses these features to:
- explore trends and relationships in the dataset
- test statistical patterns across genres and audio characteristics
- build predictive models for popularity
- compare regression-based and support vector methods
- evaluate model performance using standard regression metrics
- Original source material covered approximately 90,000 unique tracks across more than 100 genres
- The final statistical analysis focused on 10 popular genres for clearer comparison and modeling
- Popularity was modeled as the target variable on a 0 to 100 scale
- Language: Python
- Environment: Jupyter Notebook
- Libraries: pandas, numpy, matplotlib, seaborn, scipy, statsmodels, scikit-learn, tabulate
- Modeling approaches: linear regression, support vector regression, hyperparameter tuning with GridSearchCV
- Evaluation metrics: R-squared, mean squared error
- Popularity differed significantly across genres based on the Kruskal-Wallis test
- Popularity also differed significantly between explicit and non-explicit tracks based on the Mann-Whitney test
- Genre and explicitness showed dependency in the chi-square analysis
- Acousticness showed a strong positive relationship with popularity
- Loudness showed a strong negative relationship with popularity
- Valence had only a weak relationship with popularity
| Model | R-squared | Mean Squared Error |
|---|---|---|
| Multiple Linear Regression | 0.768 | 82.83 |
| Lasso Regression | 0.767 | 83.24 |
| Support Vector Regression | 0.742 | 92.33 |
The linear and lasso models performed best in the final comparison, while SVR captured similar directional effects but with lower overall predictive accuracy.
spotify-track-popularity-prediction-statistical-learning/
README.md
.gitignore
requirements.txt
data/
README.md
raw/
spotify-track-popularity-dataset.csv
notebooks/
spotify-track-popularity-prediction.ipynb
reports/
final-report.pdf
final-presentation.pdf
final-presentation.pptx
notebooks/spotify-track-popularity-prediction.ipynb: final cleaned analysis notebookdata/raw/spotify-track-popularity-dataset.csv: working dataset used in the projectreports/final-report.pdf: final written reportreports/final-presentation.pdf: presentation summary of the projectreports/final-presentation.pptx: editable final presentation deck
- Tracks with higher acousticness and lower loudness were more likely to be popular in this dataset
- Genre and explicitness were statistically important predictors and should not be ignored in modeling
- Multiple Linear Regression and Lasso Regression offered the best balance of interpretability and performance in the final project
- The project shows how statistical testing and machine learning can be combined in a practical music analytics workflow
- The staged GitHub version keeps the final notebook and strongest supporting material.
- Draft notebooks and intermediate versions are intentionally excluded from the public repo.
- The notebook has been adjusted for repository-relative data access instead of Google Drive-only paths.
- The report and final presentation are the primary polished deliverables for this repository.