{"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-counterfactual-estimation-with","title":"Deep Counterfactual Estimation with Categorical Background Variables","arxiv_id":"2210.05811","date":"2022-10-11","proceeding":null,"authors":["Edward De Brouwer"],"abstract":"Referred to as the third rung of the causal inference ladder, counterfactual queries typically ask the \"What if ?\" question retrospectively. The standard approach to estimate counterfactuals resides in using a structural equation model that accurately reflects the underlying data generating process. However, such models are seldom available in practice and one usually wishes to infer them from observational data alone. Unfortunately, the correct structural equation model is in general not identifiable from the observed factual distribution. Nevertheless, in this work, we show that under the assumption that the main latent contributors to the treatment responses are categorical, the counterfactuals can be still reliably predicted. Building upon this assumption, we introduce CounterFactual Query Prediction (CFQP), a novel method to infer counterfactuals from continuous observations when the background variables are categorical. We show that our method significantly outperforms previously available deep-learning-based counterfactual methods, both theoretically and empirically on time series and image data. Our code is available at https://github.com/edebrouwer/cfqp.","url_abs":"https://arxiv.org/abs/2210.05811v4","url_pdf":"https://arxiv.org/pdf/2210.05811v4.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-counterfactual-estimation-with","repo_url":"https://github.com/edebrouwer/cfqp","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"causal-inference","task_name":"Causal Inference"},{"task_slug":"time-series-1","task_name":"Time Series"},{"task_slug":"time-series","task_name":"Time Series Analysis"},{"task_slug":null,"task_name":"counterfactual"}],"methods":[{"method_slug":"counterfactuals","method_name":"Counterfactuals"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2210.05811","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2210.05811"}},"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/edebrouwer/cfqp","reach":null}],"summary":{"ran":10,"ran_honours":2,"unverified":2},"by_repo_kind":{"official":{"samples":14,"ran":12,"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":"b6fde1347f3c0487","entry":"ConcatELU","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b6fde1347f3c0487"}},{"code_sha256_prefix":"6c70686f770acba9","entry":"ConditionalEmbedder","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.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":"6c70686f770acba9"}},{"code_sha256_prefix":"376c28f71c667cda","entry":"CouplingLayer","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.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":"376c28f71c667cda"}},{"code_sha256_prefix":"94d4f204a05beb0f","entry":"Dense","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"94d4f204a05beb0f"}},{"code_sha256_prefix":"fed58d977eb2e982","entry":"Dequantization","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.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":"fed58d977eb2e982"}},{"code_sha256_prefix":"38028e8d1730adef","entry":"GatedConv","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"38028e8d1730adef"}},{"code_sha256_prefix":"9223e49f435dc017","entry":"ImageEmbedder","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9223e49f435dc017"}},{"code_sha256_prefix":"4c64baabf9213ee9","entry":"LayerNormChannels","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4c64baabf9213ee9"}},{"code_sha256_prefix":"401b5c674fd422f5","entry":"SplitFlow","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.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":"401b5c674fd422f5"}},{"code_sha256_prefix":"2fd221c99150b1ac","entry":"SqueezeFlow","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.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":"2fd221c99150b1ac"}},{"code_sha256_prefix":"b7eb9187d2bf923b","entry":"create_channel_mask","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.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":"b7eb9187d2bf923b"}},{"code_sha256_prefix":"60a6d4fde58fae8f","entry":"create_checkerboard_mask","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.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":"60a6d4fde58fae8f"}},{"code_sha256_prefix":"61ed57e4cf40e7ed","entry":"DeepSCM","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.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":"61ed57e4cf40e7ed"}},{"code_sha256_prefix":"b63ac09163dbabc2","entry":"GatedConvNet","repo":"edebrouwer/cfqp","repo_kind":"official","path":"condgen/models/deepscm.py","file_url":"https://github.com/edebrouwer/cfqp/blob/HEAD/condgen/models/deepscm.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":"b63ac09163dbabc2"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}