{"id":19574440,"url":"https://github.com/hongleizhang/rsalgorithms","last_synced_at":"2025-10-23T21:36:26.932Z","repository":{"id":42187425,"uuid":"102450903","full_name":"hongleizhang/RSAlgorithms","owner":"hongleizhang","description":"RSTutorials: A Curated List of Algorithms about Traditional and Social Recommender System.","archived":false,"fork":false,"pushed_at":"2024-04-05T14:10:37.000Z","size":5614,"stargazers_count":709,"open_issues_count":6,"forks_count":204,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-04-04T00:09:42.420Z","etag":null,"topics":["recommender-system","social-recommendation","traditional-recommendation"],"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/hongleizhang.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}},"created_at":"2017-09-05T07:49:34.000Z","updated_at":"2025-03-29T03:20:53.000Z","dependencies_parsed_at":"2024-04-05T15:28:22.993Z","dependency_job_id":"44ffe77b-ac03-4516-99a7-3dcd11a9a558","html_url":"https://github.com/hongleizhang/RSAlgorithms","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/hongleizhang%2FRSAlgorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongleizhang%2FRSAlgorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongleizhang%2FRSAlgorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hongleizhang%2FRSAlgorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hongleizhang","download_url":"https://codeload.github.com/hongleizhang/RSAlgorithms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631696,"owners_count":21136559,"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":["recommender-system","social-recommendation","traditional-recommendation"],"created_at":"2024-11-11T06:41:26.109Z","updated_at":"2025-10-23T21:36:26.846Z","avatar_url":"https://github.com/hongleizhang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Recommender System Suits： An open source toolkit for recommender system\n\nThis repository provides a set of classical **traditional recommendation methods** which make predictions only using rating data and **social recommendation methods** which utilize trust/social information in order to alleviate the sparsity of ratings data. Besides, we have collected some classical methods implemented by others for your convenience.\n\n## Traditional recommendation\n\n* **UserCF**[Resnick et al. 1994]\n\nResnick, Paul, et al. \"GroupLens: an open architecture for collaborative filtering of netnews.\" Proceedings of the 1994 ACM conference on Computer supported cooperative work. ACM, 1994.\n\n* **ItemCF**[Sarwar et al. 2001]\n\nSarwar, Badrul, et al. \"Item-based collaborative filtering recommendation algorithms.\" Proceedings of the 10th international conference on World Wide Web. ACM, 2001.\n\n* **FunkSVD**[Simon Funk. 2006]\n\nhttp://sifter.org/~simon/journal/20061211.html\n\n* **PMF**[Salakhutdinov. 2008]\n\nMnih, Andriy, and Ruslan R. Salakhutdinov. \"Probabilistic matrix factorization.\" Advances in neural information processing systems (2008): 1257-1264.\n\n* **IntegSVD**[Koren et al. 2008]\n\nKoren, Yehuda. \"Factorization meets the neighborhood: a multifaceted collaborative filtering model.\" Proceedings of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining. ACM, 2008.\n\n* **BiasSVD**[Koren et al. 2009]\n\nKoren, Yehuda, Robert Bell, and Chris Volinsky. \"Matrix factorization techniques for recommender systems.\" Computer 42.8 (2009).\n\n* **SVD++**[Koren et al. 2010]\n\nKoren, Yehuda. \"Factor in the neighbors: Scalable and accurate collaborative filtering.\" ACM Transactions on Knowledge Discovery from Data (TKDD) 4.1 (2010): 1.\n\n\n\n## Social recommendation\n* **SocialRec**[Ma et al. 2008]\n\nMa, Hao, et al. \"Sorec: social recommendation using probabilistic matrix factorization.\" Proceedings of the 17th ACM conference on Information and knowledge management. ACM, 2008.\n\n* **RSTE**[Ma et al. 2009]\n\nMa, Hao, Irwin King, and Michael R. Lyu. \"Learning to recommend with social trust ensemble.\" Proceedings of the 32nd international ACM SIGIR conference on Research and development in information retrieval. ACM, 2009.\n\n* **TrustWalker**[Jamali and Ester. 2009]\n\nJamali, Mohsen, and Martin Ester. \"Trustwalker: a random walk model for combining trust-based and item-based recommendation.\" Proceedings of the 15th ACM SIGKDD international conference on Knowledge discovery and data mining. ACM, 2009.\n\n* **SocialMF**[Jamali and Ester 2010]\n\nJamali, Mohsen, and Martin Ester. \"A matrix factorization technique with trust propagation for recommendation in social networks.\" Proceedings of the fourth ACM conference on Recommender systems. ACM, 2010.\n\n* **SocialReg**[Ma et al. 2011]\n\nMa, Hao, et al. \"Recommender systems with social regularization.\" Proceedings of the fourth ACM international conference on Web search and data mining. ACM, 2011.\n\n* **TrustSVD**[Guo et al. 2015]\n\nGuo, Guibing, Jie Zhang, and Neil Yorke-Smith. \"TrustSVD: Collaborative Filtering with Both the Explicit and Implicit Influence of User Trust and of Item Ratings.\" AAAI. Vol. 15. 2015.\n\n* **CUNE**[Zhang et al. 2017]\n\nChuxu Zhang, Lu Yu, Yan Wang, Chirag Shah, Xiangliang Zhang. \"Collaborative User Network Embedding for Social Recommender Systems.\" SDM, 2017.\n\n## RSAlgorithms implemented by Others\n\nSedhain et al. \"Autorec: Autoencoders meet collaborative filtering.\" WWW, 2015. [code](https://github.com/gtshs2/Autorec)\n\nKim et al. \"Convolutional matrix factorization for document context-aware recommendation.\" RecSys, 2016. [code](https://github.com/cartopy/ConvMF)\n\nLiang et al. \"Factorization meets the item embedding: Regularizing matrix factorization with item co-occurrence.\" RecSys, 2016. [code](https://github.com/dawenl/cofactor)\n\nHe et al. \"Fast matrix factorization for online recommendation with implicit feedback.\" SIGIR, 2016. [code](https://github.com/hexiangnan/sigir16-eals)\n\nQuadrana et al. \"Personalizing session-based recommendations with hierarchical recurrent neural networks.\" RecSys, 2017. [code](https://github.com/mquad/hgru4rec)\n\nHe et al. \"Neural collaborative filtering.\" WWW, 2017. [code](https://github.com/hexiangnan/neural_collaborative_filtering)\n\nEbesu et al. \"Collaborative Memory Network for Recommendation Systems.\" SIGIR, 2018. [code](https://github.com/tebesu/CollaborativeMemoryNetwork)\n\nFan et al. \"Graph Neural Networks for Social Recommendation.\" WWW, 2019. [code](https://github.com/Wang-Shuo/GraphRec_PyTorch)\n\nChong et al. \"Efﬁcient Heterogeneous Collaborative Filtering without Negative Sampling for Recommendation.\" AAAI, 2020. [code](https://github.com/chenchongthu/EHCF)\n\n\n## Requirements\n* numpy==1.14.2\n* scipy==1.0.1\n* pandas==0.22.0\n* matplotlib==2.2.2\n\n## Code Structure\n\nThe structure of our project is presented in a tree form as follows:\n\n```\nRecommender System  # the root of project\n│   README.md\n│   __init__.py\n│   .gitignore\n|\n└───configx  # configurate the global parameters and hyper parameters\n│   │   configx.py   \n|   │   \n└───data  # store the rating and social data\n│   │   ft_ratings.txt\n|   │   ft_trust.txt\n|   |\n│   └───cv  # cross validation data\n│       │   ft-0.txt\n│       │   ft-1.txt\n│       │   ft-2.txt\n│       │   ft-3.txt\n│       │   ft-4.txt\n|       |\n└───metrics  # the metrics to measure the prediction accuracy for rating prediction task\n│   │   metric.py\n|   |\n└───model  # the set of methods of tranditional and social recommendation\n│   │   bias_svd.py\n│   │   funk_svd.py\n│   │   pmf.py\n│   │   integ_svd.py\n|   |   item_cf.py\n|   |   item_cf_big.py\n|   |   mf.py\n|   |   social_mf.py\n|   |   social_rec.py\n|   |   social_reg.py\n|   |   social_rste.py\n|   |   svd++.py\n|   |   trust_svd.py\n|   |   trust_walker.py\n|   |   user_cf.py\n|   |\n└───reader  # data generator for rating and social data\n│   │   rating.py\n│   │   trust.py\n|   |\n└───utility  # other commonly used tools\n    │   cross_validation.py\n    │   data_prepro.py\n    │   data_statistics.py\n    │   draw_figure.py\n    │   matrix.py\n    │   similarity.py\n    │   tools.py\n    │   util.py\n```\n\n\n## Parameters Settings\nIf you want to change the default hyparameters, you can set it in `configx.py`. The meanings of the hyparameters is as follows:\n\n#### Dataset Parameters\n\n`dataset_name`: the short name of dataset, the default value is `ft`.\n\n`k_fold_num`: the num of cross validation, the default value is `5`.\n\n`rating_path `: the path of raw ratings data file, the default value is `../data/ft_ratings.txt`.\n\n`rating_cv_path`: the cross validation path of ratings data, the default value is `../data/cv/`.\n\n`trust_path`: the path of raw trust data file, the default value is `../data/ft_trust.txt`.\n\n`sep`: the separator of rating and trust data in triple tuple, the default value is ` `.\n\n`random_state`: the seed of random number, the default value is `0`.\n\n`size`: the ratio of train set, the default value is `0.8`.\n\n`min_val`: the minimum rating value, the default value is `0.5`.\n\n`max_val`: the maximum rating value, the default value is `4.0`.\n\n#### Model HyperParameters\n\n`coldUserRating`: the number of ratings a cold start user rated on items, the default value is `5`.\n\n`factor`: the size of latent dimension for user and item, the default value is `10`.\n\n`threshold`: the threshold value of model training, the default value is `1e-4`.\n\n`lr`: the learning rate, the default value is `0.01`.\n\n`maxIter`: the maximum number of iterations, the default value is `100`.\n\n`lambdaP`: the parameter of user regularizer, the default value is `0.001`.\n\n`lambdaQ`: the parameter of item regularizer, the default value is `0.001`.\n\n`gamma`: momentum coefficient, the default value is `0.9`.\n\n`isEarlyStopping`: early stopping flag, the default value is `false`.\n\n#### Output Parameters\n\n`result_path`: the main directory of results, the default value is `../results/`.\n\n`model_path`: the directory of well-trained variables, the default value is `../results/model/`.\n\n`result_log_path`: the directory of logs when training models, the default value is `../results/log/`.\n\n## Usage\n\nNext, I will take `pmf` as an example to introduce how to execute our code.\n\nFirst, we should split our rating data into several parts for training, testing and cross validation.\n```\nfrom utility.cross_validation import split_5_folds\nfrom configx.configx import ConfigX\n\nif __name__ == \"__main__\":\n    configx = ConfigX()\n    configx.k_fold_num = 5 \n    configx.rating_path = \"../data/ft_ratings.txt\"\n    configx.rating_cv_path = \"../data/cv/\"\n    \n    split_5_folds(configx)\n```\n\nNext, we open the `pmf.py` file in `model` folder, and configure the hyperparameters for training and execute the following code：\n\n```\nif __name__ == '__main__':\n\n    rmses = []\n    maes = []\n    bmf = FunkSVDwithR()\n    for i in range(bmf.config.k_fold_num):\n        bmf.train_model(i)\n        rmse, mae = bmf.predict_model()\n        print(\"current best rmse is %0.5f, mae is %0.5f\" % (rmse, mae))\n        rmses.append(rmse)\n        maes.append(mae)\n    rmse_avg = sum(rmses) / 5\n    mae_avg = sum(maes) / 5\n    print(\"the rmses are %s\" % rmses)\n    print(\"the maes are %s\" % maes)\n    print(\"the average of rmses is %s \" % rmse_avg)\n    print(\"the average of maes is %s \" % mae_avg)\n\n```\n\n## Citing\n\nPlease cite our paper if you use our codes. Thanks!\n\n    @inproceedings{pricai2018sotricf,\n        title=\"Social Collaborative Filtering Ensemble\",\n        author=\"Zhang, Honglei and Liu, Gangdu and Wu, Jun\",\n        booktitle=\"PRICAI\",\n        pages=\"1005--1017\"\n        year=\"2018\",\n    }\n\n    @inproceedings{ijcnn2019MFDGE,\n        title={Integrating dual user network embedding with matrix factorization for social recommender systems},\n        author={Chen, Liying and Zhang, Honglei and Wu, Jun},\n        booktitle={IJCNN},\n        pages={1--8},\n        year={2019},\n    }\n\n## RSPapers\n\nRecently, we have launched an open source project [**RSPapers**](https://github.com/hongleizhang/RSPapers), which includes some classical **Surveys**, **Classical Recommender System**, **Social Recommender System**, **Deep Learning based Recommender System**, **Cold Start Problem in Recommender System** and **POI Recommender System**. \n\n## Acknowledgements\n\nSpecially summerize the Traditional and Social recommendations for you, and if you have any questions, please contact me generously. Last but not least, I sincerely look forward to working with you to contribute it.\n\nGreatly thank @**yunzhan2014** for making contributions to it.\n\nMy Gmail: hongleizhang1993@gmail.com\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhongleizhang%2Frsalgorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhongleizhang%2Frsalgorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhongleizhang%2Frsalgorithms/lists"}