# ๐ŸŽต Music Feature Dataset Analysis [![Python](https://img.shields.io/badge/Python-3.8%2B-blue)](https://www.python.org/) [![Pandas](https://img.shields.io/badge/Pandas-1.3%2B-green)](https://pandas.pydata.org/) [![Scikit-learn](https://img.shields.io/badge/Scikit--learn-1.0%2B-orange)](https://scikit-learn.org/) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](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 ![Total_Liked_and_Disliked_Songs](Total_Liked_and_Disliked_Songs.png) ## ๐ŸŸข 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 ![Pairplot_features_liked](Pairplot_features_liked.png) ### Model_Accuracy_Comparison ![Model_Accuracy_Comparison](Model_Accuracy_Comparison.png) ### Loudness_Distribution_by_Liked_Status ![Loudness_Distribution_by_Liked_Status](Loudness_Distribution_by_Liked_Status.png) ### correlation_heatmap ![correlation_heatmap](correlation_heatmap.png) ### Acousticness_vs_Danceability ![Acousticness_vs_Danceability](Acousticness_vs_Danceability.png) ## ๐Ÿ” 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