Skip to content

CrawlScript/InfoBPR

Repository files navigation

InfoBPR

Simple Yet Powerful Ranking Loss

We provide InfoBPR API for both TensorFlow and PyTorch.

Paper: MGDCF: Distance Learning via Markov Graph Diffusion for Neural Collaborative Filtering

Homepage and Paper

Performance

MF (Matrix Factorization) can beat state-of-the-art GNN-based CF approaches with our InfoBPR Loss (MF-InfoBPR).

NDCG@20 of different approaches on Yelp2018

InfoBPR also can improve the optimization of CF models.

Installation

pip install info_bpr

Note that the installed info_bpr library support both TensorFlow and PyTorch.

Usage

For PyTorch users:

# coding=utf-8
import os
import torch
from info_bpr.losses import th_info_bpr as info_bpr

os.environ["CUDA_VISIBLE_DEVICES"] = "0"

num_users = 5
num_items = 5
embedding_size = 64
user_embeddings = torch.randn(num_users, embedding_size).cuda()
item_embeddings = torch.randn(num_items, embedding_size).cuda()
user_item_edges = [
    [0, 1],
    [0, 2],
    [2, 4],
    [3, 4]
]

ranking_loss = info_bpr(user_embeddings, item_embeddings, user_item_edges, num_negs=300)
print("InfoBPR Loss: ", ranking_loss)

DEMO

Matrix Factorization with InfoBPR Loss (MF-InfoBPR)

Cite

If you use InfoBPR in a scientific publication, we would appreciate citations to the following paper:

@misc{https://doi.org/10.48550/arxiv.2204.02338, doi = {10.48550/ARXIV.2204.02338},

url = {https://arxiv.org/abs/2204.02338},

author = {Hu, Jun and Qian, Shengsheng and Fang, Quan and Xu, Changsheng},

keywords = {Social and Information Networks (cs.SI), Machine Learning (cs.LG), FOS: Computer and information sciences, FOS: Computer and information sciences},

title = {MGDCF: Distance Learning via Markov Graph Diffusion for Neural Collaborative Filtering},

publisher = {arXiv},

year = {2022},

copyright = {arXiv.org perpetual, non-exclusive license} }

About

Simple Yet Powerful Ranking Loss

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published