{"id":19693380,"url":"https://github.com/coder-yu/selfrec","last_synced_at":"2025-05-15T14:07:39.611Z","repository":{"id":39590791,"uuid":"406396123","full_name":"Coder-Yu/SELFRec","owner":"Coder-Yu","description":"An open-source framework for self-supervised recommender systems.","archived":false,"fork":false,"pushed_at":"2025-01-04T19:21:25.000Z","size":33607,"stargazers_count":574,"open_issues_count":0,"forks_count":81,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-15T14:07:27.480Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Coder-Yu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-14T14:15:59.000Z","updated_at":"2025-05-13T06:41:32.000Z","dependencies_parsed_at":"2025-01-18T20:52:57.567Z","dependency_job_id":null,"html_url":"https://github.com/Coder-Yu/SELFRec","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coder-Yu%2FSELFRec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coder-Yu%2FSELFRec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coder-Yu%2FSELFRec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coder-Yu%2FSELFRec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Coder-Yu","download_url":"https://codeload.github.com/Coder-Yu/SELFRec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355335,"owners_count":22057354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T19:16:40.927Z","updated_at":"2025-05-15T14:07:34.546Z","avatar_url":"https://github.com/Coder-Yu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://i.ibb.co/54vTYzk/ssl-logo.png\" alt=\"ssl-logo\" border=\"0\"\u003e\n\n\u003cp float=\"left\"\u003e\u003cimg src=\"https://img.shields.io/badge/python-v3.7+-red\"\u003e \u003cimg src=\"https://img.shields.io/badge/pytorch-v1.7+-blue\"\u003e \u003cimg src=\"https://img.shields.io/badge/tensorflow-v1.14+-green\"\u003e  \u003cbr\u003e\n\n**SELFRec** is a Python framework for self-supervised recommendation (SSR) which integrates commonly used datasets and metrics, and implements many state-of-the-art SSR models. SELFRec has a lightweight architecture and provides user-friendly interfaces. It can facilitate model implementation and evaluation.\n\u003cbr\u003e\n**Founder and principal contributor**: [@Coder-Yu ](https://github.com/Coder-Yu) [@xiaxin1998](https://github.com/xiaxin1998) \u003cbr\u003e\n\nThis repo is released with our [survey paper](https://arxiv.org/abs/2203.15876) on self-supervised learning for recommender systems. We organized a tutorial on self-supervised recommendation at WWW'22. Visit the [tutorial page](https://ssl-recsys.github.io/) for more information.\n\n**Supported by**:\u003cbr\u003e\nProf. Hongzhi Yin, The University of Queensland, Australia, h.yin1@uq.edu.au \u003cbr\u003e\nProf. Shazia Sadiq, ARC Training Centre for Information Resilience (CIRES), University of Queensland, Australia\n\n\u003ch2\u003eArchitecture\u003ch2\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Coder-Yu/SELFRec/main/selfrec.jpg\" alt=\"ssl-logo\" border=\"0\" style=\"width:600px\"\u003e\n\n\n\u003ch2\u003eFeatures\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cb\u003eFast execution\u003c/b\u003e: SELFRec is compatible with Python 3.9+, Tensorflow 1.14+ (optional), and PyTorch 1.8+ and powered by GPUs. We also optimize the time-consuming item ranking procedure, drastically reducing ranking time to seconds. \u003c/li\u003e\n\u003cli\u003e\u003cb\u003eEasy configuration\u003c/b\u003e: SELFRec provides simple and high-level interfaces, making it easy to add new SSR models in a plug-and-play fashion.\u003c/li\u003e\n\u003cli\u003e\u003cb\u003eHighly Modularized\u003c/b\u003e: SELFRec is divided into multiple discrete and independent modules. This design decouples model design from other procedures, allowing users to focus on the logic of their method and streamlining development.\u003c/li\u003e\n\u003cli\u003e\u003cb\u003eSSR-Specific\u003c/b\u003e:  SELFRec is designed specifically for SSR. It provides specific modules and interfaces for rapid development of data augmentation and self-supervised tasks.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch2\u003eHow to Use\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eExecute \u003cb\u003epip install -r requirements.txt\u003c/b\u003e under the SELFRec directory\u003c/li\u003e\n\u003cli\u003eConfigure the xx.yaml file in ./conf . (xx is the name of the model you want to run)\u003c/li\u003e\n\u003cli\u003eRun main.py and choose the model you want to run.\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003ch2\u003eImplemented Models\u003c/h2\u003e\n\n\u003ctable class=\"table table-hover table-bordered\"\u003e\n  \u003ctr\u003e\n\t\t\u003cth\u003eModel\u003c/th\u003e \t\t\u003cth\u003ePaper\u003c/th\u003e      \u003cth\u003eType\u003c/th\u003e   \u003cth\u003eCode\u003c/th\u003e\n   \u003c/tr\u003e\n   \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eSASRec\u003c/td\u003e\n        \u003ctd\u003eKang et al. \u003ca href=\"https://cseweb.ucsd.edu/~jmcauley/pdfs/icdm18.pdf\" target=\"_blank\"\u003eSelf-Attentive Sequential Recommendation\u003c/a\u003e, ICDM'18.\n         \u003c/td\u003e \u003ctd\u003eSequential\u003c/d\u003e \u003ctd\u003ePyTorch\u003c/d\u003e \n      \u003c/tr\u003e\n   \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eCL4SRec\u003c/td\u003e\n        \u003ctd\u003eXie et al. \u003ca href=\"https://arxiv.org/abs/2010.14395\" target=\"_blank\"\u003eContrastive Learning for Sequential Recommendation\u003c/a\u003e, ICDE'22.\n         \u003c/td\u003e \u003ctd\u003eSequential\u003c/d\u003e \u003ctd\u003ePyTorch\u003c/d\u003e \n      \u003c/tr\u003e\n   \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eBERT4Rec\u003c/td\u003e\n        \u003ctd\u003eSun et al. \u003ca href=\"https://dl.acm.org/doi/pdf/10.1145/3357384.3357895\" target=\"_blank\"\u003eBERT4Rec: Sequential Recommendation with Bidirectional Encoder Representations from Transformer\u003c/a\u003e, CIKM'19.\n         \u003c/td\u003e \u003ctd\u003eSequential\u003c/d\u003e \u003ctd\u003ePyTorch\u003c/d\u003e \n      \u003c/tr\u003e\n   \u003ctable\u003e\n\n\u003ctable class=\"table table-hover table-bordered\"\u003e\n  \u003ctr\u003e\n\t\t\u003cth\u003eModel\u003c/th\u003e \t\t\u003cth\u003ePaper\u003c/th\u003e      \u003cth\u003eType\u003c/th\u003e   \u003cth\u003eCode\u003c/th\u003e\n   \u003c/tr\u003e\n   \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eXSimGCL\u003c/td\u003e\n        \u003ctd\u003eYu et al. \u003ca href=\"https://arxiv.org/abs/2209.02544\" target=\"_blank\"\u003eXSimGCL: Towards Extremely Simple Graph Contrastive Learning for Recommendation\u003c/a\u003e, TKDE'23.\n         \u003c/td\u003e \u003ctd\u003eGraph + CL\u003c/d\u003e \u003ctd\u003ePyTorch\u003c/d\u003e \n      \u003c/tr\u003e\n   \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eSimGCL\u003c/td\u003e\n        \u003ctd\u003eYu et al. \u003ca href=\"https://arxiv.org/abs/2112.08679\" target=\"_blank\"\u003eAre Graph Augmentations Necessary? Simple Graph Contrastive Learning for Recommendation\u003c/a\u003e, SIGIR'22.\n         \u003c/td\u003e \u003ctd\u003eGraph + CL\u003c/d\u003e \u003ctd\u003ePyTorch\u003c/d\u003e \n      \u003c/tr\u003e\n   \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eDirectAU\u003c/td\u003e\n        \u003ctd\u003eWang et al. \u003ca href=\"https://arxiv.org/abs/2206.12811\" target=\"_blank\"\u003eTowards Representation Alignment and Uniformity in Collaborative Filtering\u003c/a\u003e, KDD'22.\n         \u003c/td\u003e \u003ctd\u003eGraph\u003c/d\u003e \u003ctd\u003ePyTorch\u003c/d\u003e \n      \u003c/tr\u003e   \n\u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eNCL\u003c/td\u003e\n        \u003ctd\u003eLin et al. \u003ca href=\"https://arxiv.org/abs/2202.06200\" target=\"_blank\"\u003eImproving Graph Collaborative Filtering with Neighborhood-enriched Contrastive Learning\u003c/a\u003e, WWW'22.\n         \u003c/td\u003e \u003ctd\u003eGraph + CL\u003c/d\u003e \u003ctd\u003ePyTorch\u003c/d\u003e \n      \u003c/tr\u003e\n   \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eMixGCF\u003c/td\u003e\n        \u003ctd\u003eHuang et al. \u003ca href=\"https://keg.cs.tsinghua.edu.cn/jietang/publications/KDD21-Huang-et-al-MixGCF.pdf\" target=\"_blank\"\u003eMixGCF: An Improved Training Method for Graph Neural\nNetwork-based Recommender Systems\u003c/a\u003e, KDD'21.\n         \u003c/td\u003e \u003ctd\u003eGraph + DA\u003c/d\u003e \u003ctd\u003ePyTorch\u003c/d\u003e \n      \u003c/tr\u003e\n     \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eMHCN\u003c/td\u003e\n        \u003ctd\u003eYu et al. \u003ca href=\"https://dl.acm.org/doi/abs/10.1145/3442381.3449844\" target=\"_blank\"\u003eSelf-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation\u003c/a\u003e, WWW'21.\n         \u003c/td\u003e \u003ctd\u003eGraph + CL\u003c/d\u003e \u003ctd\u003eTensorFlow\u003c/d\u003e\n      \u003c/tr\u003e\n     \u003ctr\u003e\t\n    \u003ctd scope=\"row\"\u003eSGL\u003c/td\u003e\n        \u003ctd\u003eWu et al. \u003ca href=\"https://dl.acm.org/doi/10.1145/3404835.3462862\" target=\"_blank\"\u003eSelf-supervised Graph Learning for Recommendation\u003c/a\u003e, SIGIR'21.\n         \u003c/td\u003e \u003ctd\u003eGraph + CL\u003c/d\u003e \u003ctd\u003eTensorFlow \u0026 Torch\u003c/d\u003e \n      \u003c/tr\u003e\n    \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eSEPT\u003c/td\u003e\n        \u003ctd\u003eYu et al. \u003ca href=\"https://arxiv.org/abs/2106.03569\" target=\"_blank\"\u003eSocially-Aware Self-supervised Tri-Training for Recommendation\u003c/a\u003e, KDD'21.\n         \u003c/td\u003e \u003ctd\u003eGraph + CL\u003c/d\u003e \u003ctd\u003eTensorFlow\u003c/d\u003e \n      \u003c/tr\u003e\n          \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eBUIR\u003c/td\u003e\n        \u003ctd\u003eLee et al. \u003ca href=\"https://arxiv.org/abs/2105.06323\" target=\"_blank\"\u003eBootstrapping User and Item Representations for One-Class Collaborative Filtering\u003c/a\u003e, SIGIR'21.\n         \u003c/td\u003e \u003ctd\u003eGraph + DA\u003c/d\u003e \u003ctd\u003ePyTorch\u003c/d\u003e\n      \u003c/tr\u003e\n        \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eSSL4Rec\u003c/td\u003e\n        \u003ctd\u003eYao et al. \u003ca href=\"https://dl.acm.org/doi/abs/10.1145/3459637.3481952\" target=\"_blank\"\u003eSelf-supervised Learning for Large-scale Item Recommendations\u003c/a\u003e, CIKM'21.\n\t     \u003c/td\u003e \u003ctd\u003eGraph + CL\u003c/d\u003e  \u003ctd\u003ePyTorch\u003c/d\u003e\n      \u003c/tr\u003e\n    \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eSelfCF\u003c/td\u003e\n        \u003ctd\u003eZhou et al. \u003ca href=\"https://arxiv.org/abs/2107.03019\" target=\"_blank\"\u003eSelfCF: A Simple Framework for Self-supervised Collaborative Filtering\u003c/a\u003e, arXiv'21.\n         \u003c/td\u003e \u003ctd\u003eGraph + DA\u003c/d\u003e \u003ctd\u003ePyTorch\u003c/d\u003e\n      \u003c/tr\u003e\n    \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eLightGCN\u003c/td\u003e\n        \u003ctd\u003eHe et al. \u003ca href=\"https://dl.acm.org/doi/10.1145/3397271.3401063\" target=\"_blank\"\u003eLightGCN: Simplifying and Powering Graph Convolution Network for Recommendation\u003c/a\u003e, SIGIR'20.\n\t     \u003c/td\u003e \u003ctd\u003eGraph\u003c/d\u003e  \u003ctd\u003ePyTorch\u003c/d\u003e\n      \u003c/tr\u003e\n         \u003ctr\u003e\n    \u003ctd scope=\"row\"\u003eMF\u003c/td\u003e\n        \u003ctd\u003eYehuda et al. \u003ca href=\"https://ieeexplore.ieee.org/abstract/document/5197422\" target=\"_blank\"\u003eMatrix Factorization Techniques for Recommender Systems\u003c/a\u003e, IEEE Computer'09.\n\t     \u003c/td\u003e \u003ctd\u003eGraph\u003c/d\u003e  \u003ctd\u003ePyTorch\u003c/d\u003e \n      \u003c/tr\u003e\n  \u003c/table\u003e  \n* CL is short for contrastive learning (including data augmentation); DA is short for data augmentation only\n\n\u003ch2\u003eLeaderboard\u003c/h2\u003e\nThe results are obtained on the dataset of \u003cb\u003eYelp2018\u003c/b\u003e. We performed grid search for the best hyperparameters. \u003cbr\u003e\nGeneral hyperparameter settings are: batch_size: 2048, emb_size: 64, learning rate: 0.001, L2 reg: 0.0001. \u003cbr\u003e\u003cbr\u003e\n\n\n|  Model   |      Recall@20      | NDCG@20 | Hyperparameter settings                                                                             |\n|:--------:|:-------------------:|:-------:|:----------------------------------------------------------------------------------------------------|\n|   MF    |       0.0543        | 0.0445  |          |\n|   LightGCN    |       0.0639        | 0.0525  |     layer=3     |\n|   NCL    |       0.0670        | 0.0562  | layer=3, ssl_reg=1e-6, proto_reg=1e-7, tau=0.05, hyper_layers=1, alpha=1.5, num_clusters=2000 |\n|   SGL    |       0.0675        | 0.0555  |     λ=0.1, ρ=0.1, tau=0.2 layer=3     |\n|  MixGCF  |       0.0691        | 0.0577  |      layer=3, n_nes=64, layer=3       |\n| DirectAU |       0.0695        | 0.0583  |             𝛾=2, layer=3             |\n|  SimGCL  |       0.0721        | 0.0601  |   λ=0.5, eps=0.1, tau=0.2, layer=3    |\n| XSimGCL  |       0.0723        | 0.0604  | λ=0.2, eps=0.2, l∗=1 tau=0.15 layer=3 |\n\n\u003ch2\u003eImplement Your Model\u003c/h2\u003e\n \n1. Create a **.yaml** file for your model in the directory named conf.\n2. Make your model **inherit** the proper base class.\n3. **Reimplement** the following functions.\n\t+ *build*(), *train*(), *save*(), *predict*()\n4. Register your model in **main.py**.\n\n\n\n\u003ch2\u003eRelated Datasets\u003c/h2\u003e\n\u003cdiv\u003e\n \u003ctable class=\"table table-hover table-bordered\"\u003e\n  \u003ctr\u003e\n    \u003cth rowspan=\"2\" scope=\"col\"\u003eData Set\u003c/th\u003e\n    \u003cth colspan=\"5\" scope=\"col\" class=\"text-center\"\u003eBasic Meta\u003c/th\u003e\n    \u003cth colspan=\"3\" scope=\"col\" class=\"text-center\"\u003eUser Context\u003c/th\u003e \n    \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth class=\"text-center\"\u003eUsers\u003c/th\u003e\n    \u003cth class=\"text-center\"\u003eItems\u003c/th\u003e\n    \u003cth colspan=\"2\" class=\"text-center\"\u003eRatings (Scale)\u003c/th\u003e\n    \u003cth class=\"text-center\"\u003eDensity\u003c/th\u003e\n    \u003cth class=\"text-center\"\u003eUsers\u003c/th\u003e\n    \u003cth colspan=\"2\" class=\"text-center\"\u003eLinks (Type)\u003c/th\u003e\n    \u003c/tr\u003e   \n   \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://pan.baidu.com/s/1hrJP6rq\" target=\"_blank\"\u003e\u003cb\u003eDouban\u003c/b\u003e\u003c/a\u003e \u003c/td\u003e\n    \u003ctd\u003e2,848\u003c/td\u003e\n    \u003ctd\u003e39,586\u003c/td\u003e\n    \u003ctd width=\"6%\"\u003e894,887\u003c/td\u003e\n    \u003ctd width=\"10%\"\u003e[1, 5]\u003c/td\u003e\n    \u003ctd\u003e0.794%\u003c/td\u003e\n    \u003ctd width=\"4%\"\u003e2,848\u003c/td\u003e\n    \u003ctd width=\"5%\"\u003e35,770\u003c/td\u003e\n    \u003ctd\u003eTrust\u003c/td\u003e\n    \u003c/tr\u003e \n\t \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"http://files.grouplens.org/datasets/hetrec2011/hetrec2011-lastfm-2k.zip\" target=\"_blank\"\u003e\u003cb\u003eLastFM\u003c/b\u003e\u003c/a\u003e \u003c/td\u003e\n    \u003ctd\u003e1,892\u003c/td\u003e\n    \u003ctd\u003e17,632\u003c/td\u003e\n    \u003ctd width=\"6%\"\u003e92,834\u003c/td\u003e\n    \u003ctd width=\"10%\"\u003eimplicit\u003c/td\u003e\n    \u003ctd\u003e0.27%\u003c/td\u003e\n    \u003ctd width=\"4%\"\u003e1,892\u003c/td\u003e\n    \u003ctd width=\"5%\"\u003e25,434\u003c/td\u003e\n    \u003ctd\u003eTrust\u003c/td\u003e\n    \u003c/tr\u003e \n    \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://www.dropbox.com/sh/h97ymblxt80txq5/AABfSLXcTu0Beib4r8P5I5sNa?dl=0\" target=\"_blank\"\u003e\u003cb\u003eYelp\u003c/b\u003e\u003c/a\u003e \u003c/td\u003e\n    \u003ctd\u003e19,539\u003c/td\u003e\n    \u003ctd\u003e21,266\u003c/td\u003e\n    \u003ctd width=\"6%\"\u003e450,884\u003c/td\u003e\n    \u003ctd width=\"10%\"\u003eimplicit\u003c/td\u003e\n    \u003ctd\u003e0.11%\u003c/td\u003e\n    \u003ctd width=\"4%\"\u003e19,539\u003c/td\u003e\n    \u003ctd width=\"5%\"\u003e864,157\u003c/td\u003e\n    \u003ctd\u003eTrust\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://www.dropbox.com/sh/20l0xdjuw0b3lo8/AABBZbRg9hHiN42EHqBSvLpta?dl=0\" target=\"_blank\"\u003e\u003cb\u003eAmazon-Book\u003c/b\u003e\u003c/a\u003e \u003c/td\u003e\n    \u003ctd\u003e52,463\u003c/td\u003e\n    \u003ctd\u003e91,599\u003c/td\u003e\n    \u003ctd width=\"6%\"\u003e2,984,108\u003c/td\u003e\n    \u003ctd width=\"10%\"\u003eimplicit\u003c/td\u003e\n    \u003ctd\u003e0.11%\u003c/td\u003e\n    \u003ctd width=\"4%\"\u003e-\u003c/td\u003e\n    \u003ctd width=\"5%\"\u003e-\u003c/td\u003e\n    \u003ctd\u003e-\u003c/td\u003e\n    \u003c/tr\u003e  \n  \u003c/table\u003e\n\u003c/div\u003e\n\n\n\u003ch2\u003eReference\u003c/h2\u003e\nIf you find this repo helpful to your research, please cite our paper.\n\u003cp\u003e\u003c/p\u003e \n\n```\n@article{yu2023self,\n  title={Self-supervised learning for recommender systems: A survey},\n  author={Yu, Junliang and Yin, Hongzhi and Xia, Xin and Chen, Tong and Li, Jundong and Huang, Zi},\n  journal={IEEE Transactions on Knowledge and Data Engineering},\n  year={2023},\n  publisher={IEEE}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder-yu%2Fselfrec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoder-yu%2Fselfrec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder-yu%2Fselfrec/lists"}