{"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/deep-structural-causal-models-for-tractable","title":"Deep Structural Causal Models for Tractable Counterfactual Inference","arxiv_id":"2006.06485","date":"2020-06-11","proceeding":"NeurIPS 2020 12","authors":["Nick Pawlowski","Daniel C. Castro","Ben Glocker"],"abstract":"We formulate a general framework for building structural causal models (SCMs) with deep learning components. The proposed approach employs normalising flows and variational inference to enable tractable inference of exogenous noise variables - a crucial step for counterfactual inference that is missing from existing deep causal learning methods. Our framework is validated on a synthetic dataset built on MNIST as well as on a real-world medical dataset of brain MRI scans. Our experimental results indicate that we can successfully train deep SCMs that are capable of all three levels of Pearl's ladder of causation: association, intervention, and counterfactuals, giving rise to a powerful new approach for answering causal questions in imaging applications and beyond. The code for all our experiments is available at https://github.com/biomedia-mira/deepscm.","url_abs":"https://arxiv.org/abs/2006.06485v2","url_pdf":"https://arxiv.org/pdf/2006.06485v2.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":"deep-structural-causal-models-for-tractable","repo_url":"https://github.com/biomedia-mira/deepscm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"deep-structural-causal-models-for-tractable","repo_url":"https://github.com/biomedia-mira/causal-gen","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"deep-structural-causal-models-for-tractable","repo_url":"https://github.com/rongguangw/flow-scm","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"counterfactual-inference","task_name":"Counterfactual Inference"},{"task_slug":"normalising-flows","task_name":"Normalising Flows"},{"task_slug":"variational-inference","task_name":"Variational Inference"},{"task_slug":null,"task_name":"counterfactual"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2006.06485","atlas_url":"https://app.syntology.ai/?focus=2006.06485","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2006.06485"}},"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":"deterministic:regex_extraction","url":"https://github.com/biomedia-mira/deepscm","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/biomedia-mira/causal-gen","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/rongguangw/flow-scm","reach":null}],"summary":{"ran":8,"ran_fixture":2,"ran_honours":1,"ran_draft_wrong":1,"unverified":8},"by_repo_kind":{"official":{"samples":10,"ran":5,"repositories":1},"listed":{"samples":10,"ran":7,"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":3,"samples":[{"code_sha256_prefix":"f68de70f80950eeb","entry":"ActNorm","repo":"biomedia-mira/deepscm","repo_kind":"official","path":"deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","file_url":"https://github.com/biomedia-mira/deepscm/blob/HEAD/deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f68de70f80950eeb"}},{"code_sha256_prefix":"e8590010c32109d2","entry":"BaseSEM","repo":"biomedia-mira/deepscm","repo_kind":"official","path":"deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","file_url":"https://github.com/biomedia-mira/deepscm/blob/HEAD/deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e8590010c32109d2"}},{"code_sha256_prefix":"94342d5b16f1ca84","entry":"BasicFlowConvNet","repo":"biomedia-mira/deepscm","repo_kind":"official","path":"deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","file_url":"https://github.com/biomedia-mira/deepscm/blob/HEAD/deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"94342d5b16f1ca84"}},{"code_sha256_prefix":"2e4cf3c6eda70520","entry":"ConditionalAffineTransform","repo":"rongguangw/flow-scm","repo_kind":"listed","path":"models/nfs.py","file_url":"https://github.com/rongguangw/flow-scm/blob/HEAD/models/nfs.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"2e4cf3c6eda70520"}},{"code_sha256_prefix":"a8205893b4e93a15","entry":"ConditionalAffineTransform","repo":"biomedia-mira/deepscm","repo_kind":"official","path":"deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","file_url":"https://github.com/biomedia-mira/deepscm/blob/HEAD/deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a8205893b4e93a15"}},{"code_sha256_prefix":"c1848ecedee520df","entry":"ConditionalSCM","repo":"rongguangw/flow-scm","repo_kind":"listed","path":"models/nfs.py","file_url":"https://github.com/rongguangw/flow-scm/blob/HEAD/models/nfs.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"c1848ecedee520df"}},{"code_sha256_prefix":"bf6be067c32aa776","entry":"DSCM","repo":"biomedia-mira/causal-gen","repo_kind":"listed","path":"src/pgm/dscm.py","file_url":"https://github.com/biomedia-mira/causal-gen/blob/HEAD/src/pgm/dscm.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":"bf6be067c32aa776"}},{"code_sha256_prefix":"50e3c28ae2e23efd","entry":"SqueezeTransform","repo":"biomedia-mira/deepscm","repo_kind":"official","path":"deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","file_url":"https://github.com/biomedia-mira/deepscm/blob/HEAD/deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"50e3c28ae2e23efd"}},{"code_sha256_prefix":"9a75d6db9c391bc1","entry":"conditional_spline_autoregressive","repo":"rongguangw/flow-scm","repo_kind":"listed","path":"models/nfs.py","file_url":"https://github.com/rongguangw/flow-scm/blob/HEAD/models/nfs.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"9a75d6db9c391bc1"}},{"code_sha256_prefix":"a4d7c4fb6e70eb53","entry":"get_attr_max_min","repo":"biomedia-mira/causal-gen","repo_kind":"listed","path":"src/pgm/dscm.py","file_url":"https://github.com/biomedia-mira/causal-gen/blob/HEAD/src/pgm/dscm.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a4d7c4fb6e70eb53"}},{"code_sha256_prefix":"0db6a51b39341f69","entry":"ukbb_preprocess","repo":"biomedia-mira/causal-gen","repo_kind":"listed","path":"src/pgm/dscm.py","file_url":"https://github.com/biomedia-mira/causal-gen/blob/HEAD/src/pgm/dscm.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0db6a51b39341f69"}},{"code_sha256_prefix":"7f3c7862828e87cf","entry":"vae_preprocess","repo":"biomedia-mira/causal-gen","repo_kind":"listed","path":"src/pgm/dscm.py","file_url":"https://github.com/biomedia-mira/causal-gen/blob/HEAD/src/pgm/dscm.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7f3c7862828e87cf"}},{"code_sha256_prefix":"201e09ee2d9716ee","entry":"BaseFlowSEM","repo":"biomedia-mira/deepscm","repo_kind":"official","path":"deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","file_url":"https://github.com/biomedia-mira/deepscm/blob/HEAD/deepscm/experiments/morphomnist/nf/conditional_flow_sem.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":"201e09ee2d9716ee"}},{"code_sha256_prefix":"536c07328829a20b","entry":"ConditionalFlowSEM","repo":"biomedia-mira/deepscm","repo_kind":"official","path":"deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","file_url":"https://github.com/biomedia-mira/deepscm/blob/HEAD/deepscm/experiments/morphomnist/nf/conditional_flow_sem.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":"536c07328829a20b"}},{"code_sha256_prefix":"2a36741ebd1f5acd","entry":"Hparams","repo":"biomedia-mira/causal-gen","repo_kind":"listed","path":"src/pgm/dscm.py","file_url":"https://github.com/biomedia-mira/causal-gen/blob/HEAD/src/pgm/dscm.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":"2a36741ebd1f5acd"}},{"code_sha256_prefix":"7eb735aaea9726cd","entry":"ReshapeTransform","repo":"biomedia-mira/deepscm","repo_kind":"official","path":"deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","file_url":"https://github.com/biomedia-mira/deepscm/blob/HEAD/deepscm/experiments/morphomnist/nf/conditional_flow_sem.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":"7eb735aaea9726cd"}},{"code_sha256_prefix":"e9dec58a402e8b3f","entry":"TraceStorage_ELBO","repo":"biomedia-mira/causal-gen","repo_kind":"listed","path":"src/pgm/dscm.py","file_url":"https://github.com/biomedia-mira/causal-gen/blob/HEAD/src/pgm/dscm.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":"e9dec58a402e8b3f"}},{"code_sha256_prefix":"546c4140e5db7144","entry":"TransposeTransform","repo":"biomedia-mira/deepscm","repo_kind":"official","path":"deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","file_url":"https://github.com/biomedia-mira/deepscm/blob/HEAD/deepscm/experiments/morphomnist/nf/conditional_flow_sem.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":"546c4140e5db7144"}},{"code_sha256_prefix":"72901075b1db0ad0","entry":"check_nan","repo":"biomedia-mira/causal-gen","repo_kind":"listed","path":"src/pgm/dscm.py","file_url":"https://github.com/biomedia-mira/causal-gen/blob/HEAD/src/pgm/dscm.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":"72901075b1db0ad0"}},{"code_sha256_prefix":"82b9f1b46a36f4f4","entry":"weights_init","repo":"biomedia-mira/deepscm","repo_kind":"official","path":"deepscm/experiments/morphomnist/nf/conditional_flow_sem.py","file_url":"https://github.com/biomedia-mira/deepscm/blob/HEAD/deepscm/experiments/morphomnist/nf/conditional_flow_sem.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":"82b9f1b46a36f4f4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}