| # π΅ 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. | |
|  | |
| --- | |
| ### 2. Boxplot: Danceability Distribution by Liked | |
| This shows how danceability varies between liked and disliked songs. | |
|  | |
| --- | |
| ### 3. Scatter Plot: Energy vs Valence | |
| This plot helps visualize clusters or spread of liked vs disliked songs based on energy and valence. | |
|  | |
| --- | |
| ### 4. Correlation Heatmap | |
| This heatmap shows how all audio features correlate with each other. | |
|  | |
| ### 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. | |
|  | |
| ## π 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. | |
|  | |