Learning to Optimize Via Posterior Sampling
Daniel Russo, Benjamin Van Roy
Introduction.
We consider an optimization problem faced by an agent who is uncertain about how his actions influence performance. The agent selects actions sequentially, and upon each action observes a reward. A reward function governs the mean reward of each action. The agent represents his initial beliefs through a prior distribution over reward functions. As rewards are observed the agent learns about the reward function, and this allows him to improve his behavior. Good performance requires adaptively sampling actions in a way that strikes an effective balance between exploring poorly understood actions and exploiting previously acquired knowledge to attain high rewards. In this paper, we study a simple algorithm for selecting actions and provide finite time performance guarantees that apply across a broad class of models.
The problem we study has attracted a great deal of recent interest and is often referred to as the multi-armed bandit (MAB) problem with dependent arms. We refer to the problem as one of learning to optimize to emphasize its divergence from the classical MAB literature. In the typical MAB framework, there are a finite number of actions that are modeled independently; sampling one action provides no information about the rewards that can be gained through selecting other actions. In contrast, we allow for infinite action spaces and for general forms of model uncertainty, captured by a prior distribution over a set of possible reward functions. Recent papers have addressed this problem in cases where the relationship among action rewards takes a known parametric form. For example, Dani et al. , Abbasi-Yadkori et al. , Rusmevichientong and Tsitsiklis study the case where actions are described by a finite number of features and the reward function is linear in these features. Other authors have studied cases where the reward function is Lipschitz continuous , sampled from a Gaussian process , or takes the form of a generalized or sparse linear model.
Each paper cited above studies an upper confidence bound (UCB) algorithm. Such an algorithm forms an optimistic estimate of the mean-reward value for each action, taking it to be the highest statistically plausible value. It then selects an action that maximizes among these optimistic estimates. Optimism encourages selection of poorly-understood actions, which leads to informative observations. As data accumulates, optimistic estimates are adapted, and this process of exploration and learning converges toward optimal behavior.
We study an alternative algorithm that we refer to as posterior sampling. It is also also known as Thompson sampling and as probability matching. The algorithm randomly selects an action according to the probability it is optimal. Although posterior sampling was first proposed almost eighty years ago, it has until recently received little attention in the literature on multi-armed bandits. While its asymptotic convergence has been established in some generality , not much else is known about its theoretical properties in the case of dependent arms, or even in the case of independent arms with general prior distributions. Our work provides some of the first theoretical guarantees.
Our interest in posterior sampling is motivated by several potential advantages over UCB algorithms, which we highlight in Section 4.3. While particular UCB algorithms can be extremely effective, performance and computational tractability depends critically on the confidence sets used by the algorithm. For any given model, there is a great deal of design flexibility in choosing the structure of these sets. Because posterior sampling avoids the need for confidence bounds, its use greatly simplifies the design process and admits practical implementations in cases where UCB algorithms are computationally onerous. In addition, we show through simulations that posterior sampling outperforms various UCB algorithms that have been proposed in the literature.
In this paper, we make two theoretical contributions. The first establishes a connection between posterior sampling and UCB algorithms. In particular, we show that while the regret of a UCB algorithm can be bounded in terms of the confidence bounds used by the algorithm, the Bayesian regret of posterior sampling can be bounded in an analogous way by any sequence of confidence bounds. In this sense, posterior sampling preserves many of the appealing theoretical properties of UCB algorithms without requiring explicit, designed, optimism. We show that, due to this connection, existing analysis available for specific UCB algorithms immediately translates to Bayesian regret bounds for posterior sampling.
Our second theoretical contribution is a Bayesian regret bound for posterior sampling that applies broadly and can be specialized to many specific model classes. Our bound depends on a new notion of dimension that measures the degree of dependence among actions. We compare our notion of dimension to the Vapnik-Chervonenkis dimension and explain why that and other measures of dimension used in the supervised learning literature do not suffice when it comes to analyzing posterior sampling.
The remainder of this paper is organized as follows. The next section discusses related literature. Section 3 then provides a formal problem statement. We describe UCB and posterior sampling algorithms in Section 4. We then establish in Section 5 a connection between them, which we apply in Section 6 to convert existing bounds for UCB algorithms to bounds for posterior sampling. Section 7 develops a new notion of dimension and presents Bayesian regret bounds that depend on it. Section 8 presents simulation results. A closing section makes concluding remarks.
Related Literature.
One distinction of results presented in this paper is that they center around Bayesian regret as a measure of performance. In the next subsection, we discuss this choice and how it relates to performance measures used in other work. Following that, we review prior results and their relation to results of this paper.
Several recent papers have established theoretical results on posterior sampling. One difference between this work and ours is that we focus on a different measure of performance. These papers all study the algorithm’s regret, which measures its cumulative loss relative to an algorithm that always selects the optimal action, for some fixed reward function. To derive these bounds, each paper fixes an uninformative prior distribution with a convenient analytic structure, and studies posterior sampling assuming this particular prior is used. With one exception , the focus is on the classical multiarmed bandit problem, where sampling one action provides no information about others.
Posterior sampling can be applied to a much broader class of problems, and one of its greatest strengths is its ability to incorporate prior knowledge in a flexible and coherent way. We therefore aim to develop results that accommodate the use of a wide range of models. Accordingly, most of our results allow for an arbitrary prior distribution over a particular class of mean reward functions. In order to derive meaningful results at this level of generality, we study the algorithm’s expected regret, where the expectation is taken with respect to the prior distribution over reward functions. This quantity is sometimes called the algorithm’s Bayesian regret. We find this to be a practically relevant measure of performance and find this choice allows for more elegant analysis. Further, as we discuss in Section 3, the Bayesian regret bounds we provide in some cases immediately yield regret bounds.
In addition, studying Bayesian regret reveals deep connections between posterior sampling and the principle of optimism in the face of uncertainty, which we feel provides new conceptual insight into the algorithm’s performance. Optimism in the face of uncertainty is a general principle and is not inherently tied to any measure of performance. Indeed, algorithms based on this principle have been shown to be asymptotically efficient in terms of both regret and Bayesian regret , to satisfy order optimal minimax regret bounds , to satisfy order optimal bounds on regret and Bayesian regret when the reward function is linear , and to satisfy strong bounds when the reward function is sampled from a Gaussian process prior . We take a very general view of optimistic algorithms, allowing upper confidence bounds to be constructed in an essentially arbitrary way based on the algorithm’s observations and possibly the prior distribution over reward functions.
2 Related Results.
Though it was first proposed in 1933, posterior sampling has until recently received relatively little attention. Interest in the algorithm grew after empirical studies demonstrated performance exceeding state-of-the-art methods. An asymptotic convergence result was established by May et al. , but finite time guarantees remain limited. The development of further performance bounds was raised as an open problem at the 2012 Conference on Learning Theory .
Three recent papers provide regret bounds for posterior sampling when applied to MAB problems with finitely many independent actions and rewards that follow Bernoulli processes. These results demonstrate that posterior sampling is asymptotically optimal for the class of problems considered. A key feature of the bounds is their dependence on the difference between the optimal and second-best mean-reward values. Such bounds tend not to be meaningful when the number of actions is large or infinite unless they can be converted to bounds that are independent of this gap, which is sometimes the case.
In this paper, we establish distribution-independent bounds. When the action space is finite, we establish a finite time Bayesian regret bound of order . This matches what is implied by the analysis of Agrawal and Goyal . However, our bound does not require actions are modeled independently, and our approach also leads to meaningful bounds for problems with large or infinite action sets.
Only one other paper has studied posterior sampling in a context involving dependent actions . That paper considers a contextual bandit model with arms whose mean-reward values are given by a -dimensional linear model. The cumulative -period regret is shown to be of order with probability at least . Here is a parameter used by the algorithm to control how quickly the posterior distribution concentrates. The Bayesian regret bounds we will establish are stronger than those implied by the results of Agrawal and Goyal . In particular, we provide a Bayesian regret bound of order that holds for any compact set of actions. This is order–optimal up to a factor of .
We are also the first to establish finite time performance bounds for several other problem classes. One applies to linear models when the vector of coefficients is likely to be sparse; this bound is stronger than the aforementioned one that applies to linear models in the absence of sparsity assumptions. We establish the the first bounds for posterior sampling when applied to generalized linear models and to problems with a general Gaussian prior. Finally, we establish bounds that apply very broadly and depend on a new notion of dimension.
Unlike most of the relevant literature, we study MAB problems in a general framework, allowing for complicated relationships between the rewards generated by different actions. The closest related work is that of Amin et al. , who consider the problem of learning the optimum of a function that lies in a known, but otherwise arbitrary set of functions. They provide bounds based on a new notion of dimension, but unfortunately this notion does not provide a bound for posterior sampling. Other work provides general bounds for contextual bandit problems where the context space is allowed to be infinite, but the action space is small (see, e.g., ). Our model captures contextual bandits as a special case, but we emphasize problem instances with large or infinite action sets, and where the goal is to learn without sampling every possible action.
A focus of our paper is the connection between posterior sampling and UCB approaches. We discuss UCB algorithms in some detail in Section 4. UCB algorithms have been the primary approach considered in the segment of the stochastic MAB literature that treats models with dependent arms. Other approaches are the knowledge gradient algorithm , forced exploration schemes for linear bandits , and exponential-weighting schemes .
There is an immense and rapidly growing literature on bandits with independent arms and on adversarial bandits. Theoretical work on stochastic bandits with independent arms often focuses on UCB algorithms or on the Gittin’s index approach . Bubeck and Cesa-Bianchi provide a review of work on UCB algorithms and on adversarial bandits. Gittins et al. cover work on Gittin’s indices and related extensions.
Since an initial version of this paper was made publicly available, the literature on the analysis of posterior sampling has rapidly grown. Korda et al. extend their earlier work to the case where reward distributions lie in the 1–dimensional exponential family. Bubeck and Liu combine the regret decomposition we derive in Section 5 with the confidence bound analysis of Audibert and Bubeck to tighten the bound provided in Section 6.1, and also consider a problem setting where the regret of posterior sampling is bounded uniformly over time. Li explores a connection between posterior sampling and exponential weighting schemes, and Gopalan et al. study the asymptotic growth rate of regret in problems with dependent arms.
Problem Formulation.
The -period regret of a policy is the random variable defined by
This quantity is also called Bayes risk, or simply expected regret.
Measurability assumptions are required for the above expectations to be well-defined. In order to avoid technicalities that do not present fundamental obstacles in the contexts we consider, we will not explicitly address measurability issues in this paper and instead simply assume that functions under consideration satisfy conditions that ensure relevant expectations are well-defined.
All equalities between random variables in this paper hold almost surely with respect to the underlying probability space.
2 On Changing Action Sets.
Our stochastic model of action sets is distinct relative to most of the multi-armed bandit literature, which assumes that . This construct allows our formulation to address a variety of practical issues that are usually viewed as beyond the scope of standard multi-armed bandit formulations. Let us provide three examples.
Contextual Models. The contextual multi-armed bandit model is a special case of the formulation presented above. In such a model, an exogenous Markov process taking values in a set influences rewards. In particular, the expected reward at time is given by . However, this is mathematically equivalent to a problem with stochastic time-varying decision sets . In particular, one can define the set of actions to be the set of state-action pairs , and the set of available actions to be .
Cautious Actions. In some applications, one may want to explore without risking terrible performance. This can be accomplished by restricting the set to conservative actions. Then, the instantaneous regret in our framework is the gap between the reward from the chosen action and the reward from the best conservative action. In many settings, the Bayesian regret bounds we will establish for posterior sampling imply that the algorithm either attains near-optimal performance or converges to a point where any better decision is unacceptably risky.
for some scalar constant , we can then select an optimal cautious action given by solving , which is equivalent to
This problem is computationally tractable, which accommodates efficient implementation of posterior sampling.
Adaptive Adversaries. Consider a model in which rewards are influenced by the choices of an adaptive adversary. At each time period, the adversary selects an action from some set based on past observations. The agent observes this action, responds with an action selected from a set , and receives a reward that depends on the pair of actions . This fits our framework if the action is taken to be the pair , and the set of actions available to the agent is .
Algorithms.
We will establish finite time performance bounds for posterior sampling by leveraging prior results pertaining to UCB algorithms and a connection we will develop between the two classes of algorithms. To set the stage for our analysis, we discuss the algorithms in this section.
As a concrete example, consider Algorithm 1, proposed by Auer et al. to address MAB problems with a finite number of independent actions. For such problems, , is a vector with one independent component per action, and the reward function is given by . The algorithm begins by selecting each action once. Then, for each subsequent time , the algorithm generates point estimates of action rewards, defines upper confidence bounds based on them, and selects actions accordingly. For each action , the point estimate is taken to be the average reward obtained from samples of action taken prior to time . The upper confidence bound is produced by adding an “uncertainty bonus” to the point estimate, where is the number of times action was selected prior to time and is an algorithm parameter generally selected based on reward variances. This uncertainty bonus leads to an optimistic assessment of expected reward when there is uncertainty, and it is this optimism that encourages exploration that reduces uncertainty. As increases, uncertainty about action diminishes and so does the uncertainty bonus. The term ensures that the agent does not permanently rule out any action, which is important as there is always some chance of obtaining an overly pessimistic estimate by observing an unlikely sequence of rewards.
Our second example treats a linear bandit problem. Here we assume is drawn from a normal distribution but without assuming that the covariance matrix is diagonal. We consider a linear reward function and assume the reward noise is normally distributed and independent from . One can show that, conditioned on the history , remains normally distributed. Algorithm 2 presents an implementation of UCB algorithm for this problem. The expectations can be computed efficiently via Kalman filtering. The algorithm employs upper confidence bound . The term captures the posterior variance of in the direction , and, as with the case of independent arms, causes the uncertainty bonus to diminish as the number of observations increases.
2 Posterior Sampling.
Our first example involves a model with independent arms. In particular, suppose is drawn from a normal distribution with a diagonal covariance matrix , the reward function is given by , and the reward noise is normally distributed and independent from . It then follows that, conditioned on the history , remains normally distributed with independent components. Algorithm 3 presents an implementation of posterior sampling for this problem. The expectations are easy to compute and can also be computed recursively.
Our second example treats a linear bandit problem. Algorithm 4 presents a posterior sampling analogue to Algorithm 2. As before, we assume is drawn from a normal distribution . We consider a linear reward function and assume the reward noise is normally distributed and independent from .
3 Potential Advantages of Posterior Sampling.
Well designed optimistic algorithms can be extremely effective. When simple and efficient UCB algorithms are available, they may be preferable to posterior sampling. Our work is primarily motivated by the challenges in designing optimistic algorithms to address very complicated problems, and the important advantages posterior sampling sometimes offers in such cases.
Posterior sampling can also offer critical computational advantages over UCB algorithms when the action space is intractably large. Consider the problem of learning to solve a linear program, where the action set is a polytope encoded in terms of linear inequalities, and is a linear function. Algorithm 2 becomes impractical, because, as observed by Dani et al. , the action selection step entails solving a problem equivalent to linearly constrained negative definite quadratic optimization, which is NP hard .Dani et al. studies a slightly different UCB algorithm, but the optimization step shares the same structure. By contrast, the action selection step of Algorithm 4 only requires solving a linear program. The figure below displays the level sets of the linear objective and of the upper confidence bounds used by Algorithm 2. While posterior sampling preserves the linear structure of the functions , it is challenging to maximize the upper confidence bounds of Algorithm 2, which are strictly convex.
It is worth mentioning that because posterior sampling requires specifying a fully probabilistic model of the underlying system, it may not be ideally suited for every practical setting. In particular, when dealing with some complex classes of functions, specifying an appropriate prior can be a challenge while there may be alternative algorithms that address the problem in an elegant and practically effective way.
Confidence Bounds and Regret Decompositions.
Unlike UCB algorithms, posterior sampling does not make use of upper confidence bounds to encourage exploration and instead relies on randomization. As such, the two classes of algorithm seem very different. However, we will establish in this section a connection that will enable us in Section 6 to derive performance bounds for posterior sampling from those that apply to UCB algorithms. Since UCB algorithms have received much more attention, this leads to a number of new results about posterior sampling. Further, the relationship yields insight into the performance advantages of posterior sampling.
The inequality follows from the fact that is chosen to maximize . If the upper confidence bound is an upper bound with high probability, as one would expect from a UCB algorithm, then the first term is negative with high probability. The second term, , penalizes for the width of the confidence interval. As actions are sampled should diminish and converge on . As such, both terms of the decomposition should eventually vanish. An important feature of this decomposition is that, so long as the first term is negative, it bounds regret in terms of uncertainty about the current action .
Taking the expectation of (1) establishes that the -period Bayesian regret of a UCB algorithm satisfies
where is the policy derived from .
2 Posterior Sampling Regret Decomposition.
Summing over gives the result. \Halmos
To compare (2) and (3) consider the case where takes values in . Then,
An important difference to take note of is that the Bayesian regret bound of depends on the specific upper confidence bound sequence used by the UCB algorithm in question whereas the bound of applies simultaneously for all upper confidence bound sequences. This suggests that, while the Bayesian regret of a UCB algorithm depends critically on the specific choice of confidence sets, posterior sampling depends on the best possible choice of confidence sets. This is a crucial advantage when there are complicated dependencies among actions, as designing and computing with appropriate confidence sets presents significant challenges. This difficulty is likely the main reason that posterior sampling significantly outperforms recently proposed UCB algorithms in the simulations presented in Section 8.
We have shown how upper confidence bounds characterize Bayesian regret bounds for posterior sampling. We will leverage this concept in the next two sections. Let us emphasize, though, that while our analysis of posterior sampling will make use of upper confidence bounds, the actual performance of posterior sampling does not depend on upper confidence bounds used in the analysis.
From UCB to Posterior Sampling Regret Bounds.
We consider in this section a problem with actions and rewards satisfying for all almost surely. We note, however, that the results we discuss can be extended to cases where is not bounded but where instead its distribution is “light-tailed.” It is also worth noting that we make no further assumptions on the class of reward functions or on the prior distribution over .
In this setting, Algorithm 1, which was proposed by Auer et al. , is known to satisfy a problem-independent regret bound of order . Under an additional assumption that action rewards are independent and take values in , an order regret bound for posterior sampling is also available .
Here we provide a Bayesian regret bound that is also of order but does not require that action rewards are independent or binary. Our analysis, like that of Auer et al. , makes use of confidence sets that are Cartesian products of action-specific confidence intervals. The regret decomposition (3) lets us use such confidence sets to produce bounds for posterior sampling even when the algorithm itself may exploit dependencies among actions.
Proof. Let denote the number of times is sampled over the first periods, and denote the empirical average reward from these samples. Define upper and lower confidence bounds as follows:
The next lemma, which is a consequence of analysis in Abbasi-Yadkori et al. , shows these hold with high probability. Were actions sampled in an iid fashion, this lemma would follow immediately from the Hoeffding inequality. For more details, see Appendix 10.
We now turn to bounding . Let denote the periods in which is selected. Then, . We show,
Summing over actions and applying the cauchy-shwartz inequality yields,
where (a) follows from the cauchy-shwartz inequality and (b) follows from the assumption that . \Halmos
2 Linear and Generalized Linear Models.
We now consider function classes that represent linear and generalized linear models. The bound of Proposition 6.1 applies so long as the number of actions is finite, but we will establish alternative bounds that depend on the dimension of the function class rather than the number of actions. Such bounds accommodate problems with infinite action sets and can be much stronger than the bound of Proposition 6.1 if there are many actions.
The Bayesian regret bounds we provide in this section derive from regret bounds of the UCB literature. In Section 7, we will establish a Bayesian regret bound that is as strong for the case of linear models and stronger for the case of generalized linear models. Since the results of Section 7 to a large extent supersede those we present here, we aim to be brief and avoid formal proofs in this section’s discussion of the bounds and how they follow from results in the literature.
If takes values in then (3) implies
2.2 Generalized Linear Models
In a generalized linear model, the reward function takes the form where the inverse link function is strictly increasing and continuously differentiable. The analysis of can be applied to establish a Bayesian regret bound for posterior sampling, but with one caveat. The algorithm considered in begins by selecting a sequence of actions with linearly independent feature vectors . Until now, we haven’t even assumed such actions exist or that they are guaranteed to be feasible over the first time periods. After this period of designed exploration, the algorithm selects at each time an action that maximizes an upper confidence bound. What we will establish using the results from is a bound on a similarly modified version of posterior sampling, in which the first actions taken are , while subsequent actions are selected by posterior sampling. Note that the posterior distribution employed at time is conditioned on observations made over the first time periods. We denote this modified posterior sampling algorithm by . It is worth mentioning here that in Section 7 we present a result with a stronger bound that applies to the standard version of posterior sampling, which does not include a designed exploration period.
where .
Like the analyses of and , which apply to linear models, the analysis of follows two steps that together bound both terms of our regret decomposition (6). First, an ellipsoidal confidence set is constructed, centered around a quasi-maximum likelihood estimator. This confidence set is designed to contain with high probability. Given confidence bounds and , a worst case bound on is established. The bound is similar to those established for the linear case, but there is an added dependence on the the slope of .
3 Gaussian Processes.
In this section we consider the case where the reward function is sampled from a Gaussian process. That is, the stochastic process is such that for any the collection follows a multivariate Gaussain distribution. Srinivas et al. study a UCB algorithm designed for such problems and provide general regret bounds. Again, through the regret decomposition (3) their analysis provides a Bayesian regret bound for posterior sampling.
For simplicity, we focus our discussion on the case where is finite, so that follows a multivariate Gaussian distribution. As shown by Srinivas et al. , the results extend to infinite action sets through a discretization argument as long as certain smoothness conditions are satisfied.
When confidence bounds hold, a UCB algorithm incurs high regret from sampling an action only when the confidence bound at that action is loose. In that case, one would expect the algorithm to learn a lot about based on the observed reward. This suggests the algorithm’s cumulative regret may be bounded in an appropriate sense by the total amount it is expected to learn. Leveraging the structure of the Gaussian distribution, Srinivas et al. formalize this idea. They bound the regret of their UCB algorithm in terms of the maximum amount that any algorithm could learn about . They use an information theoretic measure of learning: the information gain. This is defined to be the difference between the entropy of the prior distribution of and the entropy of the posterior. The maximum possible information gain is denoted , where the maximum is taken over all sequences .An important property of the Gaussian distribution is that the information gain does not depend on the observed rewards. This is because the posterior covariance of a multivariate Gaussian is a deterministic function of the points that were sampled. For this reason, this maximum is well defined. Their analysis also supports the following result on posterior sampling.
Srinivas et al. also provide bounds on for kernels commonly used in Gaussian process regression, including the linear kernel, radial basis kernel, and Matérn kernel. Combined with the above proposition, this yields explicit Bayesian regret bounds in these cases.
We will briefly comment on their analysis and how it provides a bound for posterior sampling. First, note that the posterior distribution is Gaussian, which suggests an upper confidence bound of the form , where is the posterior mean, is the posterior standard deviation of , and is a confidence parameter. We can provide a Bayesian regret bound by bounding both terms of (3). The next lemma, which follows, bounds the second term. Some new analysis is required since the Gaussian distribution is unbounded, and we study Bayesian regret whereas Srinivas et al. bound regret with high probability under the prior.
Then since the posterior distribution of is normal with mean and variance
The final inequality above follows from the assumption that . The claim follows from (7) since
Now, consider the first term of (3), which is:
Here the second equality follows by the tower property of conditional expectation, and the final step follows from the Cauchy-Schwartz inequality. Therefore, to establish a Bayesian regret bound it is sufficient to provide a bound on the sum of posterior variances that holds for any . Under the assumption that , the proof of Lemma 5.4 of Srinivas et al. shows that , where . At the same time, Lemma 5.3 of Srinivas et al. shows the information gain from selecting is equal to . This shows that for any actions the the sum of posterior variances can be bounded in terms of the information gain from selecting . Therefore can be bounded in terms of the largest possible information gain .
Bounds for General Function Classes.
The previous section treated models in which the relationship among action rewards takes a simple and tractable form. Indeed, nearly all of the multi-armed bandit literature focuses on such problems. Posterior sampling can be applied to a much broader class of models. As such, more general results that hold beyond restrictive cases are of particular interest. In this section, we provide a Bayesian regret bound that applies when the reward function lies in a known, but otherwise arbitrary class of uniformly bounded real-valued functions . Our analysis of this abstract framework yields a more general result that applies beyond the scope of specific problems that have been studied in the literature, and also identifies factors that unify more specialized prior results. Further, our more general result when specialized to linear models recovers the strongest known Bayesian regret bound and in the case of generalized linear models yields a bound stronger than that established in prior literature.
If is not appropriately restricted, it is impossible to guarantee any reasonably attractive level of Bayesian regret. For example, in a case where , , , and is uniformly distributed over $TT$, which is no different from the worst level of performance an agent can experience.
This example highlights the fact that Bayesian regret bounds must depend on the function class . The bound we develop in this section depends on through two measures of complexity. The first is the Kolmogorov dimension, which measures the growth rate of the covering numbers of and is closely related to measures of complexity that are common in the supervised learning literature. It roughly captures the sensitivity of to statistical over-fitting. The second measure is a new notion we introduce, which we refer to as the eluder dimension. This captures how effectively the value of unobserved actions can be inferred from observed samples. We highlight in Section 7.3 why notions of dimension common to the supervised learning literature are insufficient for our purposes.
Our analysis in some ways parallels those found in the literature on UCB algorithms. In the next section we provide a method for constructing a set of functions that are statistically plausible at time . Let denote the width of at . Based on these confidence sets, and using the regret decomposition (3), one can bound Bayesian regret in terms of . In Section 7.2, we establish a bound on this sum in terms of the Kolmogorov and eluder dimensions of .
The construction of tight confidence sets for specific classes of functions presents technical challenges. Even for the relatively simple case of linear bandit problems, significant analysis is required. It is therefore perhaps surprising that, as we show in this section, one can construct strong confidence sets for an arbitrary class of functions without much additional sophistication. While the focus of our work is on providing a Bayesian regret bound for posterior sampling, the techniques we introduce for constructing confidence sets may find broader use.
The confidence sets constructed here are centered around least squares estimates where is the cumulative squared prediction error.The results can be extended to the case where the infimum of is unattainable by selecting a function with squared prediction error sufficiently close to the infimum. The sets take the form where is an appropriately chosen confidence parameter, and the empirical 2-norm is defined by . Hence measures the cumulative discrepancy between the previous predictions of and .
By Lemma 7.1, with high probability, can enjoy lower squared error than only if its empirical deviation from is less than . Through a union bound, this property holds uniformly for all functions in a finite subset of . Using this fact and a discretization argument, together with the observation that , we can establish the following result, which is proved in the appendix. Let denote the -covering number of in the sup-norm , and let
While the expression (8) defining the confidence parameter is complicated, it can be bounded by simple expressions in important cases. We provide three examples.
Finite function classes: When is finite, .
Generalized Linear Models: Consider the case of a -dimensional generalized linear model where is an increasing Lipschitz continuous function. Fix , , and . Then, the previous argument shows . Again, choosing yields a confidence parameter .
The confidence parameter is closely related to the following concept.
The Kolmogorov dimension of a function class is given by
In particular, we have the following result.
For any fixed class of functions ,
The result follows from the fact that . \Halmos
2 Bayesian Regret Bounds.
We can use the confidence sets constructed in the previous section to guarantee that the conditions of this lemma hold. In particular, choosing in (8) guarantees that with probability at least .
The -eluder dimension is the length of the longest sequence of elements in such that, for some , every element is -independent of its predecessors.
Recall that a vector space has dimension if and only if is the length of the longest sequence of elements such that each element is linearly independent or equivalently, -independent of its predecessors. Definition 7.11 replaces the requirement of linear independence with -independence. This extension is advantageous as it captures both nonlinear dependence and approximate dependence. The following result uses our new notion of dimension to bound the number of times the width of the confidence interval for a selected action can exceed a threshold.
Proof. We begin by showing that if then is -dependent on fewer than disjoint subsequences of , for . To see this, note that if there are such that . By definition, since , if is -dependent on a subsequence of then . It follows that, if is -dependent on disjoint subsequences of then . By the triangle inequality, we have
and it follows that .
Next, we show that in any action sequence , there is some element that is -dependent on at least disjoint subsequences of , where . To show this, for an integer satisfying , we will construct disjoint subsequences . First let for . If is -dependent on each subsequence , our claim is established. Otherwise, select a subsequence such that is -independent and append to . Repeat this process for elements with indices until is -dependent on each subsequence or . In the latter scenario , and since each element of a subsequence is -independent of its predecessors, . In this case, must be –dependent on each subsequence.
Now consider taking to be the subsequence of consisting of elements for which . As we have established, each is -dependent on fewer than disjoint subsequences of . It follows that each is -dependent on fewer than disjoint subsequences of . Combining this with the fact we have established that there is some that is -dependent on at least disjoint subsequences of , we have . It follows that , which is our desired result. \Halmos
Using Proposition 7.12, one can bound the sum , as established by the following lemma.
Proof. To reduce notation, write and . Reorder the sequence where . We have
We know . In addition, . By Proposition 7.12, this can only occur if . For , , since is nonincreasing in . Therefore, when , which implies . This shows that if , then . Therefore,
Our next result, which follows from Lemma 7.9, Lemma 7.14, and Proposition 7.2, establishes a Bayesian regret bound.
Using bounds on provided in the previous section together with Proposition 7.16 yields Bayesian regret bounds that depend on only through the eluder dimension and either the cardinality or Kolmogorov dimension. The following proposition provides such bounds.
For any fixed class of functions ,
The next two examples show how the first Bayesian regret bound of Proposition 7.17 specializes to -dimensional linear and generalized linear models. For each of these examples, a bound on is provided in the appendix.
Linear Models: Consider the case of a -dimensional linear model . Fix and . Then, and . Proposition 7.17 therefore yields an Bayesian regret bound. This is tight to within a factor of , and matches the best available bound for a linear UCB algorithm .
One advantage of studying posterior sampling in a general framework is that it allows bounds to be obtained for specific classes of models by specializing more general results. This advantage is highlighted by the ease of developing a performance guarantee for generalized linear models. The problem is reduced to one of bounding the eluder dimension, and such a bound follows almost immediately from the analysis of linear models. In prior literature, extending results from linear to generalized linear models required significant technical developments, as presented in Filippi et al. .
3 Relation to the Vapnik-Chervonenkis Dimension.
To close our section on general bounds, we discuss important differences between our new notion of eluder dimension and complexity measures used in the analysis of supervised learning problems. We begin with an example that illustrates how a class of functions that is learnable in constant time in a supervised learning context may require an arbitrarily long duration when learning to optimize.
Consider a finite class of binary-valued functions over a finite action set . Let , so that each function is an indicator for an action. To keep things simple, assume that , so that there is no noise. If is uniformly distributed over , it is easy to see that the Bayesian regret of posterior sampling grows linearly with . For large , until is discovered, each sampled action is unlikely to reveal much about and learning therefore takes very long.
In the preceding example, the -eluder dimension is for . On the other hand, the Vapnik-Chervonenkis (VC) dimension, which characterizes the sample complexity of supervised learning, is . To highlight conceptual differences between the eluder dimension and the VC dimension, we will now define VC dimension in a way analogous to how we defined eluder dimension. We begin with a notion of independence.
In the above example, any two actions are VC-dependent because knowing the label of one action could completely determine the value of the other action. However, this only happens if the sampled action has label 1. If it has label 0, one cannot infer anything about the value of the other action. Instead of capturing the fact that one could gain useful information about the reward function through exploration, we need a stronger requirement that guarantees one will gain useful information through exploration. Such a requirement is captured by the following concept.
Simulation Results.
In this section, we compare the performance in simulation of posterior sampling to that of UCB algorithms that have been proposed in the recent literature. Our results demonstrate that posterior sampling significantly outperforms these algorithms. Moreover, we identify a clear cause for the large discrepancy: confidence sets proposed in the literature are too loose to attain good performance.
Several UCB algoriths are suitable for such problems, including those of . While the confidence bound of is stronger than that of , it is still too loose and the resulting linear UCB algorithm hardly improves its performance over the 1000 period time horizon. We display the results only of the more competitive UCB algorithms. The line labeled “linear UCB” displays the results of the algorithm proposed in , which incurred average regret of 339.7. The algorithm of is labeled “Gaussian UCB,” and incurred average regret 198.7. Posterior sampling, on the other hand, incurred average regret of only 97.5.
Each of these UCB algorithms uses a confidence bound that was derived through stochastic analysis. The Gaussian linear model has a clear structure, however, which suggests upper confidence bounds should take the form where and are the posterior mean and standard deviation at . The final algorithm we consider ignores theoretical considerations, and tunes the parameter to minimize the average regret over the first 1000 periods. The average regret of the algorithm was only 68.9, a dramatic improvement over , and , and even outperforming posterior sampling. On the plot shown below, these results are labeled “Gaussian UCB - Tuned Heuristic.” Note such tuning requires the time horizon to be fixed and known.
In this setting, the problem of choosing upper-confidence bounds reduces to choosing a single confidence parameter . For more complicated problems, however, significant analysis may be required to choose a structural form for confidence sets. The results in this section suggest that it can be quite challenging to use such analysis to derive confidence bounds that lead to strong empirical performance. In particular, this is challenging even for linear models. For example, the paper uses sophisticated tools from the study of multivariate self-normalized martingales to derive a confidence bound that is stronger than those of or , but their algorithm still incurs about three and a half times the regret of posterior sampling. This highlights a crucial advantage of posterior sampling that we have emphasized throughout this paper; it effectively separates confidence bound analysis from algorithm design.
Finally, it should be noted that the algorithms of have free parameters that must be chosen by the user. We have attempted to set these values in a way that minimizes average regret over the 1000 period time horizon. Both algorithms construct confidence bounds that hold with a pre-specified probability . Higher levels of lead to lower upper-confidence bounds, which we find improves performance. We set to minimize the average regret of the algorithms. The algorithm of requires two other choices. We used a line search to set the algorithm’s regularization parameter to the level , which minimizes cumulative regret. The algorithm of also requires a uniform upper bound on , but the Gaussian distribution is unbounded. We avoid this issue by providing the actual realized value as an input to algorithm.
Conclusion.
This paper has considered the use of a simple posterior sampling algorithm for learning to optimize actions when the decision maker is uncertain about how his actions influence performance. We believe that, particularly for difficult problem instances, this algorithm offers significant potential advantages because of its design simplicity and computational tractability. Despite its great potential, not much is known about posterior sampling when there are dependencies between actions. Our work has taken a significant step toward remedying this gap. We showed that the Bayesian regret of posterior sampling can be decomposed in terms of confidence sets, which allowed us to establish a number of new results on posterior sampling by leveraging prior work on UCB algorithms. We then used this regret decomposition to analyze posterior sampling in a very general framework, and developed Bayesian regret bounds that depend on a new notion of dimension.
In constructing these bounds, we have identified two factors that control the hardness of a particular multi-armed bandit problem. First, an agent’s ability to quickly attain near-optimal performance depends on the extent to which the reward value at one action can be inferred by sampling other actions. However, in order to select an action the agent must make inferences about many possible actions, and an error in its evaluation of any one could result in large regret. Our second measure of complexity controls for the difficulty of maintaining appropriate confidence sets simultaneously at every action. While our bounds are nearly tight in some cases, further analysis is likely to yield stronger results in other cases. We hope, however, that our work provides a conceptual foundation for the study of such problems, and inspires further investigation.
Details Regarding Lemma 6.3.
Lemma 6.3 follows as a special case of Theorem 1 of Abbasi-Yadkori et al. , which is much more general. Note that because reward noise is bounded in , it is 1-subgaussian. Equation 12 in Abbasi-Yadkori et al. gives a specialization of Theorem 1 to the problem we consider. It states that for any , with probability at least ,
We choose and use that for , to show that with probability at least ,
Since whenever has been played at least once, with probability at least ,
Proof of Confidence bound.
We note that the event . So we have shown that for all and
2 Proof of Lemma 7.1.
Proof. By definition . Some calculation shows that . Therefore, the conditional mean and conditional cumulant generating function satisfy:
Applying Lemma 11.3 shows that for all ,
Choosing , , and using the definition of implies
3 Least Squares Bound - Proof of Proposition 7.2.
Proof. Let be an –cover of in the sup-norm in the sense that for any there is an such that . By a union bound, with probability at least ,
Lemma 11.7, which we establish in the next section, asserts that with probability at least the discretization error is bounded for all by where . Since the least squares estimate has lower squared error than by definition, we find with probability at least
Taking the infimum over the size of covers implies:
4 Discretization Error.
If satisfies , then with probability at least ,
Proof. Since any two functions in satisfy , it is enough to consider . We find
Summing over , we find that the left hand side of (9) is bounded by
Since this shows that with probability at least the discretization error is bounded for all by where . \Halmos
Bounds on Eluder Dimension for Common Function Classes.
Definition 7.11, which defines the eluder dimension of a class of functions, can be equivalently written as follows. The -eluder dimension of a class of functions is the length of the longest sequence such that for some
Any action is –dependent on itself since
Therefore, for all , the -eluder dimension of is bounded by .
2 Linear Case.
To simplify the notation, define as in (10), , , and . In this case, , and by the triangle inequality . The proof follows by bounding the number of times can occur.
Step 1: If then where and .
Proof. We find . The second inequality follows because any that is feasible for the first maximization problem must satisfy . By this result, implies . \Halmos
Step 2: If for each then and .
Proof. Since , using the Matrix Determinant Lemma,
Recall that is the product of the eigenvalues of , whereas is the sum. As noted in , is maximized when all eigenvalues are equal. This implies: . \Halmos
Proof. Manipulating the result of Step 2 shows must satisfy the inequality: where . Let . The number of times can occur is bounded by .
We now derive an explicit bound on for any . Note that any must satisfy the inequality: . Since , using the transformation of variables gives:
This implies . The claim follows by plugging in and . \Halmos
3 Generalized Linear Models.
The proof follows three steps which closely mirror those used to prove Proposition 12.1.
Step 1: If then where and .
Proof. By definition . By the uniform bound on this is less than .\Halmos
Step 2: If for each then and .
Proof. The above inequalities imply must satisfy: where . Therefore, as in the linear case, the number of times can occur is bounded by . Plugging these constants into the earlier bound and using yields the result. \Halmos