Batch Policy Learning in Average Reward Markov Decision Processes
Peng Liao, Zhengling Qi, Runzhe Wan, Predrag Klasnja, Susan Murphy
Introduction
Mobile health (mHealth) is a rapidly growing field due to the recent advances in mobile and sensing technologies. The mHealth intervention provides a unique opportunity to promote the healthy behaviors (e.g., regular physical activity and adherence to medications) and has been successfully applied in many health fields (e.g., smoking cessation, physical activity, drug abuse and diabetes). Just-in-time adaptive interventions (JITAI, Nahum-Shani et al. 2016) use a decision rule (i.e., a treatment policy or policy) that maps real-time information about the individual’s context to a particular treatment. In this work we study the problem of how to use data consisting of multiple trajectories to estimate a policy that leads to good long-term performance.
We model the sequential decision making process by a time-homogeneous Markov Decision Process (MDP) (Puterman 1994) over infinite time horizon. This framework is natural for mobile health applications in which the number of decision times is often large. For example, in HeartSteps, a physical activity mHealth study, there are five decision times per day, resulting in thousands of decision times over a year. Tremendous progress has been made in finite horizon setting; see the recent review by Kosorok and Laber 2019 for references therein. However when the number of time points is very large, methods that are based on the idea of backward iteration (e.g., Q-learning) or importance sampling (Precup 2000) may suffer a large variance in problems or even be unpractical (Voloshin et al. 2019; Laber et al. 2014).
We propose to estimate the policy that optimizes the long-term average outcomes (rewards) using data consisting of multiple trajectories of finite length. The majority of existing methods focuses on the alternative, the discounted sum of rewards (Sutton and Barto 2018); see the recent works in statistics (Luckett et al. 2019; Ertefaie and Strawderman 2018; Shi et al. 2020; Shi et al. 2021). The discounted formulation weighs immediate rewards more heavily than rewards further in the future, which is practical in some applications (e.g., finance). However, for mHealth applications, choosing an appropriate discount rate could be non-trivial. The rewards (i.e., the health outcomes) in the distant future are as important as the near-term ones, especially when considering maintenance of health behaviors as well as longer term treatment burden. This suggests using a large discount rate. However, it is well known that algorithms developed in the discounted setting can become increasingly unstable as the discount rate goes to one; see for example Naik et al. 2019. The long-term average reward framework provides a good approximation to the long-term performance of a desired treatment policy in mHealth. Indeed, it can be shown that under regularity conditions the finite average of the expected rewards converges sublinearly to the long-term average reward as time goes to infinity (Hernández-Lerma and Lasserre 1999). Therefore, a policy that optimizes the average reward would approximately maximize the sum of the rewards over a sufficiently long time horizon.
In this work, we present a novel algorithm that estimates the optimal policy in a prespecified, parametric policy class. Various methods have been proposed to estimate the global optimal policy by estimating the optimal Q-function;see for example Ormoneit and Sen 2003; Lagoudakis and Parr 2003; Ernst et al. 2005; Munos and Szepesvári 2008; Antos, Szepesvári and Munos 2008a; Antos, Szepesvári and Munos 2008b; Ertefaie and Strawderman 2018; Fujimoto, Meger and Precup 2019; Kumar et al. 2019; Agarwal, Schuurmans and Norouzi 2020. In practice, the optimal Q-function could be highly non-smooth and complex, thus requiring the use of a flexible function class. This usually results in a learned policy that is also complex. If interpretability is important, this is problematic. Furthermore, when the training data is limited, the flexible function class might overfit the data and thus the variance of the estimated value function and the corresponding policy could be high. Restricting to a pre-specified policy class was studied by Zhang et al. 2012; Zhang et al. 2013; Zhou et al. 2017; Zhao et al. 2015; Zhao et al. 2019; Athey and Wager 2017 in finite time horizon problems and by Luckett et al. 2019; Murphy et al. 2016; Liu et al. 2019 in infinite time horizon problems. The restriction to a simple policy class enhance the interpretability of the learned policy and reduces the variance of the learned policy, although this induces a bias when the optimal policy is not in the class (i.e., trading off the bias and variance).
To efficiently learn an optimal policy in a prespecified policy class, the main statistical challenge is to construct an estimator for the average reward of a policy that is both data-efficient and performs uniformly well when optimizing over the policy class. Our first contribution of this work is a novel doubly robust estimator (see Section 3); we show that this estimator achieves the semiparametric efficiency bound under certain conditions on the estimation error of nuisance functions (see Section 5). Doubly robust estimators have been developed in the finite time horizon problems (Robins, Rotnitzky and Zhao 1994; Murphy et al. 2001; Dudík et al. 2014; Jiang and Li 2016; Thomas and Brunskill 2016) and recently in the discounted reward infinite horizon setting (Kallus and Uehara 2019a; Tang et al. 2020). To the best of our knowledge, our doubly robust estimator for the long-term average reward is new. In the literature of the average MDP in the batch setting, only the non-doubly robust estimator proposed by Liao, Klasnja and Murphy 2019 for the long-term average reward can be shown to achieve the semi-parametric efficiency, although they did not explicitly derive it. Most of the previous works on the policy optimization/evaluation under this framework are focused the online setting or under parametric models (Mahadevan 1996; Abounadi, Bertsekas and Borkar 2001; Wan, Naik and Sutton 2021, e.g.,). Theoretical studies on the average reward MDP in the batch setting are very limited, especially under non-parametric models.
To establish the semiparametric efficiency of the doubly robust estimator and the regret bound, we derive finite-sample error bounds for two nuisance function estimators, a relative value estimator and a ratio estimator. The obtained error bounds are shown to hold uniformly over the prespecified class of policies. Both the relative value and ratio estimators are both derived from the same principle (i.e., coupled estimation; see Section 4). In the case of the ratio estimator, we use an iterative procedure to obtain a near-optimal error bound for the ratio estimator. To the best of our knowledge, this is the first theoretical result characterizing the ratio estimation error, which might be of independent interest.
The rest of the article is organized as follows. Section 2 formalizes the decision making problem and introduces the average reward MDP. Section 3 presents the proposed method of learning the in-class optimal policy, including the doubly robust estimator for average reward (Section 3.3). In Section 4, the coupled estimators of the policy-dependent nuisance functions are introduced. Section 5 provides a thorough theoretical analysis on the regret bound of our proposed method. In Section 6, we describe a practical optimization algorithm when Reproducing Kernel Hilbert Spaces (RKHSs) are used to model the nuisance functions. We further conduct several simulation studies to demonstrate the promising performance of our method in Section 7. All the technical proofs are postponed to the supplementary material.
Problem Setup
Suppose we observe a training dataset, that consists of independent, identically distributed (i.i.d.) observations of :
We use to index the decision time. The length of the trajectory, , is a fixed constant. is the state at time and is the action (treatment) selected at time . We assume the action space, , is finite. To eliminate unnecessary technical distractions, we assume that the state space, , is finite; this assumption imposes no practical limitations and can be extended to the general state space.
Consider a time-stationary, Markovian policy, , that takes the state as input and outputs a probability distribution on the action space, , that is, is the probability of selecting action, , at state, . The average reward of the policy, , is defined as
The induced Markov chain, , is irreducible for .
The goal of this paper is to develop a method that can efficiently use the training data, , to learn a policy that maximizes the average reward over . We propose to construct , an efficient estimator for the average reward, , for each policy and learn an optimal policy by solving
The performance of is measured by its regret, defined as
Note that although the average reward of the learned policy, , is defined over an infinite horizon, the goal here is to characterize the regret based on using a finite number of trajectories, , hence the finite sample regret bound is in terms of . Indeed while the average reward, is defined as (2.1), the Markovian and stationary assumptions allow us to estimate using fixed length trajectories.
Doubly Robust Estimator for Average Reward
In this section we present a doubly robust estimator for the average reward for a given policy. The estimator is derived from the efficient influence function (EIF). Below we first introduce two functions that occur in the EIF of the average reward. Throughout this section we fix a time-stationary Markovian policy, , and focus on the setting where the induced Markov chain, , is irreducible (Assumption 1).
First, we define the relative value function by
The relative value function, , and the average reward, , are closely related via the Bellman equation:
We now introduce the ratio function. For , let be the probability mass of state-action pair at time in the trajectory generated by the behavior policy. Denote by the average probability mass across the decision times in . Similarly, define as the marginal distribution of and as the average distribution of states in the trajectory . Recall that is the fixed length of the trajectory, ; describes the distribution of this finite length trajectory. Further recall that under Assumption 1, the stationary distribution of exists and is denoted by . We assume the following conditions on the data-generating process.
There exists some , such that for all and almost surely.
The average distribution for all .
Under Assumption 2, it is easy to see that for all state-action pair, . It essentially states that the data generating process ensures that every state-action pair has a positive probability of being visited, which is a standard assumption in the literature. See e.g., Theorem 7 of Kallus and Uehara 2019b and (A2) of Shi et al. 2020. In particular, Assumption (2-1) is often satisfied in randomized trials. See our mobile health application in Section 8. In addition, the batch data of our mobile health application consist of trajectories with decision points on each trajectory. In this application, as long as every state has a positive probability of being visited in at least one of decision points, Assumption (2-2) is also satisfied. Assumption (2-2) is imposed on the data generating process. We essentially require that across an infinite number of draws from this data generating process/trajectory, every state will be observed. Note that Assumption 2 does not require that the form of the behavior policy is known. Now we can define the ratio function:
The ratio function plays a similar role as the importance weight in finite horizon problems. While the classic importance weight only corrects the distribution of actions between behavior policy and target policy, the ratio here also involves the correction of the states’ distribution. The ratio function is connected with the average reward by
for any fixed trajectory length, . An important property of is that for any state-action function (not only ),
This orthogonality is key to develop the estimator for (see Section 4.3).
2 Efficient influence function
In this subsection, we derive the EIF of for a fixed policy under time-homogeneous Markov Decision Process described in Section 2. Recall that the semiparametric efficiency bound is the supremum of the Cramèr-Rao bounds for all parametric submodels (Newey 1990). EIF is defined as the influence function of a regular estimator that achieves the semiparametric efficiency bound. For more details, refer to Bickel et al. 1993 and Van der Vaart 2000. The EIF of is given by the following theorem. The proof is provided in Appendix A.
Suppose the states in the trajectory, , evolve according to the time-homogeneous Markov process and Assumption 2 holds. Consider a policy, , such that Assumption 1 holds. Then the EIF of the average reward, , is
Recall that we impose the Markovian and time-stationary assumptions on the data-generating process. Even though the parameter of interest here (i.e. the average reward ) is one-dimensional, there may exist multiple, non-efficient influence functions as a result of these assumptions on the multivariate distribution.
3 Doubly robust estimator
We have the following doubly robustness of this estimator (the proof is given in Appendix A).
Suppose and converge in probability to deterministic limits and uniformly over . If either or , then converges to in probability.
The uniform convergence in probability can be relaxed to convergence by using uniform laws of large numbers. The doubly robustness can protect against potential model mis-specifications since we only require one of two models is correct. Moreover, the doubly robust structure can be used to relax the required rate for each of the nuisance function estimation to achieve the semiparametric efficiency bound, especially if we use sample-splitting techniques (see Section 9), as discussed in Chernozhukov et al. 2018.
Estimators for the Nuisance Functions
Recall the doubly robust estimator (3.6) requires the estimation of two nuisance functions, and . It turns out that although these two nuisance functions are defined from different perspectives, both nuisance functions can in fact be characterized in a similar way. Both estimators can be obtained by minimizing an objective function that involves a minimizer of another objective function (“coupled estimation”). This can be viewed as a generalization of the classical M-estimator with a “plug-in estimator” in the sense that the the second objective function also involves the unknown parameters to be estimated. The idea of coupled estimation was previously used by Antos, Szepesvári and Munos 2008a; Farahmand et al. 2016 to estimate the value function in the discounted reward setting and recently by Liao, Klasnja and Murphy 2019 in the average reward setting. In what follows we provide a general coupled estimation framework and discuss the motivation for using it. We then review the coupled estimator for relative value function and ratio function in Liao, Klasnja and Murphy 2019.
Consider a setting where the true parameter (or function), , can be characterized as the minimizer of the following objective function:
2 Relative value function estimator
Let be the transition sample at time . For a given pair, let
where is the projected Bellman error at :
Given the estimator of the (shifted) relative value function, , we form the estimator of by
Throughout this paper, we use tuning parameters, , that do not depend on the policy. In the setting where the policy class is highly complex and the corresponding relative value functions are very different, it could be beneficial to select the tuning parameters locally at a cost of higher computation burden.
3 Ratio function estimator
Below we derive the estimator for the ratio function, using the coupled estimation framework. In particular we estimate a scaled version of the ratio function (denoted by below) and then convert this back to an estimator of . To estimate , we first construct a new MDP and estimate the relative value function for this new MDP (denoted by ) using the coupled estimation framework. The estimator of is then derived from the estimator of .
By definition, . If we were to replace the reward function in our MDP by , then the “average reward” of in this new MDP is constant and equal to zero under Assumption 1 (i.e., ). The “relative value function” of policy under the new MDP is,
Note that is well-defined under Assumption 1. Furthermore, consider the following Bellman equation for the new MDP:
where for any , solves
Recall that can be written in terms of by (4.7); that is, re-arranging terms,
The above ratio function estimator was developed by Liao, Klasnja and Murphy 2019. In this paper we, for the first time, derive a finite-sample error bound for this ratio function estimator, uniformly over the policy class (Theorem B.2 in the appendix). This is the key element in establishing the finite-sample bound regret bound for the estimated optimal policy.
Our ratio function estimator is different from most in the existing literature, such as Liu et al. 2018; Uehara and Jiang 2019; Nachum et al. 2019; Zhang et al. 2020, which are obtained by min-max based estimating methods. For example, Liu et al. 2018 aimed to estimate the ratio between stationary distribution induced by a known, Markovian time-stationary behavior policy and target policy, which is then used to estimate the average reward of a given policy. This is not suitable for the setting where the behavior policy is history dependent. Uehara and Jiang 2019 estimated the ratio, , based on the observation that for every state-action function ,
where is a simplex space and is a set of discriminator functions. This method minimizes the upper bound of the bias of their average reward estimator if the state-action value function is contained in . They proved consistency of their ratio and average reward estimators in the parametric setting, that is, where can be modelled parametrically and is a finite dimensional space. Subsequently Zhang et al. 2020 developed a general min-max based estimator by considering variational -divergence, which subsumes the case in Uehara and Jiang 2019. Unfortunately, there are no error bounds guarantee for ratio function estimators developed in Uehara and Jiang 2019 and Zhang et al. 2020. Our ratio estimator appears closely related to the estimation developed by Nachum et al. 2019 as they also formulated the ratio estimator as a minimizer of a loss function. However, relying on the Fenchel’s duality theorem, they still use the min-max based method to estimate the ratio. Furthermore, their method cannot be applied in average reward settings. Instead of using min-max based estimators, we use coupled estimation. This will facilitate the derivation of estimation error bounds as will be seen below. We will derive the estimation error of the ratio function, which will enable us to provide a strong theoretical guarantee, and finally demonstrate the efficiency of our average reward estimator without imposing restrictive parametric assumptions on the nuisance function estimations, see Section 5 below.
Theoretical Results
In this section, we provide a finite sample bound on the regret of defined in (2.4), i.e., the difference between the optimal average reward in the policy class, , and the average reward of the estimated policy, .
We make use of the following assumption on .
There exists , such that for and for all , the following holds
There exists constants and , such that for every , the following hold for all :
The Lipschitz property of the policy class (3-2) is used to control the complexity of nuisance function induced by , that is, and . This is commonly assumed in the finite-time horizon problems (e.g., Zhou et al. 2017). Assumptions (3-1) and (3-2) can be easily satisfied by many policy classes such the one we used in Section 7. Our analysis can be extended to more general policy classes if a similar complexity property holds for these two nuisance function classes. Intuitively the constant in the assumption (3-3) relates to the “mixing time” of the Markov chain induced by . A similar assumption was used by Van Roy 1998; Liao, Klasnja and Murphy 2019 in average reward setting. Specifically, Equation (5.1) in Assumption (3-3) is used to show that two nuisance functions and are Lipschitz continuous with respect to the policy parameter so that we can quantify their estimation error uniformly over the policy class. See Lemma C.1 of Supplementary Material for more details. Equation (5.2) in Assumption (3-3) basically requires an exponential convergence rate of the policy induced Markov chain to the stationary distribution in terms of the expectation under the -norm with respect to the data generating process. This assumption, together with Assumption (5-3) stated below is used to guarantee the Bellman operator for based on Equation (3.2) (or a similar quantity related to the ratio function estimation defined in Lemma B.4 of Supplementary Material) is well-posed in the sense of -norm with respect to the data generating process so as to derive their estimation errors. See Lemma B.5 of Liao, Klasnja and Murphy 2019 and Lemma B.4 of Supplementary Material for more details.
Recall that we use the same pair of function classes in the coupled estimation for both and . We make the following assumptions on .
The function classes, , satisfy the following:
and
The regularization functionals, and , are pseudo norms and induced by the inner products and , respectively.
Let and . There exists and such that for any ,
We now introduce the assumption that is used to bound the estimation error of value function uniformly over the policy class. Define the projected Bellman error operator:
The triplet, , satisfies the following:
A similar set of conditions are employed to bound the estimation of ratio function. For and , define the projected error:
where, as before, .
The triplet, , satisfies the following:
, for .
There exists two constants such that holds for and .
Suppose Assumptions 1 to 6 hold. Let be the estimated policy (2.3) in which the nuisance functions are estimated with tuning parameters , for some constant . Define . Fix any integer , and sufficiently large . With probability at least , we have
Recall that is the number of parameters in the policy, is given in (4-4), and is the number of trajectories in the data. Theorem 5.1 shows that when the tuning parameters are of the order , the regret of the estimated policy is . The leading term (in terms of ), , corresponds to the regret of an estimated policy as if the nuisance functions are known beforehand. The second term is due to the estimation error of nuisance functions. In particular, we show in Theorem B.1 in Section B of the appendix that the uniform estimation error of the relative value function is of and in Theorem B.2 in the same section that the uniform estimation error of ratio is of (see the remark after Theorem B.2 for why the rate depends on ). Note that the error of ratio is the dominant term as and can be chosen arbitrarily close to by choosing a sufficiently large . Therefore the proposed ratio estimator can achieve the near-optimal nonparametric convergence rate. See the proof of Theorem B.2 in Section B.1 of the appendix for more details. To the best of our knowledge, this is the first result that characterizes the regret of the estimated optimal in-class policy in the infinite horizon setting.
2 Asymptotic results
In this section, we prove that the average reward for our estimator of the optimal policy converges to the optimal average reward at a parametric rate (i.e., ). Recall is the efficient influence function of given in Theorem 3.1.
Suppose Assumptions 1 to 6 hold. For each , let be the doubly robust estimator defined in (3.6) and be the estimated policy defined in (2.3) with tuning parameters , for some constant . Then as ,
The first result shows that the estimated average reward by the doubly robust estimator reaches the semiparametric efficiency bound when we plug in the estimator for the two nuisance functions. The double robustness structure ensures that the estimation error of nuisance functions is only of lower order and does not impact the asymptotic variance of the estimated average reward. The second result shows the asymptotic of the estimated optimal value, , converges to the maximum of the Gaussian process at the optimal policies. When there is a unique optimal policy , we have weakly converges to a Gaussian distribution. Estimating the limiting distribution could be challenging (especially when there exists non-unique policies) and is left for future work. Alternatively one can consider resampling-based method to construct confidence interval for (see the recent work by Wu and Wang 2020 in single-stage problem).
Practical Implementation
In this section, we describe an algorithm to estimate an in-class optimal policy based on our efficient average reward estimator . Without loss of generality, we consider a binary-action setting, i.e., , and the following stochastic parametrized policy class indexed by :
for some pre-specified constant . Note that other link functions such as the probit function might be used here instead. Here refers to sup-norm in Euclidean space. We fix throughout our paper. In addition, we set and in the estimation of both value and ratio functions to be Reproducing Kernel Hilbert Spaces (RKHSs) associated with Gaussian kernels because of the representer theorem and the property of universal consistency.
The constraint on , , is used to maintain sufficient stochasticity in our learned policy. The stochasticity facilitates the use of as a “warm start" policy for use by an online algorithm with future individuals. A nice side effect is that the restriction on provides a computational stability and can avoid degenerative cases in policy optimization similar to that when using logistic regression in classification problems (Friedman, Hastie and Tibshirani 2001). As discussed in the introduction, we consider the simple policy class instead of nonparametric models such as neural networks or tree-based models mainly due to the concern of overfitting. In the batch setting, data are limited and often noisy. Using flexible function classes for modeling the policy may lead to overfitting and thus the variance of the resulting policy could be very large. The use of a simple policy class can reduce the variance while it may induce some possible bias. In addition, interpretability is critical in our batch policy learning problem. The interpretability of decision tree models are often not very stable, whereas neural networks are not very interpretable. Therefore we prefer using this simple policy class .
To obtain , we solve a multi-level optimization problem (6.1)-(6.5). Recall a multi-level optimization problem (Richardson 1995) is a optimization problems in which the feasible set is implicitly determined by a sequence of nested optimization problems. It typically consists of an upper level optimization task that represents the objective function, and a series of (possibly nested) lower level optimization tasks that represents the feasible set.
As a reminder, recall that in Section 4 we have defined
Also, the ratio estimator can be obtained from by using (4.10).
The upper optimization task (6.1) is used to search for and the two parallel lower optimization tasks (6.2)-(6.3) and (6.4)-(6.5) are used to compute two nuisance function estimators for a given , i.e., the feasible set, respectively. Note that each nuisance function estimation is itself a nested optimization sub-problem. Multi-level optimization problems in general cannot be computed by iteratively updating solutions to lower problems (6.2)-(6.3) and (6.4)-(6.5), and solutions to the upper problem (6.1), in a similar manner to coordinate descent. Hence, in order to solve this problem, one common approach is to replace the inner optimization problems (6.2)-(6.3) and (6.4)-(6.5) by their corresponding Karush-Kuhn-Tucker (KKT) conditions so that the overall problem can be equivalently formulated as a nonlinear constraint optimization problem. However, this approach can be computationally expensive and may not be suitable for large scale settings. Instead we overcome this computational obstacle by using the representer theorem and obtain the closed-form solutions for our inner optimization problems (6.2)-(6.3) and (6.4)-(6.5) respectively. After plugging these closed-form solutions into (6.1), we can use a gradient-based method to find .
In the following subsection, we briefly discuss how to simplify our multi-level optimization problem (6.1) using the representer theorem. The details of computation can be found in Appendix E. For the ease of illustration, we rewrite the training data into tuples where indexes the tuple of the transition sample in the training set , and are the current and next states and is the associated reward. Let be the state-action pair, and . Suppose the kernel function for the state is denoted by , where . In order to incorporate the action space, we can define . Basically, we model each separately for each arm in the RKHS with the same kernel . Recall that we have to restrict the function space such that for all so as to avoid the identification issue. Thus for any given kernel function defined on , we make the following transformation by defining for any . One can check that the induced RKHS by satisfies the constraint in automatically.
We denote kernel functions for and by respectively. The corresponding inner products are defined as and . We first discuss the inner minimization problem (6.2)-(6.3). Note that this is indeed a nested kernel ridge regression problem, different from the standard ridge regression. The closed form solution can be obtained as . In particular, , where and is the kernel matrix induced by , , and is a vector of TD error. Each TD error can be further written as where
Summarizing together and plugging all the intermediate results into (6.1), the multi-level optimization problem can be simplified as:
where is a length- vector of all ones.
2 Optimization
Note that problem (6.6) becomes a smooth nonlinear optimization with box constraints. We use limited-memory Broyden-Fletcher-Goldfarb-Shanno algorithm with box constraints (L-BFGS-B) to compute the solution (Liu and Nocedal 1989). The gradient computing is provided in appendix. The computational complexity/operations of our algorithm is of order , where is the number of iterations in our optimization algorithm. The memory requirement is of order . One may implement some sub-sampling methods such as stochastic gradient decent to further improve both computation and memory complexity of our algorithm. We will leave it for future work. Although the overall optimization problem is non-convex and, thus an optimal solution may not be achievable, the performance of our numerical experiments in the following section are quite stable and promising. Recently, there is a growing interest in studying statistical properties of algorithm-type of nonconvex M-estimators, e.g., (Mei et al. 2018; Loh et al. 2017). For many practical applications, gradient decent methods with a random initialization have been demonstrated to converge to local minima (or even global minima) that are statistically good. While this is not the focus of our paper, it will be interesting to pursue toward this direction for future research such as studying the landscape of and its related properties.
3 Tuning parameters selection
In this subsection, we discuss the choice of tuning parameters in our method. The bandwidths in the Gaussian kernels are selected using median heuristic, e.g., median of pairwise distance (Fukumizu et al. 2009). The tuning parameters and are selected based on 3-fold cross-validation. Given assumptions in Theorems B.1 and B.2 of the appendix that these tuning parameters are independent of the policy , we can select them for the ratio and value functions separately. Specifically, for the tuning parameters in the estimation of value function, we focus on (6.2)-(6.3). For the tuning parameters in the estimation of ratio function, we focus on (6.4)-(6.5). At the first glance, one may think the selection of tuning parameters will be the same as those in the standard supervised learning. However, this actually requires an additional step as we cannot observe responses when estimating these two coupled estimators (recalled that we need to first compute projected bellman errors), in contrast to the standard kernel regression setting. In the following, we discuss our selection procedure of and with more details.
We first randomly choose a set of candidate policies used to gauge our tuning parameters. For each candidate policy, , in this set, we can firstly estimate by the proposed method using two folds of data. Then for the value function estimation, we calculate temporal difference errors for each transition sample in the validation set. Since we cannot observe/calculate the true bellman error, following the idea in (Farahmand and Szepesvári 2011), we estimate the Bellman error by projecting these temporal differences on the space of in the validation set using the standard Gaussian kernel regression. Thus for each policy and each pair of tuning parameters, we output the squared estimated Bellman error in the validation set as a criterion to evaluate the performance of our value function estimation. Since tuning parameters are assumed independent of policies, we then select the tuning parameters that minimize the worst case of estimated Bellman errors among the set of all candidate policies. We use the same strategy to select the tuning parameters for our ratio estimation. The details are given in the Algorithm 1. Without the independent assumptions of tuning parameters from the policies in , one may alternatively choose these tuning parameters jointly by maximizing on the validation set, which requires large computational costs and we omit here. But it would be very interesting to study the theoretical properties of these two cross-validation procedures, or more generally, the selection of tuning parameters in the framework of couple estimation, which we leave it as future work.
Simulation Studies
In this section, we consider two scenarios to evaluate the proposed algorithm. For both scenarios, we consider as a three-dimensional state at each decision point , and the action space is binary, i.e., . The behavior policy used to generate actions follows Bernoulli distribution with equal probabilities. In addition, the initial state is sampled from standard multi-variate normal distribution, i.e.,
The first scenario we consider is a standard MDP setting. Let follows a standard multi-variate normal distribution. Then we generate the transition of states and reward functions via following models:
for . Here can be interpreted as the treatment burden or fatigue.
The second scenario we consider is a non-stationary environment. In particular, we consider the same transition models as above, but let the reward function to be time-dependent. More specifically, we consider
where the time-varying parameters and . This generative model represents the scenario in which as the study progresses, the overall impact of intervention is decreasing. Note that since the reward function is non-stationary, we do not have a guarantee for our proposed algorithm to find an optimal policy.
We compare with four baseline methods, which were proposed in the setting of the discounted sum of rewards. The first two are recently proposed deep off-policy RL algorithms (Fujimoto, Meger and Precup 2019; Kumar et al. 2019) denoted by BCQ and BEAR respectively. The underlying idea behind these two state-of-art algorithms is to conservatively estimate the optimal -function on the less explored state-action pair and restrict the resulting policy close to the behavior one. The third method is the celebrated fitted-Q iteration (FQI) method proposed by Ernst et al. 2005. At each iteration, relying on the optimal Bellman equation, FQI algorithm updates the estimation of the optimal -function via solving a supervised learning problem. The last method is V-learning proposed by (Luckett et al. 2019), which also aims to learn an optimal in-class policy. Since our goal is to maximize the long-term average reward, we set the discount factor in these four methods as to approximate the average reward for comparison. In addition, to draw a relatively fair comparison, we implement these four methods using the same policy class as ours. Specifically, the first three methods will output an estimation of the optimal -function (defined in the discounted setting), after which we implement a weighted logistic regression to estimate the optimal in-class policy. For V-learning, we keep the default setup and use the same policy class as ours. Finally, for BEAR and BCQ, we use two-hidden layers neural networks with 32 nodes for each and ReLU activation functions to model the optimal -function. The other hyper-parameters are either tuned for their best performance, or recommended in the official implementation as robust choices. For FQI, we implement a kernel ridge regression at each iteration with tuning parameters selected similar to our nuisance parameter estimation.
Results of the above two scenarios can be found in Table 1. As we can see, our algorithm performs well in finding optimal in-class stationary policies, compared with the other four baseline methods. Compared with the oracle one with the best average reward about , the regret of our algorithm is almost the smallest among all these methods, which is expected as we aim to maximize the average reward while the other four methods are for maximizing the discounted sum of rewards. For BEAR and BCQ with neural network models, due to the relatively small sample size and a large discount factor , the performances seem unstable. FQI and V-learning methods overall show competitive performances. But it can be seen that V-learning may suffer some large variance. In addition, one possible reason for the high quality performance of our method in Scenario 2 is that the time-dependent effect in reward function is exponentially decaying by our design. Therefore we expect the performance of our algorithm may not be affected severely by the non-stationarity. In addition, it can be seen that as the sample size or the length of each trajectory increases, the average rewards of our estimated policies are also improved, demonstrating the appealing performance of the proposed method. Finally, we remark that the maximum running time of our method for one replication in our simulation studies is less than 40 minutes.
Application to mobile health
We apply the proposed method to HeartSteps. HeartSteps is mobile health application focusing on physical activity. Three studies were conducted to develop the intervention. In this work, we apply the proposed method to the data collected from the first study, which we will refer to as HS1 in the throughout. HS1 is a 42-day micro-randomized trial (Klasnja et al. 2015; Liao et al. 2016). Each participant was provided with a Jawbone wrist tracker to collect step count data and specified five decision times, roughly 2.5 hours apart during each day, that would be good times to potentially receive contextually tailored activity suggestion message. In HS1, the activity message was sent with a fixed probability 0.6 at each of the five decision times. Our goal is to use HS1 data to learn a treatment policy that determines at each decision time whether to send the activity message (i.e., binary action).
We construct the state variable using the previous step count (the 30-min step count prior to the decision time and from yesterday), location, temperature and past notifications. We set the reward to be the log transformation of the step count in 30-min window after each decision time. In this analysis, we include 37 participants’ data and exclude the decision times when participants were traveling abroad or experiencing technical issues or when the reward (i.e., post 30-min step count) was considered as missing (Klasnja et al. 2018).
Next, we construct the policy class. In this analysis, we include two state variables in the policy. The first variable is the location (home/work vs. other locations). Location is important because people, in a more structured environment (i.e. at home or work), may respond better to an activity suggestion as compared to when they are at other locations. As a proxy for participant burden, the second variable included in the policy is “dosage”, a discounted sum of the number of past activity messages sent with the discount rate chosen as 0.95. The rationale for using this variable is that receiving too many notifications in the recent past is likely to decrease the effectiveness of sending the activity message due to over-burdening participants. We consider the policy class of the form , where the feature vector and is the box constraint within -10 and 10. Here dosage is standardized to be within 0 and 1.
We apply the proposed method with the tuning parameter selected by cross-validation in Algorithm 1. The estimated coefficients are . Figure 1 shows the estimated policy at different combination of dosage and location. As one would expect, the learned policy tends to send fewer suggestions if the participant received many suggestions in the recent past. Also, the policy indicates that it is more effective to send the message when the user is at home/work location. The estimated average reward of this policy is 3.301. As a comparison, the estimated average reward of the simple location-based policy (i.e., send only when the user is at home/work) is 3.15 and the send-nothing policy is 2.96. Transforming to the scale of the raw step count as that in (Klasnja et al. 2018), the learned policy can result in (i.e., ) improvement, which is equivalent to more steps (the mean step count across all decision times in the data is ) compared with the simple location-based policy, and (i.e., ) improvement, or equivalently steps more, compared with the send-nothing policy. Lastly, we remark that the running time of our real data analysis is about hours, which is acceptable in the batch setting. This is ultimately different from online RL domains where the policy is usually updated upon the arrival of each observation.
Discussion
Double/Debiased machine learning An alternative way to construct the estimator for the average reward is based on the idea of double/debiased machine learning (a.k.a. cross-fitting, Bickel et al. 1993 and Chernozhukov et al. 2018). There is growing interest in using double machine learning in causal inference and in the policy learning literature (Zhao et al. 2019) in order to relax assumptions on the convergence rates of nuisance parameters. The basic idea is to split the data into folds. For each of the folds, construct the estimating equation by plugging in the estimated nuisance functions that are obtained using the remaining folds. The final estimator is obtained by solving the aggregated estimation equations. While cross-fitting requires weaker conditions on the nuisance function estimations, it indeed incurs additional computational cost, especially in our setting where nuisance functions are policy-dependent and we aim to search for the in-class optimal policy. Further, this sample splitting procedure may not be stable when the sample size is relatively small, e.g., in a typical mHealth clinical trial. A more efficient way of data splitting under the framework of MDP is needed, which we leave as future work
Computation and optimization Our current algorithm requires relatively large computation and memory because of the non-parametric estimation and the policy-dependent structure of nuisance functions. It is therefore desirable to develop a more efficient algorithm. One possible remedy is to consider a zero-order optimization method such as Bayesian optimization (Snoek, Larochelle and Adams 2012), which is suitable when the dimension of state variables is small. Another possible way to improve the computational efficiency is to first apply some simple algorithm to estimate a sub-optimal policy, based on which we can implement our method to estimate two nuisance parameters. Then one can develop the performance difference lemma in terms of the average reward MDP, similar to that in the discounted setting (Kakade and Langford 2002), to construct a lower bound for using two estimated nuisance parameters. The last step is to optimize this lower bound for obtaining a better policy. This method may require less computational cost.
Tuning parameters/Model selection In our proposed algorithm, we assume tuning parameters are independent of policies, based on which we develop a min-max cross-validation procedure for the selection of tuning parameters. Model selection in the offline RL setting, which is necessary for improving generalization of RL techniques, is often considered as a challenging task as there is no ground truth available for performance demonstration, in contrast to the online setting with simulated environment. Therefore, it will be interesting to systematically investigate how to perform model selection in offline RL and to provide theoretical guarantees.
Acknowledgements
Peng Liao was supported by NIH grants P50DA039838, R01AA023187, and U01 CA229437. Susan Murphy was supported by NIH grants P50DA039838, R01AA023187, P50DA054039, P41EB028242, U01 CA229437, UG3DE028723, and UH3DE028723. The authors would also like to thank two reviewers, the Associate Editor and the Editor for helpful comments and suggestions that led to substantial improvement in the presentation.
A Semi-parametric efficiency bound and doubly robustness
In this section, we calculate the semi-parametric efficient influence function and proves the doubly robustness. Denote by the likelihood of a parametric sub-model of the data collected over decision times:
Then the score function of the above parametric sub-model is given by
where is , , and for .
If is an influence function, then for any parametric submodel that contains the true parameter ,
Plugging into RHS and using the definition of score function gives
where follows the stationary distribution under the true model.
For the LHS, we start with the Bellman equation: for any , we have
where we write and as and to explicitly indicate its dependency on . Taking the derivative implies
where in the second last line we use . Now averaging over the stationary distribution of the state-action pair gives
For the first term, using the definition of stationary distribution we have
(i) The tangent space is given by
(ii) The orthogonal complement of the tangent space is
Given the expression of score function , we can obtain statement (i). In particular, is induced by , is induced by for , and is induced by for . See Theorem 1 of (Kallus and Uehara 2020). For any and , we can show that is orthogonal to . Without loss of generality, suppose . Then for any and ,
where the second equality is by Markov property. By the similar argument, we can also show that is orthogonal to for and . In addition, for , we can show is orthogonal to by again similar argument.
In order to derive the orthogonal complement of tangent space , we first note that
is the space of all random functions with mean zero and finite variance, where
for , are orthogonal to each other. Then it is enough to project each elements in onto the orthogonal complement of for and respectively.
First of all, we can see that is orthogonal to for by the definition of . Secondly, it is straightforward to show that is orthogonal to
which is indeed also orthogonal to for . Then projecting each element in onto the orthogonal complement of is equivalent to projecting onto the orthogonal space of
which gives us exactly . This concludes statement (ii).
The first term is zero since by definition of TD error and thus orthogonal to . For the second term, for any , we have
If , then by the definition of stationary distribution, we have
If , which implies , then
converges to in probability. This concludes our statement. ∎
B Theoretical Results on Nuisance Function Estimation
In this section, we present two finite sample upper bounds for the estimation error of the nuisance functions that holds uniformly over the policy class. These results are needed to prove Theorem 5.1 and 5.2.
We first present the uniform bound for the estimation error of over . This is a generalization of Theorem 1 in Liao, Klasnja and Murphy 2019 in which they focused only on a single policy.
where
Since the proof is similar to that in (Liao, Klasnja and Murphy 2019) with additional efforts on controlling complexity of the policy class , we omit here. Next we present the uniform finite sample bound for the ratio estimator.
where and .
Recall that the optimal convergence rate for the classical nonparametric regression problem under the entropy condition (6-4) is . Theorem B.2 shows that the the ratio estimator achieves the near-optimal convergence rate. As we have seen in Theorem 5.2, the achieved error rate is enough to guarantee the asymptotic efficiency of the doubly robust estimator; in fact we only need to ensure the error decays faster than .
Suppose . Fix some . Under Assumptions (2-1), (2-2), (3-3), (4-1), (4-2), (6-1), (6-2), (6-3), (6-4) and (4-4), the followings hold with probability : for all :
Denote the leading constant in Lemma B.1 by . For the choice of tuning parameters , Lemma B.1 and Assumption (6-4) imply that w.p. , for all , the first term in (B.1) can be bounded by
where and .
Now consider the second term. Denote the leading constant in Lemma B.2 by . Applying the Decomposition Lemma B.2 implies that w.p. , for all
With the choice of , can be bounded by
As a result, we obtain that with probability at least , for all ,
Initial Rate We derive an initial rate by bounding uniformly over . Let
where the function class is given by
and thus we have , where
Applying Lemma B.3 with and implies that the following holds with probability at least :
Dividing on both sides gives
Let and the above inequality becomes for some . When , we have , or . When , we have . Thus . Now we have
Now using (B.3), w.p. for all :
Let , and . We have shown that with probability at least , the inequalities (B.2), (B.3) and the followings hold:
Rate Improvement Let and . Denote by the event that the inequalities (B.3), (B.2) holds and
We have shown that . Below we improve the rate by refining the bound of the remainder term, . First, we note that for the constant, , specified in the condition, under the event ,
see Lemma B.4 for the deviation of the second inequality and similarly,
Combing with (B.2), which holds under the event , we have
Thus using the same argument as in the proof of Lemma B.2 gives
We now obtain that the following holds w.p. , for all
Thus the convergence rate is improved to and . The same procedure can be applied times. It is easy to verify that for any , and and thus the desired result. ∎
Recall the ratio estimator, in (4.10). From Theorem B.3 and Lemma B.1, w.p. for all we have
where, as in the beginning of the proof of Theorem B.3, and is the leading constant in Lemma B.1. As such, we have
For simplicity, let . On the other hand,
where . Using Lemma B.1, w.p for all ,
where is the leading constant in Lemma B.1. Combining with the bound on in Theorem B.3 gives that
Together with the bound on , we have
Recall that . As a result, . Finally we have
where the leading constant only depends on
For , we introduce
Thus we have , where
For the first term, the optimizing property of implies that
Thus, holds for all .
where we introduce . Fix some .
Next we verify the conditions (A1 - A4) in Theorem 19.3 in (Györfi et al. 2006) with , and to get an exponential inequality for each term in the summation, similar to the proof of Lemma B.2 below.
The (A1) and (A2) conditions are easy to verify using Assumptions (4-1), (6-1) and (6-2). For (A1), it is easy to see that
and thus . For (A2), note that
To ensure the condition (A3) holds for every , i.e., (recall and ), we just need to ensure the inequality holds for , i.e.
That is, where .
Next we verify the condition (A4). It is straightforward to see that with , we have
where is a class of state-only function depending on the policy class and the function class . Let . As a result of the entropy condition in Assumption (4-4), we have
Or equivalently . Clearly we only need to ensure the inequality holds when is at the minimum. That is, below is sufficient for the condition (A4) to hold:
To ensure the above holds for all , we require to satisfy
Or, simply requiring where .
To summarize, the conditions (A1-A4) would be satisfied for every as long as and . Applying Theorem 19.3 in (Györfi et al. 2006) for each term implies that
where . For any , when , we have both and and as a result
Collecting all the conditions on and combing with the bound of , we have shown that w.p. at least , the following holds for all :
where the leading constant can be chosen by .
Suppose Assumptions (4-1), (4-2), (6-1), (6-2), (6-4), (4-4) and (3-2) hold. Then, the following hold with probability at least : for all policy :
and the remainder term, is given by
For , define the functionals ,
Using the optimizing property of in (4.8), the term in the first parentheses can be bounded
where in the last equality we use the fact that . In summary, we have
Below we provide the upper bound for each of the three terms. Recall that by Lemma B.1, the event, holds with probability at least . Let the leading constant specified in Lemma B.1 be .
Step I: bounding Under the event , we have
In addition, under the event , we have
For simplicity, let . Under , we have
Now we have and we bound the first term using peeling device on in :
where . In what follows we verify the conditions (A1-A4) in Theorem 19.3 in (Györfi et al. 2006) with , and to get an exponential inequality for each term in the summation.
For (A1), it is easy to see that . We set .
For (A2), we have . We set .
For (A3), the condition becomes . So this holds for all as long as for .
Now we verify the condition (A4). First note that for any
The Assumption (4-4) then implies that the metric entropy for each is bounded by
where in the last inequality is specified in Assumption (4-4) and the constant , . Now we just need to ensure for all and :
Note that . The above equality is equivalent with the following:
Note that the LHS is a increasing function of . It’s then enough to ensure the followings hold for all :
The above is satisfied for all by choosing large enough . For example, the first one holds whenever
Similarly, the second and third inequalities hold for all if
Thus the third one can be reduced to require such that
In summary, all conditions (A1) to (A4) would be satisfied for all when
We can now apply Theorem 19.3 in (Györfi et al. 2006) for each -th term. Similar to the proof of Lemma B.1, we have
where . When , we have both and and thus
Summary Collecting the three bounds on , for , we have
where is a constant independent of the policy
Under Assumption 4, the following holds with probability at least ,
Let and . Then by Lemma 2.2 in (Chernozhukov et al. 2014),
Let , then we can show that
where . By Talagrand’s inequality, with probability , we have
Suppose Assumptions 2, (3-3) and (6-3) hold. For any , we have
where we use Lemma B.4 in Liao, Klasnja and Murphy 2019 in the last inequality. Next we can apply Lemma B.5 in Liao, Klasnja and Murphy 2019 to get
where in the last equality we use the fact that the operator is invariant to the constant shift. Now we can use Assumption (6-3) to bound the last term and get
Combining the two inequalities gives the desired result. ∎
C Regret Bound
Since is compact and is continuous according to Lemma C.1, there exists , such that . Let . We bound the regret by
(i) Leading Term For any , we have
Using Lemma C.1 and Assumption , (4-1), (6-1), (6-2) and (5-1), it can be seen that
On the other hand, for any constant , we have
where we define the state-only relative value function by . By choosing , we can apply Lemma C.1 to bound and get
Here are the constants in Lemma C.1. Let , we have
The maximal inequality with bracketing number then gives that
where and the bracketing entropy . Using the Lipschitz property gives
where .
(ii) Remainder Term For the ease of notation, define
Consider the first term. The doubly-robustness structure of the efficient influence function, Lemma 3.2, implies that
Using Theorem B.2 and Theorem B.1, there exists constant such that
Since , we have and . This implies that
Now we consider the second term. There exists , such that where and
where and . Here is given by
where and . Applying a slightly modified version of Lemma B.3 implies that for some constant ,
Thus
Define the state relative value function . Under Assumption 1, (3-2) and (3-3), there exists constants that depend on only and , such that for any
where
It can be seen that Assumption (3-3) implies geometrically ergodic. Then the first inequality in the first statement is given by Corollary 3.1 of Mitrophanov 2005, where the constant in this inequality can be chosen as . Furthermore, we can see that
where the first inequality uses Assumption (3-2) and denotes the number of actions.
Next we show the second statement of this lemma. From Bellman equation, we have
where in the second equality we use the fact that the operator is invariant to a constant shift so that the also solves Bellman equation. As a result, we have
On the other hand, it is straightforward to show that
Thus for , we have for any ,
Now we can then bound by
where . Recall that . By definition of , we have . Using Assumption (3-3), we have
where and are the constants specified in Assumption (3-3). Since , we can choose large enough so that . We then have
D Asymptotic result
In the proof of Theorem 5.1, we’ve shown that under the listed assumptions, there exists some constant , such that with probability at least , . Recall that and does not depend on (see the exact dependence in Theorem 5.1). Because is an increasing sequence and the limit , we can choose such that and thus
We now show the first term in (D.1) converges weakly to a Gaussian Process. In other words, the function class is a Donsker. As shown in (C.1) in the proof of Theorem 5.1, we have is Lipschitz, i.e., there exists constant such that for any trajectory , . As a result, the bracketing entropy integral is finite (see (C.2) for more details). The weakly convergence then follows by the classic Donsker Theorem (see for example Theorem 2.3 in Kosorok 2007). Finally, applying the Slutsky’s theorem (Theorem 7.15 in Kosorok 2007) proves the first statement in the theorem.
E Further details of implementation in RKHS
Below we provide the details of our computation in Section 6. To be complete, we start with our overall optimization problem.
Following the main text, we rewrite the training data into tuples where indexes the tuple of transition sample in the training set , and are the current and next states and is the associated reward. Let be the state-action pair, and . Here we do not consider baseline features. However, this can be readily generalized. See Liao, Klasnja and Murphy 2019 for more details. Suppose the kernel function for the state is denoted by , where . In order to incorporate the action space, we can define . Basically, we model each separately for each arm in the RKHS with the same kernel . Recall that we have to restrict the function space such that for all so as to avoid the identification issue. Thus for any given kernel function defined on , we make the following transformation by defining . One can check that the induced RKHS by satisfies the constraint in automatically.
We denote kernel functions for and by respectively. The corresponding inner products are defined as and . We first discuss the inner minimization problem (6.2)-(6.3). Note that this is indeed a standard kernel ridge regression problem. The closed form solution can be obtained as . In particular, , is the kernel matrix of , , and is a vector of TD error. Moreover, each TD error can be further written as where
which gives the expression of , a by matrix.
Similarly, we can find the closed-form solution for the problem (6.3)-(6.4) and compute its gradient. By some linear algebra, we can obtain , where and satisfying the following two equations:
given again by the representer theorem, where is an intermediate term. We then can compute the Jacobian matrix of by again the implicit theorem using equations (E.11) and (E.12) and solving based on the following two equations.
Summarizing together by plugging all the intermediate results into the objective function of our upper optimization problem (6.1), we can simplify it as
The corresponding gradient with respect to can be computed directly as
F Additional Numerical Results
In this section, we compare our proposed method with the three baseline methods via another simulation study. The simulation setting is designed as the same as those in Luckett et al. 2019. Specifically, we initialize two dimensional state vector by a standard multivariate Gaussian distribution. Given the current action and state , the next state is generated by:
where each follows independently for . The reward function is given as
for . We consider the behavior policy to be uniformly random, i.e., choosing each action with equal probability.
We consider different combinations of the number of trajectories and the length of each trajectory to evaluate the performance of our method. Specifically, we consider and , and replicate each setting for 128 times. To calculate the regret of our learned policy, basically we consider different policy parameters , with the value of each dimension of ranging from to . For each of these policies, we generate one trajectory with length following the corresponding policy, discard the first 5000 time points and take the average of the remaining rewards. Assuming achieving stationary distribution after , we use the largest average rewards among these policies as our optimal in-class average reward. Using a similar procedure, we can also compute the average reward of each of the learned learned policy under different settings. The regrets can be obtained by subtracting them from the optimal in-class average reward, which are provided in Table 2. In Table 3, we report mean and standard error of the average rewards of policies given by our method, BEAR, BCQ and FQI respectively. It can be seen that all reported regrets (or average rewards) of our method are the smallest (or the largest), indicating that our method can learn desirable in-class policies, compared with other three methods.