| # π΅ Music Feature Dataset Analysis | |
| [](https://www.python.org/) | |
| [](https://pandas.pydata.org/) | |
| [](https://scikit-learn.org/) | |
| [](LICENSE) | |
| This repository contains a comprehensive exploratory data analysis (EDA) on a music features dataset. The primary objective is to understand the patterns in audio features and analyze how they relate to user preferences, providing insights for music recommendation systems and user profiling. | |
| ## π₯ Dataset Overview | |
| The dataset (`data.csv`) contains audio features extracted from music tracks along with user preference scores. This rich collection of acoustic and musical attributes enables deep analysis of what makes music appealing to listeners. | |
| **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) | |
| ## πΌ Features Description | |
| | Feature | Description | Data Type | Range/Values | | |
| |---------|-------------|-----------|--------------| | |
| | `danceability` | Measures how suitable a track is for dancing based on rhythm, tempo, and beat strength | Float | 0.0 - 1.0 | | |
| | `energy` | Intensity and activity level representing loudness, dynamic range, and general entropy | Float | 0.0 - 1.0 | | |
| | `key` | Musical key using standard Pitch Class notation | Integer | 0 - 11 | | |
| | `loudness` | Overall loudness measured in decibels (dB) | Float | Typically -60 to 0 | | |
| | `mode` | Modality of the track (Major = 1, Minor = 0) | Integer | 0, 1 | | |
| | `speechiness` | Presence of spoken words in a track | Float | 0.0 - 1.0 | | |
| | `acousticness` | Confidence measure of whether the track is acoustic | Float | 0.0 - 1.0 | | |
| | `instrumentalness` | Predicts whether a track contains no vocals | Float | 0.0 - 1.0 | | |
| | `liveness` | Detects the presence of an audience in the recording | Float | 0.0 - 1.0 | | |
| | `valence` | Musical positiveness conveyed by a track | Float | 0.0 - 1.0 | | |
| | `tempo` | Overall estimated tempo in beats per minute (BPM) | Float | Usually 50-200+ | | |
| | `duration_ms` | Track duration in milliseconds | Integer | Positive integers | | |
| | `time_signature` | Estimated overall time signature | Integer | 3, 4, 5, 7 | | |
| | `liked` | **Target Variable:** User preference score | Float | Continuous values | | |
| ### π EDA Overview: Music Preference Dataset | |
| ## 1οΈβ£ Null Values Check | |
| β The dataset is complete β no missing entries detected. | |
| ## 2οΈβ£ Target Class Breakdown | |
| Liked Tracks (1): 100 entries | |
| Disliked Tracks (0): 95 entries | |
| ### Total_Liked_and_Disliked_Songs | |
|  | |
| ## π’ The class distribution is fairly even β no need for balancing. | |
| ## 3οΈβ£ Feature Types | |
| All input variables are numeric. | |
| The target label liked is a binary flag (0 = dislike, 1 = like). | |
| ## 4οΈβ£ Key Statistical Insights | |
| Higher average values for energy, danceability, and valence are seen in liked songs. | |
| In contrast, acousticness and instrumentalness are more prominent in disliked tracks. | |
| ## 5οΈβ£ Correlation Patterns | |
| π Positive: energy strongly correlates with loudness. | |
| π» Negative: acousticness shows inverse correlation with energy and valence. | |
| ## 6οΈβ£ Recommended Visual Explorations | |
| π Try the following plots to gain deeper insights: | |
| π¦ Boxplots comparing liked vs energy, danceability | |
| π Bar chart for distribution of likes/dislikes | |
| π‘οΈ Heatmap of all feature correlations | |
| π― Scatter plot: energy vs valence, with points colored by liked status | |
| ### Required Libraries | |
| ```txt | |
| pandas>=1.3.0 | |
| numpy>=1.21.0 | |
| matplotlib>=3.4.0 | |
| seaborn>=0.11.0 | |
| scikit-learn>=1.0.0 | |
| ``` | |
| ## π§Ό Data Preprocessing | |
| Our comprehensive preprocessing pipeline includes: | |
| ### 1. **Data Quality Assessment** | |
| - β Missing value detection and handling | |
| - β Duplicate record identification and removal | |
| - β Data type validation and conversion | |
| - β Outlier detection using statistical methods | |
| ### π€ ML Use Cases | |
| ## You can use this dataset to train: | |
| 1. Logistic Regression | |
| 2. Random Forest | |
| 3. K-Nearest Neighbors. | |
| 3. Support Vector Machine. | |
| 4. Artificial Neural Network. | |
| 5. Naive Bayes | |
| 6. Decision Tree. | |
| ## π Analysis & Visualizations | |
| ### Pairplot_features_liked | |
|  | |
| ### Model_Accuracy_Comparison | |
|  | |
| ### Loudness_Distribution_by_Liked_Status | |
|  | |
| ### correlation_heatmap | |
|  | |
| ### Acousticness_vs_Danceability | |
|  | |
| ## π Key Findings | |
| ### π― **Primary Insights** | |
| 1. **Feature Distributions** | |
| - Most audio features follow approximately normal distributions | |
| - `valence` and `danceability` show interesting bimodal patterns | |
| - `tempo` exhibits a wide range with multiple peaks | |
| 2. **Correlation Patterns** | |
| - **Strong positive correlation** between `energy`, `valence`, and user preference (`liked`) | |
| - **Moderate correlation** between `danceability` and `liked` scores | |
| - **Weak correlation** for categorical features like `key` and `mode` | |
| 3. **User Preference Drivers** | |
| - Higher `danceability` β Higher user preference | |
| - Higher `valence` (positivity) β Better ratings | |
| - Optimal `energy` levels correlate with user satisfaction | |
| - `acousticness` shows inverse relationship with preferences | |
| ## π Results | |
| ### Model Performance Insights | |
| - Features most predictive of user preference: `energy`, `valence`, `danceability` | |
| - Optimal feature ranges for high user satisfaction identified | |
| - Recommendations for music recommendation system development | |
| ## π Technologies Used | |
| ### Core Libraries | |
| - **Data Manipulation:** `pandas`, `numpy` | |
| - **Visualization:** `matplotlib`, `seaborn`, `plotly` | |
| - **Statistical Analysis:** `scipy`, `statsmodels` | |
| - **Machine Learning:** `scikit-learn` | |
| ### Development Tools | |
| - **Environment:** Jupyter Lab/Notebook | |
| - **Version Control:** Git | |
| - **Package Management:** pip/conda | |
| - **Documentation:** Markdown | |