{"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/off-policy-evaluation-via-adaptive-weighting","title":"Off-Policy Evaluation via Adaptive Weighting with Data from Contextual Bandits","arxiv_id":"2106.02029","date":"2021-06-03","proceeding":null,"authors":["Ruohan Zhan","Vitor Hadad","David A. Hirshberg","Susan Athey"],"abstract":"It has become increasingly common for data to be collected adaptively, for example using contextual bandits. Historical data of this type can be used to evaluate other treatment assignment policies to guide future innovation or experiments. However, policy evaluation is challenging if the target policy differs from the one used to collect data, and popular estimators, including doubly robust (DR) estimators, can be plagued by bias, excessive variance, or both. In particular, when the pattern of treatment assignment in the collected data looks little like the pattern generated by the policy to be evaluated, the importance weights used in DR estimators explode, leading to excessive variance. In this paper, we improve the DR estimator by adaptively weighting observations to control its variance. We show that a t-statistic based on our improved estimator is asymptotically normal under certain conditions, allowing us to form confidence intervals and test hypotheses. Using synthetic data and public benchmarks, we provide empirical evidence for our estimator's improved accuracy and inferential properties relative to existing alternatives.","url_abs":"https://arxiv.org/abs/2106.02029v2","url_pdf":"https://arxiv.org/pdf/2106.02029v2.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":"off-policy-evaluation-via-adaptive-weighting","repo_url":"https://github.com/gsbDBI/contextual_bandits_evaluation","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"multi-armed-bandits","task_name":"Multi-Armed Bandits"},{"task_slug":"off-policy-evaluation","task_name":"Off-policy evaluation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2106.02029","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2106.02029"}},"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/gsbDBI/contextual_bandits_evaluation","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_violates":1,"unverified":24},"by_repo_kind":{"official":{"samples":25,"ran":1,"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":"61cf2d533cff0590","entry":"bayesian_update","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/region.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/region.py","link_basis":"plan_row","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"61cf2d533cff0590"}},{"code_sha256_prefix":"0319ca909f2f12f7","entry":"add_config","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"experiments/plot_utils.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/experiments/plot_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":"0319ca909f2f12f7"}},{"code_sha256_prefix":"5e041a8094c1a9b3","entry":"aw_estimate","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/inference.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/inference.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":"5e041a8094c1a9b3"}},{"code_sha256_prefix":"3bef47a51c280c57","entry":"aw_scores","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/inference.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/inference.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":"3bef47a51c280c57"}},{"code_sha256_prefix":"e168c0099c9d586c","entry":"collect","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/compute.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/compute.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":"e168c0099c9d586c"}},{"code_sha256_prefix":"1f3bf92682eaa550","entry":"collect3","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/compute.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/compute.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":"1f3bf92682eaa550"}},{"code_sha256_prefix":"0972fba26bfbba6e","entry":"compose_filename","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/saving.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/saving.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":"0972fba26bfbba6e"}},{"code_sha256_prefix":"32453c92cde96bcf","entry":"draw_region","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/region.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/region.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":"32453c92cde96bcf"}},{"code_sha256_prefix":"23d95e1efad34118","entry":"draw_thompson","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/thompson.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/thompson.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":"23d95e1efad34118"}},{"code_sha256_prefix":"f3208622d144c3e0","entry":"expand","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/compute.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/compute.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":"f3208622d144c3e0"}},{"code_sha256_prefix":"9a6129d06abf86ab","entry":"fit_policylogit","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/policy.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/policy.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":"9a6129d06abf86ab"}},{"code_sha256_prefix":"5f39d54fcc2d1827","entry":"generate_bandit_data","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/datagen.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/datagen.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":"5f39d54fcc2d1827"}},{"code_sha256_prefix":"c3117fb112f8c8ec","entry":"get_sherlock_dir","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/saving.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/saving.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":"c3117fb112f8c8ec"}},{"code_sha256_prefix":"836aa78e2dd20418","entry":"read_files","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"experiments/plot_utils.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/experiments/plot_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":"836aa78e2dd20418"}},{"code_sha256_prefix":"811fd2c220901c6a","entry":"ridge_init","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/ridge.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/ridge.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":"811fd2c220901c6a"}},{"code_sha256_prefix":"79d9cf3e3813bf8b","entry":"ridge_muhat_DM","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/ridge.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/ridge.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":"79d9cf3e3813bf8b"}},{"code_sha256_prefix":"e715a802e07a495d","entry":"ridge_update","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/ridge.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/ridge.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":"e715a802e07a495d"}},{"code_sha256_prefix":"9ecb20e1fe43bf2b","entry":"run_experiment","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/experiment.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/experiment.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":"9ecb20e1fe43bf2b"}},{"code_sha256_prefix":"b4b00b3a088f2fbe","entry":"run_mab_experiment","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/experiment.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/experiment.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":"b4b00b3a088f2fbe"}},{"code_sha256_prefix":"644dbee79cbb4277","entry":"sample_mean","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/inference.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/inference.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":"644dbee79cbb4277"}},{"code_sha256_prefix":"cbc2107c4ed435e0","entry":"save_data_timepoints","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"experiments/plot_utils.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/experiments/plot_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":"cbc2107c4ed435e0"}},{"code_sha256_prefix":"b07c56c691c23fe1","entry":"simple_tree_data","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/datagen.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/datagen.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":"b07c56c691c23fe1"}},{"code_sha256_prefix":"523344a7ed793028","entry":"stats_to_pandas","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/saving.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/saving.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":"523344a7ed793028"}},{"code_sha256_prefix":"6efb7af65b214f06","entry":"ts_mab_probs","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/experiment.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/experiment.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":"6efb7af65b214f06"}},{"code_sha256_prefix":"afb01149b6292d29","entry":"update_thompson","repo":"gsbDBI/contextual_bandits_evaluation","repo_kind":"official","path":"adaptive/thompson.py","file_url":"https://github.com/gsbDBI/contextual_bandits_evaluation/blob/HEAD/adaptive/thompson.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":"afb01149b6292d29"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}