{"id":13780216,"url":"https://github.com/lethaiq/GRACE_KDD20","last_synced_at":"2025-05-11T13:31:42.939Z","repository":{"id":97052237,"uuid":"239569505","full_name":"lethaiq/GRACE_KDD20","owner":"lethaiq","description":"GRACE: Generating Concise and Informative Contrastive Sample to Explain Neural Network Model’s Prediction. Thai Le, Suhang Wang, Dongwon Lee. 26th ACM SIGKDD Int’l Conf. on Knowledge Discovery and Data Mining (KDD)","archived":false,"fork":false,"pushed_at":"2020-12-14T04:53:07.000Z","size":3605,"stargazers_count":21,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-02-15T10:31:24.875Z","etag":null,"topics":["ai","explainable","grace","ml"],"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/lethaiq.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}},"created_at":"2020-02-10T17:21:06.000Z","updated_at":"2024-01-04T16:42:04.000Z","dependencies_parsed_at":"2023-04-10T07:47:37.435Z","dependency_job_id":null,"html_url":"https://github.com/lethaiq/GRACE_KDD20","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/lethaiq%2FGRACE_KDD20","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lethaiq%2FGRACE_KDD20/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lethaiq%2FGRACE_KDD20/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lethaiq%2FGRACE_KDD20/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lethaiq","download_url":"https://codeload.github.com/lethaiq/GRACE_KDD20/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225056775,"owners_count":17414206,"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":["ai","explainable","grace","ml"],"created_at":"2024-08-03T18:01:13.453Z","updated_at":"2024-11-17T15:30:59.911Z","avatar_url":"https://github.com/lethaiq.png","language":"Python","funding_links":[],"categories":["Python Libraries(sort in alphabeta order)"],"sub_categories":["Evaluation methods"],"readme":"# GRACE\n\n#### This is the official repository of source code for the [paper](https://arxiv.org/abs/1911.02042):\n\nGRACE: Generating Concise and Informative Contrastive Sample to Explain Neural Network Model’s Prediction. Thai Le, Suhang Wang, Dongwon Lee. 26th ACM SIGKDD Int’l Conf. on Knowledge Discovery and Data Mining (KDD), Virtual. August 2020.\n\n#### (October 26) We updated the arxiv version of our paper to reflect the handling of categorical features of GRACE algorithm.\n#### (December 13) GRACE with black-box attack code is available at https://github.com/research0610/MOCHI (Thanks to the author)\n\n#### Train, Evaluation and Explanation\nUse `main.py` file for training, evaluating and generating explanation.\n\nExample on Spam Detection Dataset:\n```\npython main.py --csv spam.csv --hiddens 50 30 --lr 0.001 --gen_gamma 0.5 --gen_max_features 5 --explain_units %\n```\n\nOutputs:\n```\nTraining...\nVal loss: 0.4463 Val acc: 0.8213\nVal loss: 0.1990 Val acc: 0.9324\nVal loss: 0.1871 Val acc: 0.9300\n\n  Dataset     Accuracy    F1\n=============================\nValidation    0.930     0.930\nTest          0.933     0.933\nGenerating Contrastive Sample...100%\n\n Dataset   #avgFeatChanged   Fidelity\n====================================\nTest           1.254         1.000\n\n         sample  prediction word_freq_make word_freq_address word_freq_all char_freq_%24\n0     Original           0          0.000             0.000         1.200         0.000\n1  Contrastive           1          0.000             0.000         1.200         1.153\nEXPLANATION:  \"IF char_freq_%24 increased 1.153 %, the model would have predicted 1 RATHER THAN 0\"\n```\n\nOther Example Datasets:\n```\npython main.py --csv eegeye.csv --hiddens 40 30 --lr 0.01 --gen_gamma 0.5 --gen_max_features 5\npython main.py --csv phoneme.csv --hiddens 20 5 --lr 0.001 --gen_gamma 0.5 --gen_max_features 5\npython main.py --csv tokyo1.csv --hiddens 50 20 --lr 0.01 --gen_gamma 0.5 --pre_scaler 1 --gen_max_features 5\npython main.py --csv mfeat.csv --hiddens 100 50 --lr 0.001 --gen_gamma 0.5 --pre_scaler 1 --gen_max_features 5\npython main.py --csv diabetes.csv --hiddens 10 10 --lr 0.001 --gen_gamma 0.5 --gen_max_features 5\npython main.py --csv vehicle.csv --hiddens 30 10 --lr 0.001 --gen_gamma 0.5 --gen_max_features 5\n```\n\n#### Citation\n```\n@article{le2019grace,\n    title={GRACE: Generating Concise and Informative Contrastive Sample to Explain Neural Network Model's Prediction},\n    author={Thai Le and Suhang Wang and Dongwon Lee},\n    year={2019},\n    journal={Proceedings of the 26th ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD '20)},\n    doi={10.1145/3394486.3403066}\n    isbn={978-1-4503-7998-4/20/08}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flethaiq%2FGRACE_KDD20","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flethaiq%2FGRACE_KDD20","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flethaiq%2FGRACE_KDD20/lists"}