Learning Deep Features in Instrumental Variable Regression

Abstract

Instrumental variable (IV) regression is a standard strategy for learning causal relationships between confounded treatment and outcome variables from observational data by using an instrumental variable, which affects the outcome only through the treatment. In classical IV regression, learning proceeds in two stages: stage 1 performs linear regression from the instrument to the treatment; and stage 2 performs linear regression from the treatment to the outcome, conditioned on the instrument. We propose a novel method, deep feature instrumental variable regression (DFIV), to address the case where relations between instruments, treatments, and outcomes may be nonlinear. In this case, deep neural nets are trained to define informative nonlinear features on the instruments and treatments. We propose an alternating training regime for these features to ensure good end-to-end performance when composing stages 1 and 2, thus obtaining highly flexible feature maps in a computationally efficient manner. DFIV outperforms recent state-of-the-art methods on challenging IV benchmarks, including settings involving high dimensional image data. DFIV also exhibits competitive performance in off-policy policy evaluation for reinforcement learning, which can be understood as an IV regression task.

1. Introduction

The aim of supervised learning is to obtain a model based on samples observed from some data generating process, and to then make predictions about new samples generated from the same distribution. If our goal is to predict the effect of our actions on the world, however, our aim becomes to assess the influence of interventions on this data generating process. To answer such causal questions, a supervised learning approach is inappropriate, since our interventions, called treatments, may affect the underlying distribution of the variable of interest, which is called the outcome. To answer these counterfactual questions, we need to learn how treatment variables causally affect the distribution process of outcomes, which is expressed in a structural function. Learning a structural function from observational data (that is, data where we can observe, but not intervene) is known to be challenging if there exists an unmeasured confounder, which influences both treatment and outcome. To illustrate: suppose we are interested in predicting sales of airplane tickets given price. During the holiday season, we would observe the simultaneous increase in sales and prices. This does not mean that raising the price causes the sales to increase. In this context, the time of the year is a confounder, since it affects both the sales and the prices, and we need to correct the bias caused by it. One way of correcting such bias is via instrumental variable (IV) regression (Stock and Trebbi, 2003) . Here, the structural function is learned using instrumental variables, which only affect the treatment directly but not the outcome. In the sales prediction scenario, we can use supply cost shifters as the instrumental variable since they only affect the price (Wright, 1928; Blundell et al., 2012) . Instrumental variables can be found in many contexts, and IV regression is extensively used by economists and epidemiologists. For example, IV regression is used for measuring the effect of a drug in the scenario of imperfect compliance (Angrist et al., 1996) , or the influence of military service on lifetime earnings (Angrist, 1990) . In this work, we propose a novel IV regression method, which can discover non-linear causal relationships using deep neural networks. Classically, IV regression is solved by the two-stage least squares (2SLS) algorithm; we learn a mapping from the instrument to the treatment in the first stage, and learn the structural function in the second stage as the mapping from the conditional expectation of the treatment given the instrument (obtained from stage 1) to the outcome. Originally, 2SLS assumes linear relationships in both stages, but this has been recently extended to non-linear settings. One approach has been to use non-linear feature maps. Sieve IV performs regression using a dictionary of nonlinear basis functions, which increases in size as the number of samples increases (Newey and Powell, 2003; Blundell et al., 2007; Chen and Pouzo, 2012; Chen and Christensen, 2018) . Kernel IV (KIV) (Singh et al., 2019) and Dual IV regression (Muandet et al., 2020) use different (and potentially infinite) dictionaries of basis functions from reproducing kernel Hibert spaces (RKHS). Although these methods enjoy desirable theoretical properties, the flexibility of the model is limited, since all existing work uses pre-specified features. Another approach is to perform the stage 1 regression through conditional density estimation (Carrasco et al., 2007; Darolles et al., 2011; Hartford et al., 2017) . One advantage of this approach is that it allows for flexible models, including deep neural nets, as proposed in the DeepIV algorithm of (Hartford et al., 2017) . It is known, however, that conditional density estimation is costly and often suffers from high variance when the treatment is high-dimensional. More recently, Bennett et al. (2019) have proposed DeepGMM, a method inspired by the optimally weighted Generalized Method of Moments (GMM) (Hansen, 1982) to find a structural function ensuring that the regression residual and the instrument are independent. Although this approach can handle high-dimensional treatment variables and deep NNs as feature extractors, the learning procedure might not be as stable as the 2SLS approach, since it involves solving a smooth zero-sum game, as when training Generative Adversarial Networks (Wiatrak et al., 2019) . In this paper, we propose Deep Feature Instrumental Variable Regression (DFIV), which aims to combine the advantages of all previous approaches, while avoiding their limitations. In DFIV, we use deep neural nets to adaptively learn feature maps in the 2SLS approach, which allows us to fit highly nonlinear structural functions, as in DeepGMM and DeepIV. Unlike DeepIV, DFIV does not rely on conditional density estimation. Like sieve IV and KIV, DFIV learns the conditional expectation of the feature maps in stage 1 and uses the predicted features in stage 2, but with the additional advantage of learned features. We empirically show that DFIV performs better than other methods on several IV benchmarks, and apply DFIV successfully to off-policy policy evaluation, which is a fundamental problem in Reinforcement Learning (RL). The paper is structured as follows. In Section 2, we formulate the IV regression problem and introduce two-stage least-squares regression. In Section 3, we give a detailed description of our DFIV method. We demonstrate the empirical performance of DFIV in Section 4, covering three settings: a classical demand prediction example from econometrics, a challenging IV setting where the treatment consists of high-dimensional image data, and the problem of off-policy policy evaluation in reinforcement learning.

2.1. Problem Setting of Instrumental Variable Regression

X Y Z ε Figure 1: Causal Graph. We begin with a description of the IV setting. We observe a treatment X ∈ X , where X ⊂ R d X , and an outcome Y ∈ Y, where Y ⊂ R. We also have an unobserved confounder that affects both X and Y . This causal relationship can be represented with the following structural causal model: Y = f struct (X) + ε, E [ε] = 0, E [ε|X] = 0, where f struct is called the structural function, which we assume to be continuous, and ε is an additive noise term. This specific confounding assumption is necessary for the IV problem. In Bareinboim and Pearl (2012) , it is shown that we cannot learn f struct if we allow any type of confounders. The challenge is that E [ε|X] = 0, which reflects the existence of a confounder. Hence, we cannot use ordinary supervised learning techniques since f struct (x) = E [Y |X = x]. Here, we assume there is no observable confounder but we may easily include this, as discussed in Appendix C. To deal with the hidden confounder ε, we assume to have access to an instrumental variable Z ∈ Z which satisfies the following assumption. Assumption 1. The conditional distribution P (X|Z) is not constant in Z and E [ε|Z] = 0. Intuitively, Assumption 1 means that the instrument Z induces variation in the treatment X but is uncorrelated with the hidden confounder ε. Again, for simplicity, we assume Z ⊂ R d Z . The causal graph describing these relationships is shown in Figure 1 .foot_0 . Note that the instrument Z cannot have an incoming edge from the latent confounder that is also a parent of the outcome. Given Assumption 1, we can see that the function f struct satisfies the operator equation E [Y |Z] = E [f struct (X)|Z ] by taking expectation conditional on Z of both sides of (1). Newey and Powell (2003) provide necessary and sufficient conditions, known as completeness assumptions, to ensure identifiability of f struct (X). Solving this equation, however, is known to be ill-posed (Nashed and Wahba, 1974) . To address this, recent works (Carrasco et al., 2007; Darolles et al., 2011; Muandet et al., 2020; Singh et al., 2019) minimize the following regularized loss L to obtain the estimate fstruct : fstruct = arg min f ∈F L(f ), L(f ) = E Y Z (Y -E X|Z [f (X)]) 2 + Ω(f ), where F is an arbitrary space of continuous functions and Ω(f ) is a regularizer on f .

