This project was developed as a part of CS4168 Data Mining course at the University of Limerick
This is a dataset of Spotify tracks over a range of 125 different genres. Each track has some audio features associated with it. The data is in CSV format which is tabular and can be loaded quickly.
The analysis reveals several key insights about song characteristics and their relationships. Popularity tends to be higher for non-explicit tracks and those with high instrumentalness, while explicit and speech-heavy tracks are less popular. Club genre tracks are generally more popular, whereas dance genre tracks have lower popularity. Danceability, energy, and loudness are strongly correlated, indicating that upbeat, energetic tracks are typically more danceable. Acousticness is heavily associated with the opera genre, which contrasts with dance and club music in terms of energy and loudness.
For predicting song popularity, features like explicit content, instrumentalness, speechiness are crucial indicators, whereas tempo, duration, key appear to have little impact on popularity. Machine learning models could benefit from focusing on these strong predictors and potentially creating derived features to enhance prediction accuracy.
When clustering tracks by genre, acousticness is a strong differentiator for opera tracks, while danceability and energy are key in separating dance and club genres. Speechiness can also help distinguish spoken-word-heavy club tracks from instrumental opera pieces. Tempo distribution patterns, instrumentalness, and explicit content may further refine genre classification models.
Overall, we explored the correlation between popularity and various features. Genre-based variations highlight key differences in track characteristics, and these insights can guide both music recommendation systems and feature engineering for predictive modeling. Future work could explore more nuanced aspects, such as lyrical sentiment or production techniques, to further refine these conclusions.
KMeans Cluster:
- Cluster 0: Longer songs (avg. 214,837 ms), lower popularity (29.46), less energetic (lower
danceabilityandenergy), lower loudness (-8.60 dB). - Cluster 1: Shorter songs (avg. 171,699 ms), higher popularity (21.81), more energetic (higher
danceabilityandenergy), louder (-6.17 dB). - Overlap: Both KMeans and DBSCAN have similar cluster groupings, with Cluster 0 correlating with DBSCAN Cluster 0, and Cluster 1 correlating with DBSCAN Cluster 1.
DBSCAN Cluster (Excluding Noise):
- Cluster 0: Slightly longer songs (avg. 210,917 ms), higher
danceability, more acoustic, moderate loudness (-7.82 dB), more popular. - Cluster 1: Shorter songs (avg. 203,604 ms), higher energy, louder (-5.88 dB), lower
acousticness, less popular.
In summary, both algorithms identify two distinct song clusters:
- Cluster 0: Longer, less popular, acoustic songs.
- Cluster 1: Shorter, more energetic, popular songs.
Performance Summary:
- SVM consistently achieves the highest or near-highest scores across all metrics, making it a strong overall performer.
- KNN Classifier also performs well, particularly in accuracy, precision, and F1-score, but falls slightly behind in recall.
- Random Forest show competitive performance with moderate scores in all metrics.
- Decision Tree Classifier shows the lowest performance across all metrics, particularly in recall and F1-score.
Best Model Selection-Based on the evaluation:
Support Vector Machine (SVM) is selected as the best model.
Reasoning: Though Random Forest shows the best AUC score. SVM outperforms others on classification metrics like accuracy, precision, recall, and F1-score. It offers the best balance across all key metrics, especially showing strong performance in precision, recall, and F1-score, which are critical in classification tasks where both false positives and false negatives are costly. Therefore, SVM is the most reliable and well-rounded model for this classification task.