This project is a music recommender system that suggests songs based on similarity measures. The system uses a precomputed similarity matrix to find songs that are similar to a given track. The dataset includes information about users, artists, tracks, and playlists.
Due to GitHub's file size limits, these files are not fully visible on the GitHub repository. You can download the complete files by cloning the repository and accessing them locally.
- Recommends songs based on a given track.
- Uses a precomputed similarity matrix for fast recommendations.
- Handles missing values in the dataset.
To set up the recommender system on your local machine, follow these steps:
-
Clone the repository:
git clone https://github.com/nikithamarythomas/music_recommender.git cd music_recommnder
-
Install the required libraries:
pip install -r requirements.txt
-
Download the precomputed similarity matrix and data files:
similarity.pkl
: The similarity matrix.df.pkl
: The dataset with user, artist, track, and playlist information.
-
Load the data files in your script:
import pickle with open('similarity.pkl', 'rb') as file: similarity = pickle.load(file) with open('df.pkl', 'rb') as file: df = pickle.load(file)
Here is an example of how to use the recommender system:
import pickle
# Load the similarity matrix and data frame
with open('similarity.pkl', 'rb') as file:
similarity = pickle.load(file)
with open('df.pkl', 'rb') as file:
df = pickle.load(file)
# Function to recommend songs based on a given song
def recommendation(song_name):
idx = df[df['song'] == song_name].index[0]
distances = sorted(list(enumerate(similarity[idx])), reverse=True, key=lambda x: x[1])
recommended_songs = [df.iloc[i[0]]['song'] for i in distances[1:11]]
return recommended_songs
# Example usage
print(recommendation('Glee'))
Due to the file size limit on GitHub, the similarity.pkl is managed using Git Large File Storage (LFS). Make sure to install Git LFS and track the file with it. Here's how:
git lfs install
git lfs track "similarity.pkl"
This project is licensed under the MIT License - see the LICENSE file for details.