This project builds a music recommendation system using K-Means clustering to group songs with similar features and a distance-based recommendation algorithm to suggest songs based on a given track. The dataset consists of Spotify album and feature data from 2023.
With millions of songs available on streaming platforms, finding similar tracks can be challenging. This project applies machine learning techniques to analyze song features and recommend similar tracks.
-
Data Preprocessing:
- Merges Spotify album data with song feature data.
- Handles missing values and normalizes numeric features.
-
Clustering Songs:
- Uses K-Means clustering to group songs into clusters based on their audio features.
-
Song Recommendation System:
- Implements a distance-based recommendation algorithm.
- Finds and suggests similar songs based on a given track.
Ensure you have the following installed:
- Python 3.x
- NumPy
- Pandas
- Matplotlib & Seaborn (for visualization)
- Scikit-learn (for clustering & scaling)
- tqdm (for progress bars)
git clone https://github.com/your-username/spotify-recommendation-system.git
cd spotify-recommendation-systempip install -r requirements.txtjupyter notebook Spotify_rec.ipynb- Loads Spotify album data (
spotify-albums_data_2023.csv) and track feature data (spotify_features_data_2023.csv). - Merges the datasets on the
track_idcolumn. - Cleans missing values and normalizes numeric features using MinMaxScaler.
- Applies K-Means clustering to group songs into 35 clusters based on their feature similarity.
- Uses a custom distance function to find and suggest songs most similar to a given track.
- Example:
recommendations = Spotify_rec(df) recommendations.recommend("Lover", 13) # Recommends 13 similar songs
- Improve clustering by experimenting with more algorithms like Expectation Maximization.
- Enhance the recommendation model using additional feature engineering.
- Deploy the recommendation system using a web app (Streamlit)
This project is licensed under the MIT License. See the LICENSE file for details.