{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/shapley-explanation-networks-1","title":"Shapley Explanation Networks","arxiv_id":"2104.02297","date":"2021-04-06","proceeding":"ICLR 2021 1","authors":["Rui Wang","Xiaoqian Wang","David I. Inouye"],"abstract":"Shapley values have become one of the most popular feature attribution explanation methods. However, most prior work has focused on post-hoc Shapley explanations, which can be computationally demanding due to its exponential time complexity and preclude model regularization based on Shapley explanations during training. Thus, we propose to incorporate Shapley values themselves as latent representations in deep models thereby making Shapley explanations first-class citizens in the modeling paradigm. This intrinsic explanation approach enables layer-wise explanations, explanation regularization of the model during training, and fast explanation computation at test time. We define the Shapley transform that transforms the input into a Shapley representation given a specific function. We operationalize the Shapley transform as a neural network module and construct both shallow and deep networks, called ShapNets, by composing Shapley modules. We prove that our Shallow ShapNets compute the exact Shapley values and our Deep ShapNets maintain the missingness and accuracy properties of Shapley values. We demonstrate on synthetic and real-world datasets that our ShapNets enable layer-wise Shapley explanations, novel Shapley regularizations during training, and fast computation while maintaining reasonable performance. Code is available at https://github.com/inouye-lab/ShapleyExplanationNetworks.","url_abs":"https://arxiv.org/abs/2104.02297v1","url_pdf":"https://arxiv.org/pdf/2104.02297v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"shapley-explanation-networks-1","repo_url":"https://github.com/inouye-lab/ShapleyExplanationNetworks","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"shapley-explanation-networks-1","repo_url":"https://github.com/RuiWang1998/ShapleyExplanationNetworks","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2104.02297","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2104.02297"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/inouye-lab/ShapleyExplanationNetworks","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/RuiWang1998/ShapleyExplanationNetworks","reach":null}],"summary":{"ran":1,"ran_honours":1,"unverified":12},"by_repo_kind":{"official":{"samples":14,"ran":2,"repositories":2}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"52922940053de0b8","entry":"ModuleDimensions","repo":"RuiWang1998/ShapleyExplanationNetworks","repo_kind":"official","path":"ShapNet/basic.py","file_url":"https://github.com/RuiWang1998/ShapleyExplanationNetworks/blob/HEAD/ShapNet/basic.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"52922940053de0b8"}},{"code_sha256_prefix":"232d06cae3a687fa","entry":"flatten","repo":"inouye-lab/shapleyexplanationnetworks","repo_kind":"official","path":"ShapNet/utils/utils.py","file_url":"https://github.com/inouye-lab/shapleyexplanationnetworks/blob/HEAD/ShapNet/utils/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"232d06cae3a687fa"}},{"code_sha256_prefix":"228afffadc4be04b","entry":"ListModuleDimensions","repo":"RuiWang1998/ShapleyExplanationNetworks","repo_kind":"official","path":"ShapNet/basic.py","file_url":"https://github.com/RuiWang1998/ShapleyExplanationNetworks/blob/HEAD/ShapNet/basic.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"228afffadc4be04b"}},{"code_sha256_prefix":"0f6e67b66b326c49","entry":"ShapleyNetwork","repo":"RuiWang1998/ShapleyExplanationNetworks","repo_kind":"official","path":"ShapNet/basic.py","file_url":"https://github.com/RuiWang1998/ShapleyExplanationNetworks/blob/HEAD/ShapNet/basic.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0f6e67b66b326c49"}},{"code_sha256_prefix":"2ef7e6b2837fc1b1","entry":"add_dim","repo":"inouye-lab/ShapleyExplanationNetworks","repo_kind":"official","path":"ShapNet/utils/named_tensor_utils/private_methods.py","file_url":"https://github.com/inouye-lab/ShapleyExplanationNetworks/blob/HEAD/ShapNet/utils/named_tensor_utils/private_methods.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2ef7e6b2837fc1b1"}},{"code_sha256_prefix":"8fba73b4ca872986","entry":"dummy","repo":"inouye-lab/ShapleyExplanationNetworks","repo_kind":"official","path":"ShapNet/utils/named_tensor_utils/private_methods.py","file_url":"https://github.com/inouye-lab/ShapleyExplanationNetworks/blob/HEAD/ShapNet/utils/named_tensor_utils/private_methods.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8fba73b4ca872986"}},{"code_sha256_prefix":"560e72cd468e68b6","entry":"flatten","repo":"inouye-lab/ShapleyExplanationNetworks","repo_kind":"official","path":"ShapNet/utils/utils.py","file_url":"https://github.com/inouye-lab/ShapleyExplanationNetworks/blob/HEAD/ShapNet/utils/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"560e72cd468e68b6"}},{"code_sha256_prefix":"be730864b4b20fd3","entry":"generate_binary_sequence","repo":"inouye-lab/shapleyexplanationnetworks","repo_kind":"official","path":"ShapNet/utils/utils.py","file_url":"https://github.com/inouye-lab/shapleyexplanationnetworks/blob/HEAD/ShapNet/utils/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"be730864b4b20fd3"}},{"code_sha256_prefix":"47dfd51a1374d4a7","entry":"generate_binary_sequence","repo":"inouye-lab/ShapleyExplanationNetworks","repo_kind":"official","path":"ShapNet/utils/utils.py","file_url":"https://github.com/inouye-lab/ShapleyExplanationNetworks/blob/HEAD/ShapNet/utils/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"47dfd51a1374d4a7"}},{"code_sha256_prefix":"9061c823a930b004","entry":"get_indices","repo":"inouye-lab/shapleyexplanationnetworks","repo_kind":"official","path":"ShapNet/utils/utils.py","file_url":"https://github.com/inouye-lab/shapleyexplanationnetworks/blob/HEAD/ShapNet/utils/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9061c823a930b004"}},{"code_sha256_prefix":"01d54ad12f5dbdf6","entry":"get_indices","repo":"inouye-lab/ShapleyExplanationNetworks","repo_kind":"official","path":"ShapNet/utils/utils.py","file_url":"https://github.com/inouye-lab/ShapleyExplanationNetworks/blob/HEAD/ShapNet/utils/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"01d54ad12f5dbdf6"}},{"code_sha256_prefix":"9b548cdd3c3d9cc7","entry":"name_insert","repo":"inouye-lab/ShapleyExplanationNetworks","repo_kind":"official","path":"ShapNet/utils/named_tensor_utils/private_methods.py","file_url":"https://github.com/inouye-lab/ShapleyExplanationNetworks/blob/HEAD/ShapNet/utils/named_tensor_utils/private_methods.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9b548cdd3c3d9cc7"}},{"code_sha256_prefix":"2345dd4967497bd9","entry":"named_tensor_repeat","repo":"inouye-lab/ShapleyExplanationNetworks","repo_kind":"official","path":"ShapNet/utils/named_tensor_utils/public_methods.py","file_url":"https://github.com/inouye-lab/ShapleyExplanationNetworks/blob/HEAD/ShapNet/utils/named_tensor_utils/public_methods.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2345dd4967497bd9"}},{"code_sha256_prefix":"d6d3b9c0e1800573","entry":"process_list_sizes","repo":"inouye-lab/ShapleyExplanationNetworks","repo_kind":"official","path":"ShapNet/utils/dims.py","file_url":"https://github.com/inouye-lab/ShapleyExplanationNetworks/blob/HEAD/ShapNet/utils/dims.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d6d3b9c0e1800573"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}