{"id":29128390,"url":"https://github.com/haekyu/mfrwr","last_synced_at":"2025-08-02T03:37:59.559Z","repository":{"id":233814364,"uuid":"124487573","full_name":"haekyu/MFRWR","owner":"haekyu","description":"A Comparative Study of Matrix Factorization and Random Walk with Restart","archived":false,"fork":false,"pushed_at":"2018-03-19T02:38:52.000Z","size":163,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-30T02:02:07.430Z","etag":null,"topics":["bigdata2017","matrix-factorization","random-walk-with-restart","recommender-system"],"latest_commit_sha":null,"homepage":"https://datalab.snu.ac.kr/mfrwr/","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/haekyu.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":"2018-03-09T04:26:54.000Z","updated_at":"2023-01-05T13:32:51.000Z","dependencies_parsed_at":"2024-04-17T11:56:35.687Z","dependency_job_id":"2134d029-5801-4c18-ac6d-8d07df22f62d","html_url":"https://github.com/haekyu/MFRWR","commit_stats":null,"previous_names":["haekyu/mfrwr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/haekyu/MFRWR","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haekyu%2FMFRWR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haekyu%2FMFRWR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haekyu%2FMFRWR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haekyu%2FMFRWR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haekyu","download_url":"https://codeload.github.com/haekyu/MFRWR/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haekyu%2FMFRWR/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268331242,"owners_count":24233212,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bigdata2017","matrix-factorization","random-walk-with-restart","recommender-system"],"created_at":"2025-06-30T02:00:45.053Z","updated_at":"2025-08-02T03:37:59.513Z","avatar_url":"https://github.com/haekyu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Readme of mfrwr codes (v1.0)\n\n\n## Contents\n\n1. Basic information\n2. Overview\n3. Requirements\n4. How to use\n\t1) Input and output\n\t2) How to run\n\t3) How to give parameters\n5. Demo example\n\n## 1. Basic information\n\n- Authors: [Haekyu Park](https://haekyu.github.io), [Jinhong Jung](https://datalab.snu.ac.kr/~jinhong/), and [U Kang](https://datalab.snu.ac.kr/~ukang/)\n- Program name: MFRWR\n- Version: 1.0\n- Last updated: 28 Aug 2017\n- Main contact: Haekyu Park (hkpark627@snu.ac.kr)\n\n## 2. Overview\n\nThis package is a set of implementaions of recommender systems based on matrix factorization and random walk with restart.\nThese methods are compared in each recommendation scenarios in the following paper: [**A comparative study of matrix factorization and random walk with restart in recommender system.**](https://datalab.snu.ac.kr/mfrwr/resources/mfrwr.pdf)\nWe suggest 4 matrix factorization methods and 4 random walk with restart methods for the following cases:\n- When explicit feedback ratings are given\n- When implicit feedback ratings are given\n- When bias terms are introduced\n- When side information is used\n\n## 3. Requirements\n\n- python 3.*\n- numpy\n- pandas\n- scipy\n- We recommend you to use [Anaconda](https://www.continuum.io/downloads).\n\n\n## 4. How to use\n1) Input and output\n- Input\n    - Ratings and side information are able to be given as input.\n    - All the input should be given as tab-separated files.\n        - Rating file should have three columns for user_id, item_id, and rating.\n        - User_id should not overlapped with item_id.\n        - Side information file should have two columns for user/item_id and value.\n    - The name of rating files should be 'rating.tsv'.\n- Output\n    - We print out Spearman's rho, precision@k, and recall@k with stdout.\n    - You may write log generator for the results for yourself.\n- Intermediate outputs\n    - We generate intermediate outputs such as vectors and biases of users and items.\n    - All the intermediate outputs have their file names under the rule: 'method name_dataset name_parameters_fold.txt'.\n        \n2) How to run\n- First go to `./code/`.\n- You can run the code by typing `python main.py`.\n- You can optionally give parameters with two approaches.\n\t* 1) By appending '--argument_type argument_value'.\n\tFor example, if you want to run matrix factorization with explicit ratings, and you want to set learning rate = 0.05, lambda = 0.3, and dimension = 5, \n\tyou can run the code as follows:\n\tpython main.py --method MF_exp --lr 0.05 --lamb 0.3 --dim 5\n\n\t* 2) By using config\n\tYou can make a configuration file that contains all the parameters you give.\n\tThen you can run the code by giving path of the config file as follows: \n\tpython main.py --config True --config_path ./myconfig.conf\n\tRules to make config files are as follows.\n\t\t- All parameters should be separated with '\\n'.\n\t\t- Argument type and its values for each parameters should be separated with ';'.\n\tFor example, a config file to run matrix factorization is as follows.\n\t\t```\n\t\tmethod;MF_exp\n\t\tdataset;filmtrust\n\t\tlr;0.05\n\t\tlamb;0.3\n\t\tdim;5\n\t\t```\n\nThe parameters you can give are as follows.\n\n| argument_type\t|\tdefault argument_value\t\t|\tdetails       \t\t\t|\n|---| ---| ---|\n|--dataset \t| filmtrust\t\t\t\t| Name of dataset\t\t\t|\n|--method \t| MF_exp\t\t\t\t| Name of method (*1)\t\t\t|\n|--data_path\t| '../data/'\t\t\t\t| Where datasets are\t\t\t|\n|--input_path\t| '../data/\u003cdataset\u003e/input/'\t\t| Where inputs are\t\t\t|\n|--result_path\t| '../results'\t\t\t\t| Where intermediate results are\t|\n|--side_paths\t| [\u003cinput_path\u003e/link.tsv]\t\t| List of paths of side info (*2)\t|\n|--entity_types\t| [['u', 'u']]\t\t\t\t| List of types of side info (*3)\t|\n|--config \t| False\t\t\t\t\t| Whether to give config file\t\t|\n|--config_path\t| '../config/democonfig.conf'\t\t| Path of config file\t\t\t|\n|--is_implicit\t| False\t\t\t\t\t| Whether implicit data are given\t|\n|--alpha\t| 0.001\t\t\t\t\t| Coefficient of confidence level in implicit feedback|\n|--is_social\t| False\t\t\t\t\t| Whether social links are used\t\t|\n|--lr \t\t| 0.05\t\t\t\t\t| Learning rate\t\t\t\t|\n|--lamb \t| 0.3\t\t\t\t\t| Regularization parameters\t\t|\n|--dim \t\t| 5\t\t\t\t\t| Dimension of vectors\t\t\t|\n|--is_sample\t| False\t\t\t\t\t| Wheter to sample seed users (*4) \t|\n|--num_seed\t| 300\t\t\t\t\t| # sampled seed users\t\t\t|\n|--c \t\t| 0.2\t\t\t\t\t| Probability of restart\t\t|\n|--beta\t\t| 0.4\t\t\t\t\t| Probability of walk in RWR_bias\t|\n|--gamma\t| 0.3\t\t\t\t\t| Probability of restart in RWR_bias\t|\n|--delta\t| 1.0\t\t\t\t\t| Weight of additional links in RWR_side| \n\n  \n\n- (*1) \n    - Name of methods can be one of the followings.\n\t- split5folds, MF_exp, MF_imp, MF_bias, MF_side, RWR_exp, RWR_imp, RWR_bias, RWR_side.\n\t- When 'split5folds' is given, you can split rating data into 5 folds.\n\tThe split should be done before running MF/RWR methods.\n\n- (*2)\n    - You can give file paths of side information with list.\n\t- This should be given by config file.\n\t- For example, if you want to give '../data/movielens/age.tsv' and '../data/movielens/gender.tsv' for side information, you can give --side_paths argument in the config file as follows.\n\t```\n\tside_paths;['../data/movielens/age.tsv', '../data/movielens/gender.tsv']\n\t```\n\n- (*3)\n    - You should declare types of entities in side information.\n\t- Each type can be one of the followings: 'u', 'i', and 's'.\n\t- 'u' indicates users, 'i' indicates items, and 's' indicates similarity attributes.\n\t- This should be given by config file.\n\t- For example, if you have '../data/movielens/age.tsv' and '../data/movielens/gender.tsv' which have first column for user id and second column for user attribute, a config file can be written as follows.\n\t```\n\tside_paths;['../data/movielens/age.tsv', '../data/movielens/gender.tsv']\n\tentity_types;[['u', 's'], ['u', 's']].\n\t```\n\n- (*4)\n    - You can sample seed users for RWR methods.\n\t- Sampling options are given because the methods take too much time if many users are included.\n\n\n\n## 5. Demo example\nYou can run MF_exp with filmtrust dataset.\nPlease run demo.sh by typing `./demo.sh`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaekyu%2Fmfrwr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaekyu%2Fmfrwr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaekyu%2Fmfrwr/lists"}