Downloads · 30 days
0
imrankhan11/music-repeat-listen-predictor
music-repeat-listen-predictor is a machine learning model from imrankhan11. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Binary classification project that predicts whether a user will replay a song within 30 days, then uses that model to rank personalized song recommendations.
Downloads · 30 days
0
Access
Public
Updated Jul 27, 2026
Repo size
54.8 MB
Likes
0
Public
Click a slice to open those files.
.csv56.8 MB · 100%
From the Hugging Face model README
Binary classification project that predicts whether a user will replay a song within 30 days, then uses that model to rank personalized song recommendations.
For each (user, song) interaction, predict:
1 → user replays the song within 30 days0 → user does not replay itmusic-recsys/
├── data/
│ ├── raw/ # raw listening logs (csv/json) go here
│ └── processed/ # cleaned + feature-engineered data
├── model/ # saved trained model (.pkl / .joblib)
├── notebooks/
│ └── notebook.ipynb # full EDA -> model -> evaluation walkthrough
├── src/
│ ├── make_sample_data.py # generates a synthetic dataset for testing
│ ├── data_prep.py # cleaning + label generation
│ ├── features.py # feature engineering
│ ├── train.py # train baseline + tuned model
│ ├── evaluate.py # metrics: F1, ROC-AUC, Precision@K
│ ├── recommend.py # top-N recommendation generator
│ └── inference.py # load model, score new interactions
├── requirements.txt
└── README.md
pip install -r requirements.txt
# 1. Generate a synthetic sample dataset (swap for a real dataset later,
# e.g. Spotify Million Playlist Dataset, Last.fm, or a Kaggle dataset)
python src/make_sample_data.py
# 2. Clean data + generate labels
python src/data_prep.py
# 3. Engineer features
python src/features.py
# 4. Train model
python src/train.py
# 5. Evaluate
python src/evaluate.py
# 6. Generate top-N recommendations for a user
python src/recommend.py --user_id U001 --top_n 5
Replace the file at data/raw/listening_history.csv with your real dataset.
Required columns:
user_id, song_id, timestampgenre, tempo, danceability (song-level features)The rest of the pipeline (data_prep.py onward) works unchanged as long as
these columns are present.
Fill in after training: Accuracy / Precision / Recall / F1 / ROC-AUC / Precision@K
Python, pandas, numpy, scikit-learn, xgboost, matplotlib/seaborn, joblib, Google Colab, GitHub, Hugging Face Hub (+ optional Gradio demo).
This folder is already a git repo with an initial commit. To push it:
# 1. Create a new empty repo on github.com (no README/license, so it stays empty)
# 2. Then:
cd music-recsys
git remote add origin https://github.com/<your-username>/music-recsys.git
git branch -M main
git push -u origin main
The huggingface/ folder is a ready-to-upload model repo (model card +
optional Gradio demo).
pip install huggingface_hub
huggingface-cli login
# Create the model repo and upload model files
huggingface-cli repo create music-repeat-listen-predictor --type model
cp model/model.joblib model/feature_columns.json huggingface/
cd huggingface
git init -q
huggingface-cli upload <your-username>/music-repeat-listen-predictor . .
To also deploy the interactive demo, create a Space (type: space, SDK:
gradio), and upload app.py + requirements.txt from huggingface/
along with the model files — the Space will auto-launch app.py.