This project applies supervised and unsupervised machine learning techniques in Python across two independent datasets: a 10-genre music classification task and a global life expectancy clustering analysis. It covers the full workflow from data wrangling through model evaluation, including an independent submission to an in-class Kaggle competition.
Dataset: 25,958 tracks × 15 features (Spotify audio features: popularity, acousticness, danceability, duration, energy, instrumentalness, liveness, loudness, speechiness, tempo, valence), labelled across 10 music genres.
- Split data into training and test sets (75/25) using
train_test_split - Scaled features with
StandardScalerto prepare for distance-based classification - Trained two classifiers for comparison:
- Support Vector Machine (linear kernel)
- Random Forest (20 estimators, entropy criterion)
- Evaluated both using confusion matrices and accuracy scores across all 10 genre classes
- Tuned the SVM further using
GridSearchCV(kernel: linear/rbf/poly, C: 0.1/1/10, 5-fold cross-validation) to select the best-performing configuration - Applied the tuned model to an unseen submission dataset and generated predictions for an in-class Kaggle competition
| Model | Test Accuracy |
|---|---|
| SVM (linear kernel) | 53.73% |
| Random Forest | 52.59% |
SVM outperformed Random Forest by roughly 1 percentage point. Both results are well above the 10% random-guess baseline for a 10-class problem, reflecting the genuine difficulty of genre classification from audio features alone.
Dataset: Life expectancy by country and region, 1990–2019 (Kaggle source). Missing data ranged from 362 entries in 1990 down to 16 in later years as data collection improved; rows with missing values were dropped prior to clustering.
- Selected two numerical features