Surveys are an important research tool, providing unique measurements on subjective experiences such as sentiment and opinions that cannot be measured by other means. However, because survey data is collected from a self-selected group of participants, directly inferring insights from it to a population of interest, or training ML models on such data, can lead to erroneous estimates or under-performing models. In this paper we present balance, an open-source Python package by Meta, offering a simple workflow for analyzing and adjusting biased data samples with respect to a population of interest. The balance workflow includes three steps: understanding the initial bias in the data relative to a target we would like to infer, adjusting the data to correct for the bias by producing weights for each unit in the sample based on propensity scores, and evaluating the final biases and the variance inflation after applying the fitted weights. The package provides a simple API that can be used by researchers and data scientists from a wide range of fields on a variety of data. The paper provides the relevant context, methodological background, and presents the package's API.
翻译:调查研究是重要的研究工具,能够提供通过其他手段无法衡量的主观体验(如情绪和观点)的独特测量数据。然而,由于调查数据是从自我选择的参与者群体中收集的,若直接从中推断对目标人群的见解,或基于此类数据训练机器学习模型,可能导致错误的估计或模型性能不佳。本文介绍了balance——Meta开发的开源Python包,提供了一套针对目标人群分析并调整偏差数据样本的简单工作流程。该包的工作流程包括三个步骤:理解数据相对于待推断目标的初始偏差;基于倾向性得分为样本中各单元生成权重,以调整数据纠正偏差;评估最终偏差以及应用拟合权重后的方差膨胀程度。该包提供简洁的应用程序接口(API),可供不同领域的研究人员和数据科学家在各种数据上使用。本文阐述了相关背景、方法论基础,并介绍了该包的API设计。