{"id":13782089,"url":"https://github.com/YingtongDou/Nash-Detect","last_synced_at":"2025-05-11T15:32:12.488Z","repository":{"id":128436751,"uuid":"266555315","full_name":"YingtongDou/Nash-Detect","owner":"YingtongDou","description":"Code for KDD 2020 paper Robust Spammer Detection by Nash Reinforcement Learning","archived":false,"fork":false,"pushed_at":"2020-11-17T23:54:42.000Z","size":853,"stargazers_count":121,"open_issues_count":0,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-14T13:59:53.473Z","etag":null,"topics":["fraud-detection","game-theory","machine-learning","reinforcement-learning","security","spam-detection"],"latest_commit_sha":null,"homepage":"http://arxiv.org/abs/2006.06069","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YingtongDou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-24T14:14:33.000Z","updated_at":"2025-03-26T10:13:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"ecdbe328-d478-4765-911d-c470fa311a3a","html_url":"https://github.com/YingtongDou/Nash-Detect","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/YingtongDou%2FNash-Detect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YingtongDou%2FNash-Detect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YingtongDou%2FNash-Detect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YingtongDou%2FNash-Detect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YingtongDou","download_url":"https://codeload.github.com/YingtongDou/Nash-Detect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253588649,"owners_count":21932293,"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":["fraud-detection","game-theory","machine-learning","reinforcement-learning","security","spam-detection"],"created_at":"2024-08-03T18:01:32.719Z","updated_at":"2025-05-11T15:32:11.292Z","avatar_url":"https://github.com/YingtongDou.png","language":"Python","funding_links":[],"categories":["2020","时间序列"],"sub_categories":["网络服务_其他"],"readme":"# Nash-Detect\n\nCode for KDD 2020 paper **Robust Spammer Detection by Nash Reinforcement Learning**.  \n[Yingtong Dou](http://ytongdou.com/), [Guixiang Ma](https://scholar.google.com/citations?user=CbKihaUAAAAJ\u0026hl=en), [Philip S. Yu](https://www.cs.uic.edu/PSYu/), [Sihong Xie](http://www.cse.lehigh.edu/~sxie/).  \n\\[[Paper](http://arxiv.org/abs/2006.06069)\\]\\[[Slides](http://ytongdou.com/files/kdd20slides.pdf)\\]\\[[Video](https://youtu.be/Pa13fabSGVw)\\]\\[[Toolbox](https://github.com/safe-graph/UGFraud)\\]\\[[Chinese Blog](https://mp.weixin.qq.com/s?__biz=MzU1Mjc5NTg5OQ==\u0026mid=2247485268\u0026idx=1\u0026sn=451d137496829d1405c28808ec0bb0b2\u0026chksm=fbfdecc0cc8a65d651600a437043cbb5483bfa16e35c3b1cb3ca60d7ac47e64a3bdd514e357f\u0026token=1158859151\u0026lang=zh_CN#rd)\\]\n\n## Overview\n\n\u003cp align=\"center\"\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://github.com/YingtongDou/Nash-Detect\"\u003e\n        \u003cimg src=\"https://github.com/YingtongDou/Nash-Detect/blob/master/overview.png\" width=\"600\"/\u003e\n    \u003c/a\u003e\n    \u003cbr\u003e\n\u003cp\u003e\n\n**Nash-Detect** is an algorithm proposed by the above paper to train a robust spam review detector using reinforcement learning. The robust detector is composed of five base detectors and is trained through playing a minimax game between the spammer and the defender. There are five base spamming strategies used by the spammer to synthesize the mixed spamming strategy.\n\nThis repo includes the spamming attack implementation and generation code, the detector implementation code, and the training \u0026 testing code for Nash-Detect and all baselines. \n\nNote that we only investigate the shallow graph and behavior-based spam detectors in this paper; there is no text or deep neural network involved. Nonetheless, there is no hurdle to apply Nash-Detect to train robust neural networks or text-based spam detectors.\n\n## Setup\n\nTo run the code, you need the [Yelp Spam Review Datasets](http://odds.cs.stonybrook.edu/yelpchi-dataset/). Please send email with the title `Yelp Dataset Request` to [ytongdou@gmail.com](mailto:ytongdou@gmail.com) to download the file with metadata and ground truth. You can unzip the dataset file under the root directory of the project.\n\nYou can download the project and install required packages using following commands:\n\n```bash\ngit clone https://github.com/YingtongDou/Nash-Detect.git\ncd Nash-Detect\npip3 install -r requirements.txt\n```\n\nTo run the code, you need to have **Python 3.6** or later version. \n\n## Running\n\n1. Run `attack_generation.py` with `mode = \"Training\"` to generate fake reviews for training\n2. Run `worst_case.py` to compute the worst-case performance of single attacks vs. single detectors\n3. Run `training.py` to train a robust detector configuration using Nash-Detect\n4. Run `attack_generation.py` with `mode = \"Testing\"` to generate fake reviews for testing\n5. Run `testing.py` to test the performance of the optimal detector trained by Nash-Detect and other baselines\n\nTo facilitate the training and testing, we have stored all generated fake reviews in directories `/Training` and `/Testing`. So you can skip Steps 1 and 4 to play the game and evaluation code directly. Moreover, you can play each single detector using the `eval_XXX.py` under the `/Detector` repository or using our [UGFraud](https://github.com/safe-graph/UGFraud) toolbox.\n\nThe experimental settings and model parameters can be found at the beginning of the `main` functions of `training.py` and `testing.py`.\n\n### Repo Structure\nThe repository is organized as follows:\n- `Attack/` contains the implementations of four spamming attack strategies, the `Singleton` attack is implemented in `attack_generation.py`;\n- `Detector/` contains the implementations and evaluations of five spam detectors;\n- `Testing/` contains generated fake reviews for testing;\n- `Training/` contains generated fake reviews for training;\n- `Utils/` contains:\n    * functions for loading graphs/features from dataset/manifest files  (`iohelper.py`);\n    * utility functions for training and testing (`eval_helper.py`);\n    * functions for extracting and updating features and prior beliefs (`yelpFeatureExtraction.py`);\n    * the manifest file for features (`feature_configuration.py`).\n\n## Citation\n```bibtex\n@inproceedings{dou2020robust,\n  title={Robust Spammer Detection by Nash Reinforcement Learning},\n  author={Dou, Yingtong and Ma, Guixiang and Yu, Philip S and Xie, Sihong},\n  booktitle={Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery \\\u0026 Data Mining},\n  year={2020}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYingtongDou%2FNash-Detect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYingtongDou%2FNash-Detect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYingtongDou%2FNash-Detect/lists"}