model_dataset / README.md
JigneshPrajapati18's picture
Upload README.md
a1ba80f verified

🎡 Music Feature Dataset Analysis

Python Pandas Scikit-learn 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

🟒 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

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.

  4. Support Vector Machine.

  5. Artificial Neural Network.

  6. Naive Bayes

  7. Decision Tree.

πŸ“ˆ Analysis & Visualizations

Pairplot_features_liked

Pairplot_features_liked

Model_Accuracy_Comparison

Model_Accuracy_Comparison

Loudness_Distribution_by_Liked_Status

Loudness_Distribution_by_Liked_Status

correlation_heatmap

correlation_heatmap

Acousticness_vs_Danceability

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