GitPedia

BPR pytorch

A pytorch implementation for BPR (Bayesian Personalized Ranking).

From guoyang9·Updated April 7, 2026·View on GitHub·

Note that I use the two sub datasets provided by Xiangnan's [repo](https://github.com/hexiangnan/neural_collaborative_filtering/tree/master/Data). Another pytorch NCF implementaion can be found at this [repo](https://github.com/guoyang9/NCF). The project is written primarily in Python, first published in 2019. Key topics include: bayesian-personalized-ranking, bpr, pytorch, recommender-system.

Pytorch-BPR

Note that I use the two sub datasets provided by Xiangnan's repo. Another pytorch NCF implementaion can be found at this repo.

I utilized a factor number 32, and posted the results in the NCF paper and this implementation here. Since there is no specific numbers in their paper, I found this implementation achieved a better performance than the original curve. Moreover, the batch_size is not very sensitive with the final model performance.

ModelsMovieLens HR@10MovieLens NDCG@10Pinterest HR@10Pinterest NDCG@10
pytorch-BPR0.7000.4180.8770.551

The requirements are as follows:

* python==3.6
* pandas==0.24.2
* numpy==1.16.2
* pytorch==1.0.1
* tensorboardX==1.6 (mainly useful when you want to visulize the loss, see https://github.com/lanpa/tensorboard-pytorch)

Example to run:

python main.py --factor_num=16 --lamda=0.001

Contributors

Showing top 1 contributor by commit count.

View all contributors on GitHub →

This article is auto-generated from guoyang9/BPR-pytorch via the GitHub API.Last fetched: 6/19/2026