Skip to content

gugs881/Spotify-Music-Recommendation-System-with-Clustering-and-NLP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎧 Spotify Music Recommendation System with Clustering and NLP

This notebook implements a Spotify music recommendation system using both clustering algorithms and Natural Language Processing (NLP). The goal is to recommend similar songs based on audio features or the combination of track and artist names.


🎼 Dataset

  • Source: spotify-2023.csv
  • Includes features like:
    • track_name, artist(s)_name, streams
    • Audio features: bpm, danceability_%, valence_%, energy_%, acousticness_%, instrumentalness_%, liveness_%, speechiness_%

πŸ” Main Components

1. πŸ”§ Preprocessing

  • Missing values replaced with 0.
  • Audio features scaled using StandardScaler and MinMaxScaler.

2. 🎯 Clustering-Based Recommendation

  • Algorithm: KMeans (5 clusters)
  • Songs are clustered by audio similarity.
  • A cosine similarity matrix is calculated using normalized audio features.
  • A function recomendar_musicas suggests the most similar songs based on a given track.

3. 🧠 NLP-Based Recommendation

  • Combined track_name and artist(s)_name into a single string.
  • Applied TF-IDF vectorization with English stopwords.
  • Built a cosine similarity matrix from the TF-IDF vectors.
  • A second recommendation function recomendar_musicas_nlp finds similar songs based on name and artist semantics.

βœ… Results

Both recommendation systems return a list of 5 similar songs given an input track. They use:

  • 🎡 Clustering: based on musical attributes (numerical similarity)
  • 🧾 NLP: based on names and artist relationships (textual similarity)

πŸ“š Libraries Used

  • pandas, matplotlib, seaborn
  • sklearn: KMeans, TF-IDF, cosine similarity, scalers
  • scipy (indirectly via cosine_similarity)

πŸ’‘ Possible Improvements

  • Deploy with Streamlit for user interaction.
  • Combine both systems into a hybrid model.
  • Apply collaborative filtering based on user data (if available).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published