2.2. Two Stage Least Squares Regression

A number of works (Newey and Powell, 2003; Singh et al., 2019) tackle the minimization problem (2) using two-stage least squares (2SLS) regression, in which the structural function is modeled as f struct (x) = u ψ(x), where u is a learnable weight vector and ψ(x) is a vector of fixed basis functions. For example, linear 2SLS used the identity map ψ(x) = x, while sieve IV (Newey and Powell, 2003) uses Hermite polynomials. In the 2SLS approach, an estimate û is obtained by solving two regression problems successively. In stage 1, we estimate the conditional expectation E X|z [ψ(X)] as a function of z. ) ] being replaced by the estimate obtained in stage 1. Then in stage 2, as E X|z [f (X)] = u E X|z [ψ(X)], we minimize L with E X|z [f (X Specifically, we model the conditional expectation as E X|z [ψ(X)] = V φ(z), where φ(z) is another vector of basis functions and V is a matrix to be learned. Again, there exist many choices for φ(z), which can be infinite-dimensional, but we assume the dimensions of ψ(x) and φ(z) to be d 1 , d 2 < ∞ respectively. In stage 1, the matrix V is learned by minimizing the following loss, V = arg min V ∈R d 1 ×d 2 L 1 (V ), L 1 (V ) = E X,Z ψ(X) -V φ(Z) 2 + λ 1 V 2 , where λ 1 > 0 is a regularization parameter. This is a linear ridge regression problem with multiple targets, which can be solved analytically. In stage 2, given V , we can obtain u by minimizing the loss û = arg min u∈R d 1 L 2 (u), L 2 (u) = E Y,Z Y -u V φ(Z) 2 + λ 2 u 2 , ( ) where λ 2 > 0 is another regularization parameter. Stage 2 corresponds to a ridge linear regression from V φ(Z) to Y , and also enjoys a closed-form solution. Given the learned weights û, the estimated structural function is fstruct (x) = û ψ(x).

3. DFIV Algorithm

In this section, we develop the DFIV algorithm. Similarly to Singh et al. (2019) , we assume that we do not necessarily have access to observations from the joint distribution of (X, Y, Z). Instead, we are given m observations of (X, Z) for stage 1 and n observations of (Y, Z) for stage 2. We denote the stage 1 observations as (x i , z i ) and the stage 2 observations as (ỹ i , zi ). If observations of (X, Y, Z) are given for both stages, we can evaluate the out-of-sample losses, and these losses can be used for hyper-parameter tuning of λ 1 , λ 2 (Appendix A). DFIV uses the following models f struct (x) = u ψ θ X (x) and E X|z [ψ θ X (X)] = V φ θ Z (z), where u ∈ R d1 and V ∈ R d1×d2 are the parameters, and ψ θ X (x) ∈ R d1 and φ θ Z (z) ∈ R d2 are the neural nets parameterised by θ X ∈ Θ X and θ Z ∈ Θ Z , respectively. As in the original 2SLS algorithm, we learn E X|z [ψ θ X (X)] in stage 1 and f struct (x) in stage 2. In addition to the weights u and V , however, we also learn the parameters of the feature maps, θ X and θ Z . Hence, we need to alternate between stages 1 and 2, since the conditional expectation E X|z [ψ θ X (X)] changes during training. Stage 1 Regression The goal of stage 1 is to estimate the conditional expectation E X|z [ψ θ X (X)] V φ θ Z (z) by learning the matrix V and parameter θ Z , with θ X = θX given and fixed. Given the stage 1 data (x i , z i ), this can be done by minimizing the empirical estimate of L 1 , V (m) , θZ = arg min V ∈R d 1 ×d 2 ,θ Z ∈Θ Z L (m) 1 (V , θ Z ), L (m) 1 = 1 m m i=1 ψ θX (x i ) -V φ θ Z (z i ) 2 + λ 1 V 2 . ( ) Note that the feature map ψ θX (X) is fixed during stage 1, since this is the "target variable." If we fix θ Z , the minimization problem (6) reduces to a linear ridge regression problem with multiple targets, whose solution as a function of θ X and θ Z is given analytically by V (m) (θ X , θ Z ) = Ψ 1 Φ 1 (Φ 1 Φ 1 + mλ 1 I) -1 , where Φ 1 , Ψ 1 are feature matrices defined as Ψ 1 = [ψ θ X (x 1 ), . . . , ψ θ X (x m )] ∈ R m×d1 and Φ 1 = [φ θ Z (z 1 ), . . . , φ θ Z (z m )] ∈ R m×d2 . We can then learn the parameters θ Z of the adaptive features ψ θ Z by minimizing the loss L (m) 1 at V = V (m) ( θX , θ Z ) using gradient descent. For simplicity, we introduce a small abuse of notation by denoting as θZ the result of a user-chosen number of gradient descent steps on the loss (6) with V (m) ( θX , θ Z ) from (7), even though θZ need not attain the minimum of the non-convex loss (6). We then write ( θX , θZ ) . While this trick of using an analytical estimate of the linear output weights of a deep neural network might not lead to significant gains in standard supervised learning, it turns out to be very important in the development of our 2SLS algorithm. As shown in the following section, the analytical estimate V (m) (θ X , θZ ) (now considered as a function of θ X ) will be used to backpropagate to θ X in stage 2. V (m) := V (m) Stage 2 Regression In stage 2, we learn the structural function by computing the weight vector u and parameter θ X while fixing θ Z = θZ , and thus the corresponding feature map φ θZ (z). Given the data (ỹ i , zi ), we can minimize the empirical version of L 2 , defined as û(n) , θX = arg min u∈R d 1 ,θ X ∈Θ X L (n) 2 (u, θ X ), L (n) 2 = 1 n n i=1 (ỹ i -u V (m) φ θZ (z i )) 2 + λ 2 u 2 . (8) Again, for a given θ X , we can solve the minimization problem (8) for u as a function of V (m) := V (m) (θ X , θZ ) by a linear ridge regression û(n) (θ X , θZ ) = V (m) Φ 2 Φ 2 ( V (m) ) + nλ 2 I -1 V (m) Φ 2 y 2 , where Φ 2 = [φ θZ (z 1 ), . . . , φ θZ (z n )] ∈ R n×d2 and y 2 = [ỹ 1 , . . . , ỹn ] ∈ R n . The loss L (n) 2 explicitly depends on the parameters θ X and we can backpropagate it to θ X via V (m) (θ X , θZ ), even though the samples of the treatment variable X do not appear in stage 2 regression. We again introduce a small abuse of notation for simplicity, and denote by θX the estimate obtained after a few gradient steps on (8) with û(n) (θ X , θZ ) from ( 9), even though θX need not minimize the non-convex loss (8). We then have û(n) = û(n) ( θX , θZ ). After updating θX , we need to update θZ accordingly. We do not attempt to backpropagate through the estimate θZ to do this, however, as this would be too computationally expensive; instead, we alternate stages 1 and 2. We also considered updating θX and θZ jointly to optimize the loss L (n) 2 , but this fails, as discussed in Appendix F.

Computational Complexity and Convergence

The computational complexity of the algorithm is O(md 1 d 2 + d 3 2 ) for stage 1, while stage 2 requires additional O(nd 1 d 2 + d 3 1 ) computations. This is small compared to KIV (Singh et al., 2019) , which takes O(m 3 ) and O(n 3 ), respectively. We can further speed up the learning by using mini-batch training as shown in Algorithm 1. Here, V (m b ) and û(n b ) are the functions given by ( 7) and ( 9) calculated using mini-batches of data. Similarly, L (m b ) 1 and L (n b ) 1 are the stage 1 and 2 losses for the mini-batches. We recommend setting the batch size large enough so that V (m b ) , û(n b ) do not diverge from V (m) , û(n) computed on the entire dataset. Furthermore, we observe that setting T 1 > T 2 , i.e. updating θ Z more frequently than θ X , stabilizes the learning process. In Appendix B, we provide regularity conditions under which the function learned by DFIV converges to the true structural function in probability. The derivation is based on Rademacher complexity bounds (Mohri et al., 2012) .

4. Experiments

In this section, we report the empirical performance of the DFIV method. The evaluation considers both low and high-dimensional treatment variables. We used the demand design dataset of Hartford et al. (2017) for benchmarking in the low and high-dimensional cases, and we propose a new setting for the high-dimensional case based on the dSprites dataset (Matthey et al., 2017) . In the deep RL context, we also apply DFIV to perform off-policy policy evaluation (OPE). The network architecture and hyper-parameters are provided in Appendix G. The algorithms in the first two experiments are implemented using PyTorch (Paszke et al., 2019) and the OPE experiments are implemented using TensorFlow (Abadi et al., 2015) and the Acme RL framework (Hoffman et al., 2020) . The code is included in the supplemental material.

Algorithm 1 Deep Feature Instrumental Variable Regression

Input: Stage 1 data (x i , z i ), Stage 2 data (ỹ i zi ), Regularization parameters (λ 1 , λ 2 ). Initial values θX , θZ . Mini-batch size (m b , n b ). Number of updates in each stage (T 1 , T 2 ). Output: Estimated structural function fstruct (x) 1: repeat 2: Sample m b stage 1 data (x (b) i , z i ) and n b stage 2 data (ỹ (b) i , z(b) i ). 3: for t = 1 to T 1 do 4: Return function V (m b ) ( θX , θ Z ) in (7) using (x (b) i , z (b) i ) 5: Update θZ ← θZ -α∇ θ Z L (m b ) 1 ( V (m b ) ( θX , θ Z ), θ Z )| θ Z = θZ \\ Stage 1 learning 6: end for 7: for t = 1 to T 2 do 8: Return function û(n b ) (θ X , θZ ) in ( 9) using (ỹ (b) i , z(b) i ) and function V (m b ) (θ X , θZ ) 9: Update θX ← θX -α∇ θ X L (n b ) 2 ( û(n b ) (θ X , θZ ), θ X )| θ X = θX \\ Stage 2 learning 10: end for 11: until convergence 12: Compute û(n) := û(n) ( θX , θZ ) from ( 9) using entire dataset. 13: return fstruct (x) = ( û(n) ) ψ θX (x)

4.1. Demand Design Experiments

The demand design dataset is a synthetic dataset introduced by Hartford et al. (2017) that is now a standard benchmarking dataset for testing nonlinear IV methods. In this dataset, we aim to predict the demands on airplane tickets Y given the price of the tickets P . The dataset contains two observable confounders, which are the time of year T ∈ [0, 10] and customer groups S ∈ {1, ..., 7} that are categorized by the levels of price sensitivity. Further, the noise in Y and P is correlated, which indicates the existence of an unobserved confounder. The strength of the correlation is represented by ρ ∈ [0, 1]. To correct the bias caused by this hidden confounder, the fuel price C is introduced as an instrumental variable. Details of the data generation process can be found in Appendix E.1. In DFIV notation, the treatment is X = P , the instrument is Z = C, and (T, S) are the observable confounders. We compare the DFIV method to three leading modern competitors, namely KIV (Singh et al., 2019) , DeepIV (Hartford et al., 2017) , and DeepGMM (Bennett et al., 2019) . We used the DFIV method with observable confounders, as introduced in Appendix C. Note that DeepGMM does not have an explicit mechanism for incorporating observable confounders. The solution we use, proposed by Bennett et al. (2019, p. 2) , is to incorporate these observables in both instrument and treatment; hence we apply DeepGMM with treatment X = (P, T, S) and instrumental variable Z = (C, T, S). Although this approach is theoretically sound, this makes the problem unnecessary difficult since it ignores the fact that we only need to consider the conditional expectation of P given Z. We used a network with a similar number of parameters to DeepIV as the feature maps in DFIV and models in DeepGMM. We tuned the regularizers λ 1 , λ 2 as discussed in Appendix A, with the data evenly split for stage 1 and stage 2. We varied the correlation parameter ρ and dataset size, and ran 20 simulations for each setting. Results are summarized in Figure 2 . We also evaluated the performance via the estimation of average treatment effect and conditional average treatment effect, which is presented in Appendix E.2 Next, we consider a case, introduced by Hartford et al. (2017) , where the customer type S ∈ {1, . . . , 7} is replaced with an image of the corresponding handwritten digit from the MNIST dataset (LeCun and Cortes, 2010) . This reflects the fact that we cannot know the exact customer type, and thus we need to estimate it from noisy high-dimensional data. Note that although the confounder is high-dimensional, the treatment variable is still realvalued, i.e. the price P of the tickets. Figure 3 presents the results for this high-dimensional confounding case. Again, we train the networks with a similar number of learnable parameters to DeepIV in DFIV and DeepGMM, and hyper-parameters are set in the way discussed in Appendix A. We ran 20 simulations with data size n + m = 5000 and report the mean and standard error. Our first observation from Figure 2 and 3 is that the level ρ of correlation has no significant impact on the error under any of the IV methods, indicating that all approaches correctly account for the effect of the hidden confounder. This is consistent with earlier results on this dataset using DeepIV and KIV (Hartford et al., 2017; Singh et al., 2019) . We note that DeepGMM does not perform well in this demand design problem. This may be due to the current DeepGMM approach to handling observable confounders, which might not be optimal. KIV performed reasonably well for small sample sizes and low-dimensional data, but it did less well in the high-dimensional MNIST case due to its less expressive features. In high dimensions, DeepIV performed well, since the treatment variable is unidimensional. However, DFIV performed consistently better than all other methods in both low and high dimensions, which suggests it can learn a flexible structural function in a stable manner. To test the performance of DFIV methods for a high dimensional treatment variable, we utilized the dSprites dataset (Matthey et al., 2017) . This is an image dataset described by five latent parameters (shape, scale, rotation, posX and posY). The images are 64 × 64 = 4096-dimensional. In this experiment, we fixed the shape parameter to heart, i.e. we only used heartshaped images. An example is shown in Figure 5 .

4.2. dSprites Experiments

From this dataset, we generated data for IV regression in which we use each figure as treatment variable X. Hence, the treatment variable is 4096-dimensional in this experiment. To make the task more challenging, we used posY as the hidden confounder, which is not revealed to the model. We used the other three latent variables as the instrument variables Z. The structural function f struct and outcome Y are defined as f struct (X) = AX 2 2 -5000 1000 , Y = f struct (X) + 32(posY -0.5) + ε, ε ∼ N (0, 0.5), where each element of the matrix A ∈ R 10×4096 is generated from Unif(0.0, 1.0) and fixed throughout the experiment. See Appendix E.3 for the detailed data generation process. We tested the performance of DFIV with KIV and DeepGMM, where the hyper-parameters are determined as in the demand design problem. The results are displayed in Figure 4 . DFIV consistently yields the best performance of all the methods. DeepIV is not included in the figure because it fails to give meaningful predictions due to the difficulty of performing conditional density estimation for the high-dimensional treatment variable. The performance of KIV suffers since it lacks the feature richness to express a high-dimensional complex structural function. Although DeepGMM performs comparatively to DFIV, we observe some instability during the training, see Appendix E.4.

4.3. Off-Policy Policy Evaluation Experiments

We apply our IV methods to the off-policy policy evaluation (OPE) problem (Sutton and Barto, 2018) , which is one of the fundamental problems of deep RL. In particular, it has been realized by Bradtke and Barto (1996) that 2SLS could be used to estimate a linearly parameterized value function, and we use this reasoning as the basis of our approach. Let us consider the RL environment S, A, P, R, ρ 0 , γ , where S is the state space, A is the action space, P : S × A × S → [0, 1] is the transition function, R : S × A × S × R → R is the reward distribution, ρ 0 : S → [0, 1] is the initial state distribution, and discount factor γ ∈ (0, 1]. Let π be a policy, and we denote π(a|s) as the probability of selecting action a in stage s ∈ S. Given policy π, the Q-function is defined as  Q π (s, a) = E ∞ t=0 γ t r t s 0 = s, a 0 = a with a t ∼ π(• | s t ), s t+1 ∼ P (•|s t , a t ), r t ∼ R(•|s t , a t , s t+1 ). + γ Q π (s , a ) -E s ∼P (•|s,a),a ∼π(•|s ) [Q π (s , a )] + r -E r∼R(•|s,a,s ) [r] confounder ε , where X = (s, a, s , a ), Z = (s, a), Y = r. We have that E [ε] = 0, E [ε|X] = 0, and Assumption 1 is verified. Minimizing the loss (2) for the structural causal model (10) corresponds to minimizing the following loss L OPE L OPE = E s,a,r r + γE s ∼P (•|s,a),a ∼π(•|s ) [Q π (s , a )] -Q π (s, a) 2 , and we can apply any IV regression method to achieve this. In Appendix D, we show that minimizing L OPE corresponds to minimizing the mean squared Bellman error (MSBE) (Sutton and Barto, 2018, p. 268 ) and we detail the DFIV algorithm for OPE. Note that MBSE is also the loss minimized by the residual gradient (RG) method proposed in (Baird, 1995) to estimate Q-functions. However, this method suffers from the "double-sample" issue, i.e. it requires two independent samples of s starting from the same (s, a) due to the inner conditional expectation (Baird, 1995) , whereas IV regression methods do not suffer from this issue. We evaluate DFIV on three BSuite (Osband et al., 2019) tasks: catch, mountain car, and cartpole. See Section E.6.1 for a description of those tasks. The original system dynamics are deterministic. To create a stochastic environment, we randomly replace the agent action by a uniformly sampled action with probability p ∈ [0, 0.5]. The noise level p controls the level of confounding effect. The target policy is trained using DQN (Mnih et al., 2015) , and we subsequently generate an offline dataset for OPE by executing the policy in the same environment with a random action probability of 0.2 (on top of the environment's random action probability p). We compare DFIV with KIV, DeepIV, and DeepGMM; as well as Fitted Q Evaluation (FQE) (Le et al., 2019; Voloshin et al., 2019) , a specialized approach designed for the OPE setting, which serves as our "gold standard" baseline (Paine et al., 2020) (see Section E.6.2 for details). All methods use the same network for value estimation. Figure 6 shows the absolute error of the estimated policy value by each method with a standard deviation from 5 runs. In catch and mountain car, DFIV comes closest in performance to FQE, and even matches it for some noise settings, whereas DeepGMM is somewhat worse in catch, and significantly worse in mountain car. In the case of cartpole, DeepGMM performs somewhat better than DFIV, although both are slightly worse than FQE. DeepIV and KIV both do poorly across all RL benchmarks.

5. Conclusion

We have proposed a novel method for instrumental variable regression, Deep Feature IV (DFIV), which performs two-stage least squares regression on flexible and expressive features of the instrument and treatment. As a contribution to the IV literature, we showed how to adaptively learn these feature maps with deep neural networks. We also showed that the off-policy policy evaluation (OPE) problem in deep RL can be interpreted as a nonlinear IV regression, and that DFIV performs competitively in this domain. This work thus brings the research worlds of deep offline RL and causality from observational data closer. In terms of future work, it would be interesting to adapt the ideas from (Angrist and Krueger, 1995; Angrist et al., 1999; Hansen and Kozbur, 2014) to select the regularization hyperparameters of DFIV as well as investigate generalizations of DFIV beyond the additive model (1) as considered in (Carrasco et al., 2007, Section 5.5) . In RL, problems with additional confounders are common, see e.g. (Namkoong et al., 2020; Shang et al., 2019) , and we believe that adapting DFIV to this setting will be of great value.

A Hyper-Parameter Tuning

If observations from the joint distribution of (X, Y, Z) are available in both stages, we can tune the regularization parameters λ 1 , λ 2 using the approach proposed in Singh et al. (2019) . Let the complete data of stage 1 and stage 2 be denoted as (x i , y i , z i ) and (x i , ỹi , zi ). Then, we can use the data not used in each stage to evaluate the out-of-sample performance of the other stage. Specifically, the regularizing parameters are given by λ * 1 = arg min L (n) 1-oos , L (n) 1-oos = 1 n n j=1 ψ θX (x i ) -V (m) φ θZ (z i ) 2 , λ * 2 = arg min L (m) 2-oos , L (m) 2-oos = 1 m m i=1 (y i -( û(n) ) V (m) φ θZ (z i )) 2 , where û(n) , V (m) , θθ X , θθ Z are the parameters learned in ( 6) and ( 8).

B Consistency of DFIV

In this appendix, we prove consistency of the DFIV approach. Our contribution is to establish consistency of the end-to-end procedure incorporating Stages 1 and 2, which we achieve by first showing a Stage 1 consistency result (Lemma 1), and then establishing the consistency of Stage 2 when the empirical Stage 1 solution is used as input (Lemma 2). The desired result then follows in Theorem 1. Consistency results will be expressed in terms of the complexity of the function classes used in Stages 1 and 2, as encoded in the Rademacher complexity of functionals of these functions (see Proposition 1 below). Consistency for particular function classes can then be shown by establishing that the respective Rademacher complexities vanish. We leave for future work the task of demonstrating this property for function classes of interest.

B.1 Operator view of DFIV

The goal of DFIV is to learn structural function f struct , which satisfies E Y |Z [Y ] = E X|Z [f struct (X)] . We model f struct as f struct (X) = u ψ θ X (X) and denote the hypothesis spaces for ψ θ X and f struct as follows: H ψ = {ψ θ X : X → R d1 | θ X ∈ Θ X }, F = {u ψ θ X : X → Y | ψ θ X ∈ H ψ , u ∈ R d1 }. To learn the parameters, we minimize the following stage 2 loss: û(n) , θX = arg min u∈R d 1 ,θ X L (n) 2 (u, θ X ), L (n) 2 = 1 n n i=1 (ỹ i -u ÊX|Z [ψ θ X (X)] (z i )) 2 . We denote the resulting estimated structural function as fstruct (X) = ( û(n) ) ψ θX (X). For simplicity, we set all regularization terms to zero. Here, ÊX|Z [ψ θ X (X)] is the empirical conditional expectation operator, which maps an element of H ψ to some function g : Z → R d1 ∈ G that ÊX|Z [ψ θ X (X)] = arg min g∈G L (m) 1 (V , θ Z ), L (m) 1 = 1 m m i=1 ψ θ X (x i ) -g(z i ) 2 . In DFIV, we define G as G = {V φ θ Z : Z → R d1 | V ∈ R d2×d1 , θ Z ∈ Θ Z }. This formulation is equivalent to the one introduced in Section 3. With a slight abuse of notation, for f (X) = u ψ θ X (X) ∈ F, we define ÊX|Z [f (X)] to be ÊX|Z [f (X)] = u ÊX|Z [ψ θ X (X)] since this is the empirical estimate of E X|Z [f (X)].

B.2 Generalization errors for regression

Here, we bound the generalization errors of both stages using Rademacher complexity bounds (Mohri et al., 2012) . Proposition 1. (Theorem 3.3 Mohri et al., 2012 , with slight modification) Let S be a measurable space and H be a family of functions mapping from S to [0, M ]. Given fixed dataset S = (s 1 , s 2 , . . . , s n ) ∈ S n , empirical Rademacher complexity is given by RS (H) = E σ sup h∈H n i=1 σ i h(s i ) , where σ = (σ 1 , . . . , σ n ), with σ i is independent uniform random variables taking values in {-1, +1}. Then, for any δ > 0, with probability at least 1 -δ over the draw of an i.i.d sample S of size n, each of following holds for all h ∈ H: E [h(s)] ≤ 1 n n i=1 h(s i ) + 2 RS + 3M log 2/δ 2n , 1 n n i=1 h(s i ) ≤ E [h(s)] + 2 RS + 3M log 2/δ 2n . We list the assumptions below. Assumption 2. The following hold: 1. Bounded outcome variable |Y | ≤ M . 2. Bounded stage 1 hypothesis space: ∀z ∈ Z, g(z) ≤ 1. 3. Bounded stage 2 feature map ∀x ∈ X , ψ θ X (x) ≤ 1. 4. Bounded stage 2 weight: u ≤ M .

5.. Identifiable stage 1 hypothesis space: ∀ψ

θ X ∈ H ψ , ∃g ∈ G, E X|Z [ψ θ X ] = g. 6. Identifiable stage 2 hypothesis space: f struct ∈ F. Note that we leave aside questions of optimization. Thus, we assume that the optimization procedure over (θ Z , V ) is sufficient to recover ÊX|Z , and that the optimization procedure over (u, θ X ) is sufficient to recover fstruct (which requires, in turn, the correct ÊX|Z , for this ψ θ X ). We emphasize that Algorithm 1 does not guarantee these properties. Based on these assumptions, we derive the generalization error in terms of L 2 -norm • P (Z) defined as h P (Z) = h(Z) 2 dP (Z) 1 2 . The following lemma proves the generalization error for stage 1 regression. Lemma 1. Under Assumption 2, and given stage 1 data S 1 = {(x i , z i )} m i=1 , for any δ > 0, with at least probability 1 -2δ, we have ÊX|Z [f (X)] -E X|Z [f (X)] P (Z) ≤ M 4 RS1 (H 1 ) + 24 log 2/δ 2m for any f = u ψ θ X ∈ F, where hypothesis space H 1 is defined as H 1 = {(x, z) ∈ X × Z → ψ θ X (x) -g(z) 2 ∈ R | g ∈ G, ψ θ X ∈ H ψ }. ( ) Proof. From Cauchy-Schwarz inequality, we have E [f (X)|Z] -ÊX|Z [f (X)] P (Z) = (u E X|Z [ψ θ X (X)] -ÊX|Z [ψ θ X (X)] P (Z) ≤ M E X|Z [ψ θ X (X)] -ÊX|Z [ψ θ X (X)] P (Z) By applying Proposition 1 to hypothesis space H 1 , we have E XZ ψ θ X (X) -ÊX|Z [ψ θ X (X)] 2 ≤ 1 m m i=1 ψ θ X (x i ) -ÊX|Z [ψ θ X (X)] (z i ) 2 + 2 RS1 (H 1 ) + 12 log 2/δ 2m with probability 1 -δ. Indeed all functions h ∈ H 1 satisfy h ≤ 4 since ψ θ X (X) ≤ 1, g(Z) ≤ 1 from Assumption 2. Also, since ∀ψ θ X ∈ H ψ , ∃g ∈ G, E X|Z [ψ θ X ] = g, again from Proposition 1, we have 1 m m i=1 ψ θ X (x i ) -E X|Z [ψ θ X (X)] (z i ) 2 ≤ E XZ ψ θ X (X) -E X|Z [ψ θ X (X)] 2 + 2 RS1 (H 1 ) + 12 log 2/δ 2m with probability 1 -δ. From the optimality of ÊX|Z [ψ θ X (X)], we have 1 m m i=1 ψ θ X (x i ) -ÊX|Z [ψ θ X ] (z i ) 2 ≤ 1 m m i=1 ψ θ X (x i ) -E X|Z [ψ θ X (X)] (z i ) 2 . Hence, we have E XZ ψ θ X (X) -ÊX|Z [ψ θ X (X)] 2 ≤ E XZ ψ θ X (X) -E X|Z [ψ θ X (X)] 2 + 4 RS1 (H 1 ) + 24 log 2/δ 2m with probability 1 -2δ. Now we have E XZ ψ θ X (X) -ÊX|Z [ψ θ X (X)] 2 = E XZ ψ θ X (X) -E X|Z [ψ θ X (X)] 2 + E Z E X|Z [ψ θ X (X)] -ÊX|Z [ψ θ X (X)] 2 , and thus E Z E X|Z [ψ θ X (X)] -ÊX|Z [ψ θ X (X)] 2 ≤ 4 RS1 (H 1 ) + 24 log 2/δ 2m . Therefore, by taking the square root of both sides, we can see ÊX|Z [f (X)] -E X|Z [f (X)] P (Z) ≤ M 4 RS1 (H 1 ) + 24 log 2/δ 2m . The generalization error for stage 2 is given in the following lemma. Lemma 2. Under 2, and given stage 1 data S 1 = {(x i , z i )} m i=1 , stage 2 data S 2 = {(ỹ i , zi )} n i=1 , and the estimated structural function fstruct (x) = ( û(n) ) ψ θX (x), then for any δ > 0, with at least probability 1 -4δ, we have E Y |Z [Y ] -ÊX|Z fstruct (X) P (Z) ≤ 4 RS2 (H 2 ) + 24M 2 log 2/δ 2n + M 4 RS1 (H 1 ) + 24 log 2/δ 2m , where H 1 is defined in (13) and H 2 is defined as H 2 = {(y, z) ∈ Y × Z → (y -u g(z)) 2 ∈ R | g ∈ G, u ∈ R d1 , u ≤ M }. ( ) Proof. Since ÊX|Z ψ θX ∈ G, by applying Proposition 1 to hypothesis space H 2 , we have E Y Z (Y -ÊX|Z fstruct (X) ) 2 ≤ 1 n n i=1 ỹi -ÊX|Z fstruct (X) (z i ) 2 + 2 RS2 (H 2 ) + 12M 2 log 2/δ 2n with probability of 1 -δ. Note that all functions h ∈ H 2 are bounded in h ≤ 4M 2 since |Y | ≤ M, ψ θ X (X) ≤ 1, u ≤ M from Assumption 2. Similarly, since f struct ∈ F from Assumption 2, we have 1 n n i=1 ỹi -ÊX|Z [f struct (X)] (z i ) 2 ≤ E Y Z (Y -ÊX|Z [f struct (X)]) 2 + 2 RS2 (H 2 ) + 12M 2 log 2/δ 2n with probability 1 -δ. From the minimality of fstruct , we have 1 n n i=1 ỹi -ÊX|Z fstruct (X) (z i ) 2 ≤ 1 n n i=1 (ỹ i -ÊX|Z [f struct (X)] (z i )) 2 Hence, we have E Y Z Y -ÊX|Z fstruct (X) 2 ≤ E Y Z (Y -ÊX|Z [f struct (X)]) 2 + 4 RS2 (H 2 ) + 24M 2 log 2/δ 2n , with probability 1 -2δ. Now we also have E Y Z Y -ÊX|Z fstruct 2 = E Y Z (Y -E Y |Z [Y ]) 2 + E Z ( ÊX|Z fstruct -E Y |Z [Y ]) 2 , E Y Z (Y -ÊX|Z [f struct ]) 2 = E Y Z (Y -E Y |Z [Y ]) 2 + E Z ( ÊX|Z [f struct ] -E Y |Z [Y ]) 2 . Therefore, with probability 1 -2δ, E Z (E Y |Z [Y ] -ÊX|Z fstruct (X) ) 2 ≤ 4 RS2 (H 2 ) + 24M 2 log 2/δ 2n + E Z ( ÊX|Z [f struct (X)] -E Y |Z [Y ]) 2 . From Lemma 1 and ( 12), with probability at least 1 -2δ, E Z ( ÊX|Z [f struct (X)] -E Y |Z [Y ]) 2 ≤ 4M 2 RS1 (H 1 ) + 24M 2 log 2/δ 2m . By combining them, we can see that with probability -4δ, E Y |Z [Y ] -ÊX|Z fstruct (X) P (Z) ≤ 4 RS2 (H 2 ) + 24M 2 log 2/δ 2n + 4M 2 RS1 (H 1 ) + 24M 2 log 2/δ 2m ≤ 4 RS2 (H 2 ) + 24M 2 log 2/δ 2n + M 4 RS1 (H 1 ) + 24 log 2/δ 2m .

B.3 Consistency Proof of DFIV

The goal is to bound the deviation between fstruct and f struct . This discrepancy is measured by L 2 -norm with respect to P (X), defined as h(X) P (X) = h(X) 2 dP (X) 1 2 . However, we used the norm • P (Z) in Lemmas 1 and 2. To bridge this gap, we state the necessary condition for identification introduced in (Newey and Powell, 2003) . Proposition 2. (Proposition 2.1 Newey and Powell, 2003) For all δ(x) with finite expectation, E [δ(X)|Z] = 0 a.e. on Z implies δ(x) = 0. Proposition 2 is the minimum requirement for identification and Assumption 1 is a sufficient condition for it. Given Proposition 2, we can consider a constant τ < ∞ defined as τ = sup f ∈F ,f =fstruct f struct (X) -f (X) P (X) E [f struct (X) -f (X)|Z] P (Z) . Note that τ ≥ 1 from definition and τ = 1 if and only if X is measurable with respect to Z. This measures the ill-posedness of IV problem. A similar quantity is introduced in (Blundell et al., 2007) . Given this quantity, we derive the convergence rate of DFIV as follows. Theorem 1. Let Assumption 2 hold. Given stage 1 data S 1 = {(x i , z i )} m i=1 , stage 2 data S 2 = {(ỹ i , zi )} m i=1 and τ defined in (15), for any δ > 0, with at least probabilty of 1 -6δ, we have f struct (X) -fstruct (X) P (X) ≤ 2τ M 4 RS1 (H 1 ) + 24 log 2/δ 2m + τ 4 RS2 (H 2 ) + 24M 2 log 2/δ 2n , where H 1 and H 2 are defined in (13) and (14), respectively. Proof. Using τ in (15), we have f struct (X) -fstruct (X) P (X) ≤ τ E f struct (X) -fstruct (X) Z P (Z) ≤ τ E fstruct (X)|Z -ÊX|Z fstruct (X) P (Z) + τ E [f struct (X)|Z] -ÊX|Z fstruct (X) P (Z) = τ E fstruct (X)|Z -ÊX|Z fstruct (X) P (Z) + τ E [Y |Z] -ÊX|Z fstruct (X) P (Z) , where the last inequality holds from (12). Using Lemmas 1 and 2, the result thus follows. 

C 2SLS algorithm with observable confounders

In this appendix, we formulate the DFIV method when observable confounders are available. Here, we consider the causal graph given in Figure 7 . In addition to treatment X ∈ X , outcome Y ∈ Y, and instrument Z ∈ Z, we have an observable confounder O ∈ O. The structural function f struct we aim to learn is now X × O → Y, and the structural causal model is represented as Y = f struct (X, O) + ε, E [ε] = 0, E [ε|X] = 0. For hidden confounders, we rely on Assumption 1. For observable confounders, we introduce a similar assumption. Assumption 3. The conditional distribution P (X|Z, O) is not constant in Z, O and E [ε|Z, O] = 0. Following a similar reasoning as in Section 2, we can estimate the structural function fstruct by minimizing the following loss: fstruct = arg min f ∈F L(f ), L(f ) = E Y ZO (Y -E X|Z,O [f (X, O)]) 2 + Ω(f ). One universal way to deal with the observable confounder is to augment both the treatment and instrumental variables. Let us introduce the new treatment X = (X, O) and instrument Z = (Z, O), then the loss L becomes L(f ) = E Y Z Y -E X| Z f ( X) 2 + Ω(f ), which is equivalent to the original loss L. This approach is adopted in KIV (Singh et al., 2019) , and we used it here for DeepGMM method (Bennett et al., 2019) in the demand design experiment. However, this ignores the fact that we only have to consider the conditional expectation of X given Z = (Z, O). Hence, we introduce another approach which is to model f (X, O) = u (ψ(X) ⊗ ξ(O)), where ψ(X) and ξ(O) are feature maps and ⊗ denotes the tensor product defined as a ⊗ b = vec(ab ). It follows that E X|Z,O [f (X, O)] = u (E X|Z,O [ψ(X)] ⊗ ξ(O) ), which yields the following two-stage regression procedure. In stage 1, we learn the matrix V that V = arg min V ∈R d 1 ×d 2 L 1 (V ) L 1 (V ) = E X,Z,O ψ(X) -V φ(Z, O) 2 + λ 1 V 2 , which estimates the conditional expectation E X|Z,O [ψ(X)]. Then, in stage 2, we learn û using û = arg min u∈R d 1 L 2 (w) L 2 (w) = E Y,Z,O Y -u ( V φ(Z, O) ⊗ ξ(O)) 2 + λ 2 u 2 . Again, both stages can be formulated as ridge regressions, and thus enjoy closed-form solutions. We can further extend this to learn deep feature maps. Let φ θ Z (Z, O), ψ θ X (X), ξ θ O (O) be the feature maps parameterized by θ Z , θ X , θ O , respectively. Using notation similar to Section 3, the corresponding DFIV algorithm with observable confounders is shown in Algorithm 2. Note that in this algorithm, steps 3, 5, 6 are run until convergence, unlike for Algorithm 1.  Update θZ by θZ ← θZ -α∇ θ Z L(m) 1 ( V (m) ( θO , θX , θ Z ), θ Z )| θ Z = θZ \\ Stage 1 4: end while 5: Update θX by θX ← θX -α∇ θ X L(n) 2 ( û(n) ( θO , θ X , θZ ), θO , θ X )| θ X = θX \\ Stage 2 6: Update θO by θO ← θO -α∇ θ O L(n) 2 ( û(n) (θ O , θX , θZ ), θ O , θX )| θ O = θO \\ Stage 2 7: end while 8: Compute û(n) from (9) 9: return fstruct (x) = ( û(n) ) ψ θX (x)

D Application of 2SLS and DFIV to Off-Policy Policy Evaluation

Here we first show that the optimal solution of (2) in the OPE problem is equivalent to that of mean squared Bellman error, and then describe how we apply 2SLS algorithm. We Then, we can prove that the solutions of (11) and MSBE are equivalent. Indeed, we have arg min Q π E s,a,r r -Q π (s, a) + γE s ,a |a,s [Q π (s , a )] 2 // (11) = arg min Q π E s,a,r r -R(s, a) + R(s, a) -Q π (s, a) + γE s ,a |a,s [Q π (s , a )] 2 = arg min Q π E s,a Var(r|s, a) // const wrt Q π + 2E r|s,a (r -R(s, a)) ( R(s, a) -Q π (s, a) + γE s ,a |a,s [Q π (s , a )]) // = 0 + R(s, a) -Q π (s, a) + γE s ,a |a,s [Q π (s , a )] 2 = arg min Q π E s,a R(s, a) -Q π (s, a) + γE s ,a |a,s [Q π (s , a )] 2 . ( ) In this context, we model Q π (s, a) = u ψ(s, a) so that ). We will model E s ∼P (•|s,a),a ∼π(•|s ) [ψ(s , a )] = V φ(s, a). In this case, given stage 1 data (s i , a i , s i ), stage 1 regression becomes V (m) = arg min V ∈R d 1 ×d 2 L (m) 1 , L (m) 1 = 1 m m i=1 ψ(s i , a i ) -V φ(s i , a i ) 2 + λ 1 V 2 , where we sample a i ∼ π(•|s i ). However, given the specific form (17) of the structural function, stage 2 is slightly modified and requires minimizing the loss û(n) = arg min u∈R d 1 L (n) 2 , L (n) 2 = 1 n n i=1 (r i -u (ψ(s i , ãi ) -γ V (m) φ(s i , ãi ))) 2 + λ 2 u 2 , given stage 2 data (s i , ãi , ri ). We can further learn deep feature maps by parameterized feature maps ψ and φ as described in Section 3 to obtain the DFIV algorithm for OPE.

E.1 Details of Demand Design Experiments

Here, we introduce the details of demand design experiments. We follow the procedure in Singh et al. (2019) . The observations are generated from the IV model, Y = f struct (P, T, S) + ε, E [ε|C, T, S] = 0, where Y is sales, P is the treatment variable (price) instrumented by supply cost-shifter C. T, S are the observable confounder, interpretable as time of year and customer sentiment. The true structural function is f struct (P, T, S) = 100 + (10 + P )Sh(T ) -2P, h(t) = 2 (t -5) 4 600 + exp(-4(t -5) 2 ) + t 10 -2 . Data is sampled as S ∼ Unif{1, . . . , 7} T ∼ Unif[0, 10] C ∼ N (0, 1) V ∼ N (0, 1) ε ∼ N (ρV, 1 -ρ 2 ) P = 25 + (C + 3)h(T ) + V From observations of (Y, P, T, S, C), we estimate fstruct by several methods. For each estimated fstruct , we measure out-of-sample error as the mean square error of f versus true f struct applied to 2800 values of (p, t, s). Specifically, we consider 20 evenly spaced values of p ∈ [10, 25], 20 evenly spaced values of t ∈ [0, 10], and all 7 values s ∈ {1, . . . , 7}.

E.2 Effect Estimation in Demand Design Experiments

In this section, we report the result of causal effect estimation based on demand design experiments. Specifically, we consider two effects: one is average treatment effect (ATE) and another is conditional average treatment effect (CATE). ATE Estimation ATE is a central target quantity in causal inference defined as ATE = E [Y |do(X = 1)] -E [Y |do(X = 0)] for binary treatment X ∈ {0, 1}. ATE thus requires estimating the counterfactual mean out - comes E [Y |do(X = 1)] , E [Y |do(X = 0)]. Here, we generalize this to continuous treatment . This is also known as continuous treatment effect or dose-response curve. In the demand design problem, the ground truth is given by E [Y |do(P = p)] = E T,S [f struct (p, T, S)] = (G -2)p + 100 + 10G, where G = E S [S] E T [h(T )]. The important point here is that this quantity must be monotonically decreasing with respect to price P , since we should observe drop of demand as we increase the ticket price. We estimate ATE by averaging the estimated structural function fstruct over S and T . The estimated ATE given by DeepGMM, KIV, DeepIV, DFIV are shown in Figure 8 . From Figure 8 , we can see that KIV and DeepGMM fail to recover the monotonic structure in ATE. DeepIV and DFIV are able to capture this structure, but DFIV estimation is consistently better than DeepIV.

CATE Estimation

Although ATE captures the treatment effect for the entire population, treatment effects may be heterogeneous for different sub-populations, which we might be interested in. In such a case, we can consider CATE defined as CATE(õ) = E Y do(X = 1), Õ = õ -E Y do(X = 0), Õ = õ for binary treatment X ∈ {0, 1}. Here, Õ is a sub-vector of observable confounder O. Again, we generalize this idea and consider E Y do(X = x), Õ = õ , which allows treatment X to be continuous. This quantity is also known as the heterogeneous treatment effect. In demand design experiment, we can consider the CATE conditioned on the time of the year T . The true CATE is defined as E [Y | do(P = p), T = t] = E S [f struct (p, t, S)] = 100 + (10 + p)E [S] h(t) -2p, which can be obtained by averaging the estimated structural function fstruct over S. Figure 9 shows the prediction of CATE with respect to T where treatment P is fixed to P = 25. Again, we can observe that KIV and DeepGMM fail to capture the shape of the ground truth curve. DeepIV performs significantly better but is less accurate than DFIV.

E.3 Data Generation Process in dSprites Experiments

Here, we describe the data generation process for the dSprites dataset experiment. This is an image dataset described via five latent parameters (shape, scale, rotation, posX and posY). The images are 64 × 64 = 4096-dimensional. In this experiment, we fixed shape parameter to heart, i.e. we only used the heart-shaped images. The other latent parameters take values of scale ∈ [0.5, 1], rotation ∈ [0, 2π], posX ∈ [0, 1], posY ∈ [0, 1]. From this dataset, we generate the treatment variable X and outcome Y as follows. MNIST Here, the structural function we aim to learn is f struct (X) = |X|. Additionally, we map Z, X, or both X and Z to MNIST images to see whether the model can handle the highdimensional treatment and instrumental variables. Let the output of original IV problem above to be X low , Z low and π(x) = round(min(max(1.5x + 5, 0), 9)) be a transformation function that maps inputs to an integer between 0 and 9, and let RandomImage(d) be a function that selects a random MNIST image from the digit class d. The images are 28 × 28 = 784-dimensional. We consider the three following scenarios. • MNIST x : X ← X low , Z ← RandomImage(π(Z low )) • MNIST z : X ← RandomImage(π(X low )), Z ← Z low • MNIST xz : X ← RandomImage(π(X low )), Z ← RandomImage(π(Z low )) We refer the reader to Bennett et al. (2019) for a detailed description. We applied DFIV using the same architecture as DeepGMM. In Table 1 , we present the mean and standard error of out-of-sample MSE for DFIV and report the results obtained for DeepGMM in Bennett et al. (2019) . From Table 1 , we can see that DFIV performs essentially like DeepGMM. 2. Mountain Car: The agent drives an underpowered car up a hill (Moore, 1990) . Illustrated in Figure 11b . 3. Cartpole: The agent can move a cart left/right on a plane to keep a balanced pole upright (Barto et al., 1983) . Illustrated in Figure 11c . All tasks have a real-valued state space S ⊆ R D and a discrete action space A = {0, 1, 2, . . . , A -1}. The state dimension and number of actions are provided in Table 2 .

E.6.2 Fitted Q Evaluation

Fitted Q Evaluation (FQE) (Le et al., 2019) is a simple variant of the Fitted Q Iteration (FQI) algorithm (Ernst et al., 2005) . Instead of learning the Q function of an optimal policy as FQI, FQE estimates the Q function of a fixed policy π. It is an iterative algorithm with randomly initialized the Q function parameters θ 0 . At iteration k ≥ 1 with the current estimate of Q function Q π (s, a|θ k-1 ), it updates parameters θ k by solving the following regression problem using a least squares approach: r + γQ π (s , a |θ k-1 ) =Q π (s, a|θ k ) (18) where the regression function to estimate is Q π (s, a|θ k ), the observed outcome is the term on the LHS of ( 18) and the residual is the sum of terms in the second and third lines of (18). Comparing the equation above with (10), FQE reformulates the regression problem and moves the confounded part in the treatment of (10), that is γQ π (s , a ), to the outcome. + γ Q π ( The regression problem at each iteration is therefore not confounded any more. If FQE converges, it finds a solution of the following equation  Q π ( where P (•) is the L 2 projection operator that maps a function of (s, a) onto the (parameterized) Q function space.

F Failure of Joint Optimization

One might want to jointly minimize the loss L(n) 2 , which is the empirical approximation of L. However, this fails to learn the true structural function f struct , as shown in this appendix. Figure 12 shows the learning curve obtained when we jointly minimize θ X and θ Z with respect to L(n) 2 , where L test is the empirical approximation of L test = E X f struct (X) -( û(n) ) ψ θ X (X) 2 . ( ) We observe in Figure 12 that the decrease of stage 2 loss does not improve the performance of the learned structural function. This is because the model focuses on learning the relationship between instrument Z and outcome Y , while ignoring treatment X. We can see this from the fact that stage 1 loss becomes large and unstable. This is against the goal of IV regression, which is to learn a causal relationship between X and Y . On the other hand, Figure 13 shows the learning curve obtained using DFIV. Now, we can see that stage 2 loss matches L test . Also, we can confirm that stage 1 loss stays small and stable.



We show the simplest causal graph in Figure1It entails Z ⊥ ⊥ ε, but we only require Z and ε to be uncorrelated in Assumption 1. Of course, this graph also says that Z is not independent of ε when conditioned on observations X.



Figure 2: MSE for demand design dataset with low dimensional confounders.

Figure 5: dSprite image

The goal of OPE is to evaluate the expectation of the Q-function with respect to the initial state distribution for a given target policy π, E s∼ρ0,a|s∼π [Q π (s, a)], learned from a fixed dataset of transitions (s, a, r, s ), where s and a are sampled from some potentially unknown distribution µ and behavioral policy π b (•|s) respectively. Using the Bellman equation satisfied by Q π , we obtain a structural causal model of the form (1), r = structural function fstruct(s,a,s ,a ) Q π (s, a) -γQ π (s , a )

Figure 6: Error of offline policy evaluation.

Figure 7: Causal graph with observable confounder From this result, we obtain directly the following corollary. Corollary 1. Let Assumption 2 hold. If RS1 (H 1 ) → 0 and RS2 (H 2 ) → 0 in probability as datasize increases, fstruct converges to f struct in probability. The proof of vanishing Rademacher complexities for particular Stage 1 and Stage 2 function classes is a topic for future work.

interpret the Bellman equation in (10) as IV regression problem, where X = (s, a, s , a ), Z = (s, a) and Y = r and f struct (s, a, s , a ) = Q π (s, a) -γQ π (s , a ). Let R(s, a) be the conditional expectation of reward given s, a defined as R(s, a) = E r|s,a [r] = rP (s |s, a)R(r|s, a, s )ds dr.

struct (s, a, s , a ) = u (ψ(s, a) -γψ(s , a )). (17) It follows that E X|z [f (X)] = u (ψ(s, a) -γE s ∼P (•|s,a),a ∼π(•|s ) [ψ(s , a )]

Figure 8: Estimation of ATE.

We provide a brief description below of the three behavior suite (BSuite) reinforcement learning tasks inOsband et al. (2019):1. Catch: A 10x5 Tetris-grid with single block falling per column. The agent can move left/right in the bottom row to 'catch' the block. Illustrated in Figure11a.

Figure 11: Three BSuite tasks. Figures are from Osband et al. (2019).

s , a |θ k-1 ) -E s ∼P (•|s,a),a ∼π(•|s ) [Q π (s , a |θ k-1 )] + r -E r∼R(•|s,a,s ) [r] ,

Algorithm 2 Deep Feature Instrumental Variable with Observable Confounder Input: Stage 1 data (x i , z i , o i ), Stage 2 data (ỹ i , zi , õi ). Initial values θO , θX , θZ . Regularizing parameters (λ 1 , λ 2 ) Output: Estimated structural function fstruct (x).

x MNIST z MNIST xz DeepGMM .15 ± .02 .07 ± .02 .14 ± .02 DFIV .18 ± .01 .07 ± .001 .10 ± .003 Table 1: Out-of-Sample MSE in MNIST experiment of Bennett et al. (2019) Dimensions of BSuite tasks

s, a|θ) = P (E r|s,a [r] + γE s ,a |s,a [Q π (s , a |θ)]) ,

annex

Here, function Fig returns the corresponding image to the latent parameters, and η, ε are noise variables generated from η ∼ N (0.0, 0.1I) and ε ∼ N (0.0, 0.5). Each element of the matrix A ∈ R 10×4096 is generated from Unif(0.0, 1.0) and fixed throughout the experiment.From the data generation process, we can see that X and Y are confounded by posY. We use the instrumental variable Z = (scale, rotation, posX) ∈ R 3 , and figures with random noise as treatment variable X. The variable posY is not revealed to the model, and there is no observable confounder. The structural function for this setting isWe use 588 test points for measuring out-of-sample error, which is generated from the grid points of latent variables. The grids consist of 7 evenly spaced values for posX, posY, 3 evenly spaced values for scale, and 4 evenly spaced values for orientation.

E.4 Instability of DeepGMM in dSprites Experiments

In the dSprite experiments, we observed that the training procedure of DeepGMM can be unstable. Figure 10 displays the MSE for the models learned in the first 100 epochs. Here, we can see that DeepGMM performs poorly in the early stage of the learning. Furthermore, even after it appears to have converged, we observe a sudden increase of MSE around 80th epoch, which makes difficult to determine when to stop. We conjecture that this is due to the instability of the smooth zero-sum game solved by DeepGMM. By contrast, DFIV converges quickly and performs consistently better than DeepGMM on this task.

E.5 MNIST Experiments

Here, we report the result of MNIST experiments proposed by Bennett et al. (2019) , who consider the following datasets: -3, 3] 2 ) e ∼ N (0, 1), γ, δ ∼ N (0, 0.1) 

G Network Structures and Hyper-Parameters

Here, we describe the network architecture and hyper-parameters of all experiments. Unless otherwise specified, all neural network-based algorithms are optimized using Adam with learning rate = 0.001, β 1 = 0.9, β 2 = 0.999 and ε = 10 -8 .Demand Design For DeepIV, we used the original structure proposed in Hartford et al. (2017) , which is described in Table 3 . We follow the default dropout rate in Hartford et al. (2017) , which depends on the data size. For DFIV, we used the structure described in Table 4 . The regularizer λ 1 , λ 2 are both set to 0.1 as a result of the tuning procedure described in Appendix A. For KIV, we used the Gaussian kernel where the bandwidth is determined by the median trick described by Singh et al. (2019) . We used random Fourier feature trick (Rahimi and Recht, 2008) with 100-dimensions. For DeepGMM, we used the same structure as DeepIV but no dropout is applied and the last layer of the Instrument Net is changed to a fully-connected layer which maps 32 dimensions to 1 dimension.Demand Design with MNIST The feature extractor for MNIST image data is given in Table 5 , which is used for both stage 1 and 2. For DeepIV, we used the original structure proposed in Hartford et al. (2017) , which is described in Table 6 . We follow the default dropout rate in Hartford et al. (2017) , which depends on the data size. For DFIV, we used the structure described in Table 7 . The regularizer λ 1 , λ 2 are both set to 0.1 as a result of the tuning procedure described in Appendix A. For KIV, we used the Gaussian kernel where the bandwidth is determined by the median trick and also used random Fourier features with 100-dimensions. For DeepGMM, we used the same structure as DeepIV but no dropout dSprite experiment For DeepGMM, we used the structure described in Table 8 . For DFIV, we used the structure described in Table 9 . The regularizer λ 1 , λ 2 are both set to 0.01 as a result of the tuning procedure described in Appendix A. For KIV, we used the Gaussian kernel where the bandwidth is determined by the median trick. We used random Fourier feature trick (Rahimi and Recht, 2008) with 100 dimensions.

OPE experiment

For DeepIV, we used the structure described in Table 12 . For DFIV, we used the structure described in Table 10 . The regularizer λ 1 , λ 2 are both set to 10 -5 as a result of the tuning procedure described in Appendix A. For KIV, we used the Gaussian kernel where the bandwidth is determined by the median trick. We used random Fourier features (Rahimi and Recht, 2008) with 100 dimensions. For DeepGMM, we use the structure described in Table 11 . 

