CoolFace
Apppublic

Speccco/Spotify-Songs-Mood-Predictor

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

Clustering and PCA Visualization for Song Data

๐Ÿ“ Project Description

This project applies clustering algorithms (K-Means and DBSCAN) to analyze song data and visualize the results using Principal Component Analysis (PCA). The aim is to identify patterns in the data and explore how clustering can help reveal hidden structures or trends in song features.

The insights from this analysis can help:

  • โ€”Identify patterns and similarities between songs based on their features.
  • โ€”Visualize how songs are grouped according to clustering results.
  • โ€”Support data-driven recommendations in music recommendation systems.
  • โ€”Explore clustering behavior with different algorithms (K-Means and DBSCAN).

๐Ÿ” Dataset

The dataset contains features for various songs, including:

  • โ€”Audio Features: Tempo, loudness, duration, etc.
  • โ€”Song Metadata: Genre, artist, album, etc.
  • โ€”Accident details: Used for clustering analysis and feature evaluation.

You can upload your own dataset for clustering analysis using the interactive Streamlit app.

๐Ÿš€ Features

  • โ€”K-Means Clustering:
  • โ€”Visualize the Elbow Method to find the optimal number of clusters.
  • โ€”Interactive 2D PCA visualization of the K-Means clustering results.
  • โ€”DBSCAN Clustering:
  • โ€”Visualize the 2D PCA-reduced clusters with DBSCAN.
  • โ€”Adjustable parameters for DBSCAN (eps and min_samples).
  • โ€”Interactive Visualizations:
  • โ€”Use Plotly Express for responsive, interactive scatter plots.
  • โ€”Feature Analysis:
  • โ€”Understand how the different features contribute to the clustering analysis.

๐Ÿ› ๏ธ Installation & Setup

  1. 1.Clone the repository:
bash
   git clone https://github.com/yourusername/clustering-pca-visualization.git
   cd clustering-pca-visualization
  1. 1.Create and activate a virtual environment (optional but recommended):
bash
   python -m venv venv
   source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  1. 1.Install the required dependencies:
bash
   pip install -r requirements.txt
  1. 1.Run the Streamlit app:
bash
   streamlit run app.py

The app should now be accessible in your browser at http://localhost:8501.

๐Ÿ”ง Technologies Used

  • โ€”Data Processing: Pandas, NumPy
  • โ€”Visualization: Plotly Express
  • โ€”Machine Learning: Scikit-learn (K-Means, DBSCAN, PCA)
  • โ€”Web Application: Streamlit
  • โ€”Other Tools: Python

๐Ÿ“ Project Structure

clustering-pca-visualization/
โ”œโ”€โ”€ app.py                                 # Streamlit application
โ”œโ”€โ”€ data/                                  # Folder for dataset
โ”‚   โ”œโ”€โ”€ song_features.csv                  # Dataset for clustering
โ”œโ”€โ”€ requirements.txt                       # Dependencies
โ”œโ”€โ”€ README.md                              # Project documentation
โ””โ”€โ”€ assets/                                # Folder for images or static files
    โ””โ”€โ”€ screenshot.png                     # Screenshot for the README

๐Ÿ”ฎ Future Improvements

  • โ€”Experiment with additional clustering algorithms (e.g., Agglomerative Clustering, Spectral Clustering).
  • โ€”Add more interactive visualizations to further analyze clustering behavior.
  • โ€”Implement more advanced dimensionality reduction techniques (e.g., t-SNE, UMAP).
  • โ€”Add additional features to the dataset to improve clustering analysis (e.g., audio fingerprinting, sentiment analysis).

๐Ÿ‘ฅ Contributors

  • โ€”Spector