{"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/diffeomorphic-counterfactuals-with-generative","title":"Diffeomorphic Counterfactuals with Generative Models","arxiv_id":"2206.05075","date":"2022-06-10","proceeding":null,"authors":["Ann-Kathrin Dombrowski","Jan E. Gerken","Klaus-Robert Müller","Pan Kessel"],"abstract":"Counterfactuals can explain classification decisions of neural networks in a human interpretable way. We propose a simple but effective method to generate such counterfactuals. More specifically, we perform a suitable diffeomorphic coordinate transformation and then perform gradient ascent in these coordinates to find counterfactuals which are classified with great confidence as a specified target class. We propose two methods to leverage generative models to construct such suitable coordinate systems that are either exactly or approximately diffeomorphic. We analyze the generation process theoretically using Riemannian differential geometry and validate the quality of the generated counterfactuals using various qualitative and quantitative measures.","url_abs":"https://arxiv.org/abs/2206.05075v2","url_pdf":"https://arxiv.org/pdf/2206.05075v2.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":"diffeomorphic-counterfactuals-with-generative","repo_url":"https://github.com/annahdo/counterfactuals","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[],"methods":[{"method_slug":"counterfactuals","method_name":"Counterfactuals"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2206.05075","atlas_url":"https://app.syntology.ai/?focus=2206.05075","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2206.05075"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/annahdo/counterfactuals","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":8,"ran_honours":1,"unverified":2},"by_repo_kind":{"official":{"samples":11,"ran":9,"repositories":1}},"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":"bd4a83f222c00aa0","entry":"bits_per_dim","repo":"annahdo/counterfactuals","repo_kind":"official","path":"counterfactuals/generative_models/flows/utils.py","file_url":"https://github.com/annahdo/counterfactuals/blob/HEAD/counterfactuals/generative_models/flows/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bd4a83f222c00aa0"}},{"code_sha256_prefix":"420f11cbc4c51411","entry":"expl_to_image","repo":"annahdo/counterfactuals","repo_kind":"official","path":"counterfactuals/utils.py","file_url":"https://github.com/annahdo/counterfactuals/blob/HEAD/counterfactuals/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"420f11cbc4c51411"}},{"code_sha256_prefix":"054f22912d47c960","entry":"gaussian_log_p","repo":"annahdo/counterfactuals","repo_kind":"official","path":"counterfactuals/generative_models/flows/glow.py","file_url":"https://github.com/annahdo/counterfactuals/blob/HEAD/counterfactuals/generative_models/flows/glow.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"054f22912d47c960"}},{"code_sha256_prefix":"87324754644a55a3","entry":"gaussian_sample","repo":"annahdo/counterfactuals","repo_kind":"official","path":"counterfactuals/generative_models/flows/glow.py","file_url":"https://github.com/annahdo/counterfactuals/blob/HEAD/counterfactuals/generative_models/flows/glow.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"87324754644a55a3"}},{"code_sha256_prefix":"aec54cec3fae16e8","entry":"gaussian_sample_reverse","repo":"annahdo/counterfactuals","repo_kind":"official","path":"counterfactuals/generative_models/flows/glow.py","file_url":"https://github.com/annahdo/counterfactuals/blob/HEAD/counterfactuals/generative_models/flows/glow.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"aec54cec3fae16e8"}},{"code_sha256_prefix":"7915efb518eff61f","entry":"get_data_info","repo":"annahdo/counterfactuals","repo_kind":"official","path":"counterfactuals/data.py","file_url":"https://github.com/annahdo/counterfactuals/blob/HEAD/counterfactuals/data.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7915efb518eff61f"}},{"code_sha256_prefix":"060069f55f400577","entry":"make_dir","repo":"annahdo/counterfactuals","repo_kind":"official","path":"counterfactuals/utils.py","file_url":"https://github.com/annahdo/counterfactuals/blob/HEAD/counterfactuals/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"060069f55f400577"}},{"code_sha256_prefix":"d55f7870292e9ceb","entry":"plot_grid_part","repo":"annahdo/counterfactuals","repo_kind":"official","path":"counterfactuals/plot.py","file_url":"https://github.com/annahdo/counterfactuals/blob/HEAD/counterfactuals/plot.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d55f7870292e9ceb"}},{"code_sha256_prefix":"d366066ba90492c6","entry":"preprocessor","repo":"annahdo/counterfactuals","repo_kind":"official","path":"counterfactuals/generative_models/flows/utils.py","file_url":"https://github.com/annahdo/counterfactuals/blob/HEAD/counterfactuals/generative_models/flows/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d366066ba90492c6"}},{"code_sha256_prefix":"f452bf17ed5cad17","entry":"calc_z_shapes","repo":"annahdo/counterfactuals","repo_kind":"official","path":"counterfactuals/generative_models/flows/utils.py","file_url":"https://github.com/annahdo/counterfactuals/blob/HEAD/counterfactuals/generative_models/flows/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f452bf17ed5cad17"}},{"code_sha256_prefix":"11770569b6df7eb7","entry":"torch_to_image","repo":"annahdo/counterfactuals","repo_kind":"official","path":"counterfactuals/utils.py","file_url":"https://github.com/annahdo/counterfactuals/blob/HEAD/counterfactuals/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"11770569b6df7eb7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}