{"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/perfect-match-a-simple-method-for-learning","title":"Perfect Match: A Simple Method for Learning Representations For Counterfactual Inference With Neural Networks","arxiv_id":"1810.00656","date":"2018-10-01","proceeding":"ICLR 2019 5","authors":["Patrick Schwab","Lorenz Linhardt","Walter Karlen"],"abstract":"Learning representations for counterfactual inference from observational data is of high practical relevance for many domains, such as healthcare, public policy and economics. Counterfactual inference enables one to answer \"What if...?\" questions, such as \"What would be the outcome if we gave this patient treatment $t_1$?\". However, current methods for training neural networks for counterfactual inference on observational data are either overly complex, limited to settings with only two available treatments, or both. Here, we present Perfect Match (PM), a method for training neural networks for counterfactual inference that is easy to implement, compatible with any architecture, does not add computational complexity or hyperparameters, and extends to any number of treatments. PM is based on the idea of augmenting samples within a minibatch with their propensity-matched nearest neighbours. Our experiments demonstrate that PM outperforms a number of more complex state-of-the-art methods in inferring counterfactual outcomes across several benchmarks, particularly in settings with many treatments.","url_abs":"https://arxiv.org/abs/1810.00656v5","url_pdf":"https://arxiv.org/pdf/1810.00656v5.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":"perfect-match-a-simple-method-for-learning","repo_url":"https://github.com/d909b/perfect_match","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"counterfactual-inference","task_name":"Counterfactual Inference"},{"task_slug":null,"task_name":"counterfactual"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1810.00656","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1810.00656"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/d909b/perfect_match","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":10},"by_repo_kind":{"official":{"samples":10,"ran":0,"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":"97e939c3bfec21fb","entry":"calculate_distance","repo":"d909b/perfect_match","repo_kind":"official","path":"perfect_match/models/distributions.py","file_url":"https://github.com/d909b/perfect_match/blob/HEAD/perfect_match/models/distributions.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":"97e939c3bfec21fb"}},{"code_sha256_prefix":"3a8c5df4e126cff3","entry":"cf_nn","repo":"d909b/perfect_match","repo_kind":"official","path":"perfect_match/models/pehe_loss.py","file_url":"https://github.com/d909b/perfect_match/blob/HEAD/perfect_match/models/pehe_loss.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":"3a8c5df4e126cff3"}},{"code_sha256_prefix":"0962f50efe80859a","entry":"clip_percentage","repo":"d909b/perfect_match","repo_kind":"official","path":"perfect_match/apps/parameters.py","file_url":"https://github.com/d909b/perfect_match/blob/HEAD/perfect_match/apps/parameters.py","link_basis":"harvester_set","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":"0962f50efe80859a"}},{"code_sha256_prefix":"ae09e9d7c6231e1a","entry":"get_dataset_params","repo":"d909b/perfect_match","repo_kind":"official","path":"perfect_match/apps/run_all_experiments.py","file_url":"https://github.com/d909b/perfect_match/blob/HEAD/perfect_match/apps/run_all_experiments.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":"ae09e9d7c6231e1a"}},{"code_sha256_prefix":"83e751506b026faa","entry":"model_is_pbm_variant","repo":"d909b/perfect_match","repo_kind":"official","path":"perfect_match/apps/run_all_experiments.py","file_url":"https://github.com/d909b/perfect_match/blob/HEAD/perfect_match/apps/run_all_experiments.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":"83e751506b026faa"}},{"code_sha256_prefix":"08f299853fa6e6e0","entry":"pdist2","repo":"d909b/perfect_match","repo_kind":"official","path":"perfect_match/models/pehe_loss.py","file_url":"https://github.com/d909b/perfect_match/blob/HEAD/perfect_match/models/pehe_loss.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":"08f299853fa6e6e0"}},{"code_sha256_prefix":"499e47b5bf3aa77d","entry":"pdist2sq","repo":"d909b/perfect_match","repo_kind":"official","path":"perfect_match/models/distributions.py","file_url":"https://github.com/d909b/perfect_match/blob/HEAD/perfect_match/models/distributions.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":"499e47b5bf3aa77d"}},{"code_sha256_prefix":"8b4e301420252199","entry":"pehe_nn","repo":"d909b/perfect_match","repo_kind":"official","path":"perfect_match/models/pehe_loss.py","file_url":"https://github.com/d909b/perfect_match/blob/HEAD/perfect_match/models/pehe_loss.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":"8b4e301420252199"}},{"code_sha256_prefix":"25888f975b6321df","entry":"safe_sqrt","repo":"d909b/perfect_match","repo_kind":"official","path":"perfect_match/models/distributions.py","file_url":"https://github.com/d909b/perfect_match/blob/HEAD/perfect_match/models/distributions.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":"25888f975b6321df"}},{"code_sha256_prefix":"8d839b0d284d8c2e","entry":"time_function","repo":"d909b/perfect_match","repo_kind":"official","path":"perfect_match/apps/util.py","file_url":"https://github.com/d909b/perfect_match/blob/HEAD/perfect_match/apps/util.py","link_basis":"harvester_set","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":"8d839b0d284d8c2e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}