File size: 6,645 Bytes
93009a9 64cbf57 1bca6cc 64cbf57 1bca6cc 64cbf57 1bca6cc 64cbf57 1bca6cc 64cbf57 1bca6cc 64cbf57 93009a9 64cbf57 0b0218b 93009a9 0b0218b 93009a9 0b0218b 93009a9 0b0218b 93009a9 42ae8d8 0c0495b 0b0218b 93009a9 0b0218b 913afb0 79f1d62 913afb0 79f1d62 913afb0 79f1d62 913afb0 79f1d62 913afb0 79f1d62 913afb0 0b0218b 93009a9 0b0218b 93009a9 0b0218b 93009a9 0b0218b 93009a9 0b0218b 93009a9 0b0218b 93009a9 0b0218b 93009a9 0b0218b 93009a9 0b0218b 93009a9 0b0218b 93009a9 0b0218b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# π΅ 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
|