Speccco/Spotify-Songs-Mood-Predictor
0
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 (
epsandmin_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
- Clone the repository:
git clone https://github.com/yourusername/clustering-pca-visualization.git
cd clustering-pca-visualization- Create and activate a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`- Install the required dependencies:
pip install -r requirements.txt- Run the Streamlit app:
streamlit run app.pyThe 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
