Skip to content

About

Machine Learning with Python in Jupyter Notebook. Includes multi-class classification (SVM), clustering (K-Means), and data analysis with pandas & scikit-learn. Evaluated models independently via Kaggle-style competition

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Machine Learning with Python – Multi-Class Classification & Clustering

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.


Part A: Multi-Class Classification (Music Genre Prediction)

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.

Approach

  • Split data into training and test sets (75/25) using train_test_split
  • Scaled features with StandardScaler to 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

Results

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.


Part B: K-Means Clustering (Global Life Expectancy)

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.

Approach

  • Selected two numerical features

About

Machine Learning with Python in Jupyter Notebook. Includes multi-class classification (SVM), clustering (K-Means), and data analysis with pandas & scikit-learn. Evaluated models independently via Kaggle-style competition

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages