# ๐ŸŽต Spotify Song Preference Dataset This dataset contains Spotify audio features for 195 songs categorized as **liked** or **disliked** by the user. It was created to build and train ML models that can predict user preferences in music based on quantitative audio features. --- ## ๐Ÿ“ฅ Dataset Overview - **Total songs**: 195 - **Format**: CSV (`data.csv`) - **Source**: Spotify API - **Target column**: `liked` (1 = liked, 0 = disliked) - **Data type**: Tabular - **Licensing**: For academic and personal research use (derived from Spotify API) --- ## ๐Ÿ“ฆ Dataset Composition | Category | Count | Description | |--------------|-------|---------------------------------------------| | Liked | 100 | Mostly French/American rap, rock, electro | | Disliked | 95 | 25 metal, 25 classical, 25 disco, 20 rap | | Neutral (Pop)| โŒ Not included (user is neutral) | --- ## ๐Ÿงช Features Extracted via Spotify API โ€“ "Get Audio Features for Several Tracks" | Feature | Description | |-------------------|-----------------------------------------------------------------------------| | `danceability` | How suitable the track is for dancing (0โ€“1) | | `energy` | Perceived intensity (0โ€“1) | | `key` | Musical key (0 = C, 1 = Cโ™ฏ/Dโ™ญ...) | | `loudness` | Overall volume in dB (-60 to 0) | | `mode` | 1 = major, 0 = minor | | `speechiness` | Detects presence of speech (0โ€“1) | | `acousticness` | Confidence measure of being acoustic (0โ€“1) | | `instrumentalness` | Predicts presence of vocals (0โ€“1) | | `liveness` | Live audience presence (0โ€“1) | | `valence` | Positiveness of the song (0โ€“1) | | `tempo` | Beats per minute (BPM) | | `duration_ms` | Duration of the song in milliseconds | | `time_signature` | Estimated time signature (e.g. 4 = 4/4) | | `liked` (target) | 1 = liked, 0 = disliked | --- ## ๐Ÿ” Exploratory Data Analysis (EDA) ### โœ… 1. Missing Values - No missing values found ### โœ… 2. Class Distribution - Liked (1): 100 songs - Disliked (0): 95 songs - **Class is balanced** ### โœ… 3. Data Types - All features are numerical - Target (`liked`) is binary ### โœ… 4. Summary Statistics - Energy, Danceability, Valence tend to be higher for liked songs - Acousticness and Instrumentalness higher in disliked songs ### โœ… 5. Correlation Matrix - Strong positive correlation: `energy` โ†” `loudness` - Negative correlation: `acousticness` โ†” `energy`, `valence` ### โœ… 6. Visual Highlights (Suggested) - **Boxplots**: `energy`, `danceability` by `liked` - **Countplot**: class balance of `liked` - **Heatmap**: correlation of features - **Scatter**: `energy` vs `valence` colored by `liked` --- ## ๐Ÿค– ML Use Cases You can use this dataset to train: - Logistic Regression - Random Forest - KNN / SVM - ANN / XGBoost / LightGBM - Naive Bayes --- ## ๐Ÿ“Š Visualizations ### 1. Boxplot: Energy Distribution by Liked This shows how energy values are distributed for liked and disliked songs. ![Energy Boxplot](boxplot_energy.png) --- ### 2. Boxplot: Danceability Distribution by Liked This shows how danceability varies between liked and disliked songs. ![Danceability Boxplot](boxplot_danceability.png) --- ### 3. Scatter Plot: Energy vs Valence This plot helps visualize clusters or spread of liked vs disliked songs based on energy and valence. ![Energy vs Valence](scatter_energy_valence.png) --- ### 4. Correlation Heatmap This heatmap shows how all audio features correlate with each other. ![Correlation Heatmap](correlation.png) ### 5. Countplot: Liked vs Disliked Songs This chart shows the number of songs in each class: `0 = Disliked`, `1 = Liked`. It confirms that the dataset is nearly balanced. ![Liked vs Disliked Countplot](countplot_liked.png) ## ๐Ÿ“‰ Statistical Testing To determine which features are statistically different between liked and disliked songs, a two-sample t-test was performed using: | Feature | p-value | Significance | | ---------------- | ------- | ----------------- | | danceability | 0.0000 | โœ… Significant | | energy | 0.0159 | โœ… Significant | | key | 0.5371 | โŒ Not significant | | loudness | 0.0000 | โœ… Significant | | mode | 0.7418 | โŒ Not significant | | speechiness | 0.0000 | โœ… Significant | | acousticness | 0.0134 | โœ… Significant | | instrumentalness | 0.0000 | โœ… Significant | | liveness | 0.8924 | โŒ Not significant | | valence | 0.0002 | โœ… Significant | | tempo | 0.0000 | โœ… Significant | | duration_ms | 0.0000 | โœ… Significant | | time_signature | 0.0023 | โœ… Significant | ๐Ÿ” Observation: - Features with p-value > 0.05 are statistically insignificant - These features do not show a meaningful difference between liked and disliked songs - We can safely remove the following features: liveness mode key โœ… This simplifies the dataset and improves model performance by removing noise. ## ๐Ÿ“ˆ Model Accuracy Comparison Bar chart showing accuracy of different models used in the project. ![Model Accuracy Chart](accuracy_comparison.png)