We study decision making in environments where we receive feedback only for chosen actions. For example, in Internet advertising, we find only whether a user clicked on some of the presented ads, but receive no information about the ads that were not presented. In health care, we only find out success rates for patients who received the treatments, but not for the alternatives. Both of these problems are instances of contextual bandits (Auer et al., 2002; Langford & Zhang, 2008). The context refers to additional information about the user or patient. Here, we focus on the offline version: we assume access to historic data, but no ability to gather new data (Langford et al., 2008; Strehl et al., 2011).
Two kinds of approaches address offline learning in contextual bandits. The first, which we call the direct method (DM), estimates the reward function from given data and uses this estimate in place of actual reward to evaluate the policy value on a set of contexts. The second kind, called inverse propensity score (IPS) (Horvitz & Thompson, 1952), uses importance weighting to correct for the incorrect proportions of actions in the historic data. The first approach requires an accurate model of rewards, whereas the second approach requires an accurate model of the past policy. In general, it might be difficult to accurately model rewards, so the first assumption can be too restrictive. On the other hand, it is usually possible to model the past policy quite well. However, the second kind of approach often suffers from large variance especially when the past policy differs significantly from the policy being evaluated.
In this paper, we propose to use the technique of doubly robust (DR) estimation to overcome problems with the two existing approaches. Doubly robust (or doubly protected) estimation (Cassel et al., 1976; Robins et al., 1994; Robins & Rotnitzky, 1995; Lunceford & Davidian, 2004; Kang & Schafer, 2007) is a statistical approach for estimation from incomplete data with an important property: if either one of the two estimators (in DM and IPS) is correct, then the estimation is unbiased. This method thus increases the chances of drawing reliable inference.
For example, when conducting a survey, seemingly ancillary questions such as age, sex, and family income may be asked. Since not everyone contacted responds to the survey, these values along with census statistics may be used to form an estimator of the probability of a response conditioned on age, sex, and family income. Using importance weighting inverse to these estimated probabilities, one estimator of overall opinions can be formed. An alternative estimator can be formed by directly regressing to predict the survey outcome given any available sources of information. Doubly robust estimation unifies these two techniques, so that unbiasedness is guaranteed ifeither the probability estimate is accurate or the regressed predictor is accurate.
We apply the doubly robust technique to policy value estimation in a contextual bandit setting. The core technique is analyzed in terms of bias in Section 3 and variance in Section 4. Unlike previous theoretical analyses, we do not assume that either the reward model or the past policy model are correct. Instead, we show how the deviations of the two models from the truth impact bias and variance of the doubly robust estimator. To our knowledge, this style of analysis is novel and may provide insights into doubly robust estimation beyond the specific setting studied here. In Section 5, we apply this method to both policy evaluation and optimization, finding that this approach substantially sharpens existing techniques.
1.1 Prior Work
Doubly robust estimation is widely used in statistical inference (see, e.g., Kang & Schafer (2007) and the references therein). More recently, it has been used in Internet advertising to estimate the effects of new features for online advertisers (Lambert & Pregibon, 2007; Chan et al., 2010). Previous work focuses on parameter estimation rather than policy evaluation/optimization, as addressed here. Furthermore, most of previous analysis of doubly robust estimation studies asymptotic behavior or relies on various modeling assumptions (e.g., Robins et al. (1994), Lunceford & Davidian (2004), and Kang & Schafer (2007)). Our analysis is non-asymptotic and makes no such assumptions.
Several other papers in machine learning have used ideas related to the basic technique discussed here, although not with the same language. Forbenign bandits, Hazan & Kale (2009) construct algorithms which use reward estimators in order to achieve a worst-case regret that depends on the variance of the bandit rather than time. Similarly, the Offset Tree algorithm (Beygelzimer & Langford, 2009) can be thought of as using a crude reward estimate for the “offset”. In both cases, the algorithms and estimators described here are substantially more sophisticated.
2 Problem Definition and Approach
Let be an input space and a finite action space. A contextual bandit problem is specified by a distribution over pairs where is the context and
is a vector of rewards. The input data has been generated using some unknown policy (possibly adaptive and randomized) as follows:
The world draws a new example . Only is revealed.
The policy chooses an action , where is the history of previous observations (that is, the concatenation of all preceding contexts, actions and observed rewards).
Reward is revealed. It should be emphasized that other rewards with are not observed.
Note that neither the distribution nor the policy is known. Given a data set collected as above, we are interested in two tasks: policy evaluation and policy optimization. In policy evaluation, we are interested in estimating the value of a stationary policy , defined as:
On the other hand, the goal of policy optimization is to find an optimal policy with maximum value: . In the theoretical sections of the paper, we treat the problem of policy evaluation. It is expected that better evaluation generally leads to better optimization (Strehl et al., 2011). In the experimental section, we study how our policy evaluation approach can be used for policy optimization in a classification setting.
2.1 Existing Approaches
The key challenge in estimating policy value, given the data as described in the previous section, is the fact that we only have partial information about the reward, hence we cannot directly simulate our proposed policy on the data set . There are two common solutions for overcoming this limitation. The first, called direct method (DM), forms an estimate of the expected reward conditioned on the context and action. The policy value is then estimated by
Clearly, if is a good approximation of the true expected reward, defined as , then the DM estimate is close to . Also, if is unbiased,
is an unbiased estimate of. A problem with this method is that the estimate is formed without the knowledge of and hence might focus on approximating mainly in the areas that are irrelevant for and not sufficiently in the areas that are important for ; see Beygelzimer & Langford (2009) for a more refined analysis.
The second approach, called inverse propensity score (IPS), is typically less prone to problems with bias. Instead of approximating the reward, IPS forms an approximation of , and uses this estimate to correct for the shift in action proportions between the old, data-collection policy and the new policy:
where is an indicator function evaluating to one if its argument is true and zero otherwise. If then the IPS estimate above will be, approximately, an unbiased estimate of . Since we typically have a good (or even accurate) understanding of the data-collection policy, it is often easier to obtain a good estimate
, and thus IPS estimator is in practice less susceptible to problems with bias compared with the direct method. However, IPS typically has a much larger variance, due to the range of the random variable increasing. The issue becomes more severe whengets smaller. Our approach alleviates the large variance problem of IPS by taking advantage of the estimate used by the direct method.
2.2 Doubly Robust Estimator
Doubly robust estimators take advantage of both the estimate of the expected reward and the estimate of action probabilities . Here, we use a DR estimator of the form first suggested by Cassel et al. (1976) for regression, but previously not studied for policy learning:
Informally, the estimator uses as a baseline and if there is data available, a correction is applied. We will see that our estimator is accurate if at least one of the estimators, and , is accurate, hence the name doubly robust.
In practice, it is rare to have an accurate estimation of either or . Thus, a basic question is: How does this estimator perform as the estimates and deviate from the truth? The following two sections are dedicated to bias and variance analysis, respectively, of the DR estimator.
3 Bias Analysis
Let denote the additive deviation of from , and a multiplicative deviation of from :
We express the expected value of using and . To remove clutter, we introduce shorthands for , for , for , for , for , for , and for . In our analysis, we assume that the estimates and are fixed independently of (e.g., by splitting the original data set into and a separate portion for estimating and ). To evaluate , it suffices to focus on a single term in Eq. (1), conditioning on :
Even though is independent of , the conditioning on remains in the last line, because , and are functions of . Summing across all terms in Eq. (1), we obtain the following theorem:
Let and be defined as above. Then, the bias of the doubly robust estimator is
If the past policy and the past policy estimate are stationary (i.e., independent of ), the expression simplifies to
In contrast (for simplicity we assume stationarity):
where the second equality is based on the observation that IPS is a special case of DR for .
In general, neither of the estimators dominates the others. However, if either , or , the expected value of the doubly robust estimator will be close to the true value, whereas DM requires and IPS requires . Also, if and , DR will still outperform DM, and similarly for IPS with roles of and reversed. Thus, DR can effectively take advantage of both sources of information for better estimation.
4 Variance Analysis
In the previous section, we argued that the expected value of compares favorably with IPS and DM. In this section, we look at the variance of DR. Since large deviation bounds have a primary dependence on variance, a lower variance implies a faster convergence rate. We treat only the case with stationary past policy, and hence drop the dependence on throughout.
As in the previous section, it suffices to analyze the second moment (and then variance) of a single term of Eq. (1). We use a similar decomposition as in Eq. (2). To simplify derivation we use the notation . Note that, conditioned on and , the expectation of is zero. Hence, we can write the second moment as
Let , and be defined as above. If the past policy and the policy estimate are stationary, then the variance of the doubly robust estimator is
Thus, the variance can be decomposed into three terms. The first accounts for randomness in rewards. The second term is the variance of the estimator due to the randomness in . And the last term can be viewed as the importance weighting penalty. A similar expression can be derived for the IPS estimator:
The first term is identical, the second term will be of similar magnitude as the corresponding term of the DR estimator, provided that . However, the third term can be much larger for IPS if and is smaller than . In contrast, for the direct method, we obtain
Thus, the variance of the direct method does not have terms depending either on the past policy or the randomness in the rewards. This fact usually suffices to ensure that it is significantly lower than the variance of DR or IPS. However, as we mention in the previous section, the bias of the direct method is typically much larger, leading to larger errors in estimating policy value.
This section provides empirical evidence for the effectiveness of the DR estimator compared to IPS and DM. We consider two classes of problems: multiclass classification with bandit feedback in public benchmark datasets and estimation of average user visits to an Internet portal.
5.1 Multiclass Classification with Bandit Feedback
We begin with a description of how to turn a -class classification task into a -armed contextual bandit problem. This transformation allows us to compare IPS and DR using public datasets for both policy evaluation and learning.
5.1.1 Data Setup
In a classification task, we assume data are drawn IID from a fixed distribution: , where is the feature vector and
is the class label. A typical goal is to find a classifierminimizing the classification error:
Alternatively, we may turn the data point into a cost-sensitive classification example , where is the loss for predicting . Then, a classifier may be interpreted as an action-selection policy, and its classification error is exactly the policy’s expected loss.111When considering classification problems, it is more natural to talk about minimizing classification errors. This loss minimization problem is symmetric to the reward maximization problem defined in Section 2.
To construct a partially labeled dataset, exactly one loss component for each example is observed, following the approach of Beygelzimer & Langford (2009). Specifically, given any , we randomly select a label , and then only reveal the component . The final data are thus in the form of , which is the form of data defined in Section 2. Furthermore, and is assumed to be known.
5.1.2 Policy Evaluation
Here, we investigate whether the DR technique indeed gives more accurate estimates of the policy value (or classification error in our context). For each dataset:
We randomly split data into training and test sets of (roughly) the same size;
We compute the classification error on fully observed test data. This error is treated as the ground truth for comparing various estimates;
Finally, we apply the transformation in Section 5.1.1 to the test data to obtain a partially labeled set, from which DM, IPS, and DR estimates are computed.
Both DM and DR require estimating the expected conditional loss denoted as for given . We use a linear loss model: , parameterized by weight vectors
, and use least-squares ridge regression to fitbased on the training set. Step 4 is repeated times, and the resulting bias and rmse (root mean squared error) are reported in Fig. 1.
As predicted by analysis, both IPS and DR are unbiased, since the probability estimate is accurate. In contrast, the linear loss model fails to capture the classification error accurately, and as a result, DM suffers a much larger bias.
While IPS and DR estimators are unbiased, it is apparent from the rmse plot that the DR estimator enjoys a lower variance. As we shall see next, such an effect is substantial when it comes to policy optimization.
5.1.3 Policy Optimization
We now consider policy optimization (classifier learning). Since DM is significantly worse on all datasets, as indicated in Fig. 1, we focus on the comparison between IPS and DR.
Here, we apply the data transformation in Section 5.1.1 to the training data, and then learn a classifier based on the loss estimated by IPS and DR, respectively. Specifically, for each dataset, we repeat the following steps times:
We randomly split data into training () and test () sets;
We apply the transformation in Section 5.1.1 to the training data to obtain a partially labeled set;
We then use the IPS and DR estimators to impute unrevealed losses in the training data;
Two cost-sensitive multiclass classification algorithms are used to learn a classifier from the losses completed by either IPS or DR: the first is DLM (McAllester et al., 2011), the other is the Filter Tree reduction of Beygelzimer et al. (2008
) applied to a decision tree (see AppendixB for more details);
Finally, we evaluate the learned classifiers on the test data to obtain classification error.
Again, we use least-squares ridge regression to build a linear loss estimator: . However, since the training data is partially labeled, is fitted only using training data for which .
Average classification errors (obtained in Step 5 above) of the runs are plotted in Fig. 2. Clearly, for policy optimization, the advantage of the DR is even greater than for policy evaluation. In all datasets, DR provides substantially more reliable loss estimates than IPS, and results in significantly improved classifiers.
Fig. 2 also includes classification error of the Offset Tree reduction, which is designed specifically for policy optimization with partially labeled data.222We used decision trees as the base learner in Offset Trees. The numbers reported here are not identical to those by Beygelzimer & Langford (2009) probably because the filter-tree structures in our implementation were different. While the IPS versions of DLM and Filter Tree are rather weak, the DR versions are competitive with Offset Tree in all datasets, and in some cases significantly outperform Offset Tree.
Finally, we note DR provided similar improvements to two very different algorithms, one based on gradient descent, the other based on tree induction. It suggests the generality of DR when combined with different algorithmic choices.
5.2 Estimating Average User Visits
The next problem we consider is estimating the average number of user visits to a popular Internet portal. Real user visits to the website were recorded for about million bcookies333A bcookie is unique string that identifies a user. Strictly speaking, one user may correspond to multiple bcookies, but it suffices to equate a bcookie with a user for our purposes here. randomly selected from all bcookies during March 2010. Each bcookie is associated with a sparse binary feature vector of size around . These features describe browsing behavior as well as other information (such as age, gender, and geographical location) of the bcookie. We chose a fixed time window in March 2010 and calculated the number of visits by each selected bcookie during this window. To summarize, the dataset contains data: , where is the -th (unique) bcookie, is the corresponding binary feature vector, and is the number of visits.
If we can sample from uniformly at random, the sample mean of will be an unbiased estimate of the true average number of user visits, which is in this problem. However, in various situations, it may be difficult or impossible to ensure a uniform sampling scheme due to practical constraints, thus the sample mean may not reflect the true quantity of interest. This is known as covariate shift, a special case of our problem formulated in Section 2 with arms. Formally, the partially labeled data consists of tuples , where indicates whether bcookie is sampled, is the observed number of visits, and is the probability that . The goal here is to evaluate the value of a constant policy: .
To define the sampling probabilities , we adopted a similar approach as in Gretton et al. (2008). In particular, we obtained the first principal component (denoted ) of all features , and projected all data onto . Let
be a univariate normal distribution with mean, where and were the minimum and mean of the projected values. Then, was the sampling probability of the -th bcookie, .
To control data size, we randomly subsampled a fraction from the entire dataset . For each bcookie in this subsample, set with probability , and otherwise. We then calculated the IPS and DR estimates on this subsample. The whole process was repeated times.
The DR estimator required building a reward model , which, given feature , predicted the average number of visits. Again, least-squares ridge regression was used to fit a linear model from sampled data.
Fig. 3 summarizes the estimation error of the two methods with increasing data size. For both IPS and DR, the estimation error goes down with more data. In terms of rmse, the DR estimator is consistently better than IPS, especially when dataset size is smaller. The DR estimator often reduces the rmse by a fraction between and , and on average by . By comparing to the bias and std metrics, it is clear that DR’s gain of accuracy came from a lower variance, which accelerated convergence of the estimator to the true value. These results confirm our analysis that DR tends to reduce variance provided that a reasonable reward estimator is available.
Doubly robust policy estimation is an effective technique which virtually always improves on the widely used inverse propensity score method. Our analysis shows that doubly robust methods tend to give more reliable and accurate estimates. The theory is corroborated by experiments on both benchmark data and a large-scale, real-world problem.
In the future, we expect the DR technique to become common practice in improving contextual bandit algorithms. As an example, it is interesting to develop a variant of Offset Tree that can take advantage of better reward models, rather than a crude, constant reward estimate (Beygelzimer & Langford, 2009).
We thank Deepak Agarwal for first bringing the doubly robust technique to our attention.
Appendix A Direct Loss Minimization
Given cost-sensitive multiclass classification data , we perform approximate gradient descent on the policy loss (or classification error). In the experiments of Section 5.1, policy is specified by weight vectors . Given , the policy predicts as follows: .
To optimize , we adapt the “towards-better” version of the direct loss minimization method of McAllester et al. (2011) as follows: given any data and the current weights , the weights are adjusted by where , , is a decaying learning rate, and is an input parameter.
For computational reasons, we actually performed batched updates rather than incremental updatess. We found that the learning rate , where is the batched iteration, worked well across all datasets. The parameter was fixed to for all datasets. Updates continued until the weights converged.
Furthermore, since the policy loss is not convex in the weight vectors, we repeated the algorithm times with randomly perturbed starting weights and then returned the best run’s weight according to the learned policy’s loss in the training data. We also tried using a holdout validation set for choosing the best weights out of the candidates, but did not observe benefits from doing so.
Appendix B Filter Tree
The Filter Tree (Beygelzimer et al., 2008) is a reduction from cost-sensitive classification to binary classification. Its input is of the same form as for Direct Loss Minimization, but its output is a binary-tree based predictor where each node of the Filter Tree uses a binary classifier—in this case the J48 decision tree implemented in Weka 3.6.4 (Hall et al., 2009). Thus, there are 2-class decision trees in the nodes, with the nodes arranged as per a Filter Tree. Training in a Filter Tree proceeds bottom-up, with each trained node filtering the examples observed by its parent until the entire tree is trained.
Testing proceeds root-to-leaf, implying that the test time computation is logarithmic in the number of classes. We did not test the all-pairs Filter Tree, which has test time computation linear in the class count similar to DLM.
- Asuncion & Newman (2007) Asuncion, A. and Newman, D. J. UCI machine learning repository, 2007. http://www.ics.uci.edu/mlearn/MLRepository.html.
- Auer et al. (2002) Auer, P., Cesa-Bianchi, N., Freund, Y., and Schapire, R. E. The nonstochastic multiarmed bandit problem. SIAM J. Computing, 32(1):48–77, 2002.
- Beygelzimer & Langford (2009) Beygelzimer, A. and Langford, J. The offset tree for learning with partial labels. In KDD, pp. 129–138, 2009.
- Beygelzimer et al. (2008) Beygelzimer, A., Langford, J., and Ravikumar, P. Multiclass classification with filter-trees. Unpublished technical report: http://www.stat.berkeley.edu/pradeepr/paperz/filter-tree.pdf, 2008.
- Cassel et al. (1976) Cassel, C. M., Särndal, C. E., and Wretman, J. H. Some results on generalized difference estimation and generalized regression estimation for finite populations. Biometrika, 63:615–620, 1976.
- Chan et al. (2010) Chan, D., Ge, R., Gershony, O., Hesterberg, T., and Lambert, D. Evaluating online ad campaigns in a pipeline: causal models at scale. In KDD, 2010.
- Gretton et al. (2008) Gretton, A., Smola, A. J., Huang, J., Schmittfull, M., Borgwardt, K., and Schölkopf, B. Dataset shift in machine learning. In Covariate Shift and Local Learning by Distribution Matching, pp. 131–160. MIT Press, 2008.
- Hall et al. (2009) Hall, M., Frank, E., Holmes, G., Pfahringer, B., Reutemann, P., and Witten, I. H. The WEKA data mining software: An update. SIGKDD Explorations, 11(1):10–18, 2009.
- Hazan & Kale (2009) Hazan, E. and Kale, S. Better algorithms for benign bandits. In SODA, pp. 38–47, 2009.
- Horvitz & Thompson (1952) Horvitz, D. G. and Thompson, D. J. A generalization of sampling without replacement from a finite universe. J. Amer. Statist. Assoc., 47:663–685, 1952.
- Kang & Schafer (2007) Kang, J. D. Y. and Schafer, J. L. Demystifying double robustness: a comparison of alternative strategies for estimating a population mean from incomplete data. Statist. Sci., 22(4):523–539, 2007. With discussions.
- Lambert & Pregibon (2007) Lambert, D. and Pregibon, D. More bang for their bucks: assessing new features for online advertisers. In ADKDD, 2007.
Langford & Zhang (2008)
Langford, J. and Zhang, T.
The epoch-greedy algorithm for contextual multi-armed bandits.In NIPS, pp. 1096–1103, 2008.
- Langford et al. (2008) Langford, J., Strehl, A. L., and Wortman, J. Exploration scavenging. In ICML, pp. 528–535, 2008.
- Lunceford & Davidian (2004) Lunceford, J. K. and Davidian, M. Stratification and weighting via the propensity score in estimation of causal treatment effects: A comparative study. Statistics in Medicine, 23(19):2937–2960, 2004.
- McAllester et al. (2011) McAllester, D., Hazan, T., and Keshet, J. Direct loss minimization for structured prediction. In NIPS, pp. 1594–1602, 2011.
- Robins & Rotnitzky (1995) Robins, J. and Rotnitzky, A. Semiparametric efficiency in multivariate regression models with missing data. J. Amer. Statist. Assoc., 90:122–129, 1995.
- Robins et al. (1994) Robins, J. M., Rotnitzky, A., and Zhao, L. P. Estimation of regression coefficients when some regressors are not always observed. J. Amer. Statist. Assoc., 89(427):846–866, 1994.
- Strehl et al. (2011) Strehl, A., Langford, J., Li, L., and Kakade, S. Learning from logged implicit exploration data. In NIPS, pp. 2217–2225, 2011.