Introduction to Online Convex Optimization
Elad Hazan
Preface
This book serves as an introduction to the expanding theory of online convex optimization (OCO). It was written as an advanced textbook to serve as a basis for a graduate course, and/or as a reference to researchers diving into this fascinating world at the intersection of optimization and machine learning.
Such a course was given at the Technion in 2010–2014, with slight variations from year to year, and later at Princeton University in 2015–2020. The core material in these courses is fully covered in this book, along with exercises that allow students to complete parts of proofs, or that were found illuminating and thought-provoking by those taking the course. Most of the material is given with examples of applications, which are interlaced throughout various topics. These include prediction from expert advice, portfolio selection, matrix completion and recommendation systems, and support vector machine training.
Our hope is that this compendium of material and exercises will be useful to you; the researcher and/or educator.
The broad field of machine learning, as in the sub-disciplines of online learning, boosting, regret minimization in games, universal prediction, and other related topics, have seen a plethora of introductory books in recent years. With this note, we can hardly do justice to all of these, but perhaps point to the most related books on the topics of machine learning, learning in games, and optimization, whose intersection is our main focus.
The most closely related book, which served as an inspiration to the current, and indeed an inspiration to the entire field of learning in games, is the wonderful text of Cesa-Bianchi and Lugosi (2006). From the literature on mathematical optimization theory, there are the numerous introductory essays to convex optimization and convex analysis, to name only a few (Boyd and Vandenberghe, 2004; Nesterov, 2004; Nemirovski and Yudin, 1983; Nemirovskii, 2004; Borwein and Lewis, 2006; Rockafellar, 1997). The author fondly recommends the text from which he has learned about mathematical optimization theory (Nemirovskii, 2004). The more broad texts on machine learning are too numerous to state here.
The primary purpose of this is to serve as an educational textbook for a dedicated course on OCO and the convex optimization approach to machine learning. Online convex optimization has already had enough impact to appear in several surveys and introductory texts (Hazan, 2011; Shalev-Shwartz, 2011; Rakhlin, 2009; Rakhlin and Sridharan, 2014). We hope this compilation of material and exercises will further enrich the literature.
Book’s tructure
This book is intended to serve as a reference for a self-contained course for graduate students in computer science/electrical engineering/operations research/statistics and related fields. As such, its organization follows the structure of the course “Decision Analysis”, taught at the Technion, and later “Theoretical Machine Learning”, taught at Princeton University.
Each chapter should take one or two weeks of classes, depending on the depth and breadth of the intended course. Chapter 1 is designed to be a teaser for the field, and it is less rigorous than the rest of the book.
Roughly speaking, the book can be conceived as three units. The first, from chapter 2 through 4, contains the basic definitions, framework and core algorithms for OCO. Chapters 5 to 7 contain more advanced algorithms and in-depth analysis of the framework and its extensions to other computational and information access models. The rest of the book deals with more advanced algorithms, more difficult settings, and relationships to well-known machine learning paradigms.
This book can assist educators in designing a complete course on the topic of online convex optimization, or it can serve as a component in a comprehensive course on machine learning. A accompanying manual of solutions to selected exercises given in the book is available for educators only.
The main additions to the second edition of this book include the following:
Expanded coverage of optimization in chapter 2, with a unified gradient descent analysis of the Polyak stepsize.
Expanded coverage of learning theory in chapter 9, with an introduction to compression and its use in generalization theory.
An expanded chapter 4, with addition of the exponential weighted optimizer for exp-concave loss functions.
A revised chapter 5, with the addition of mirror descent analysis, as well as a revised section on adaptive gradient methods.
New chapter 10 on the notion of adaptive regret and algorithms for OCO with near-optimal adaptive regret bounds.
New chapter 11 on boosting and its relationship to OCO. Derivation of boosting algorithms from regret minimization.
New chapter 13 on Blackwell approachability and its strong connection to OCO.
In addition, numerous typos are fixed, exercises are corrected, and solutions to several questions have been made available in a separate manual for educators.
Acknowledgements
First of all, I gratefully acknowledge the numerous contributions and insight of the students of the course “decision analysis” given at the Technion during 2010-2014, as well as the students of “theoretical machine learning” taught at Princeton University during 2015-2016.
I would like to thank the friends, colleagues and students that have contributed many suggestions and corrections. A partial list includes: Sanjeev Arora, Shai Shalev-Shwartz, Aleksander Madry, Yoram Singer, Satyen Kale, Alon Gonen, Roi Livni, Gal Lavee, Maayan Harel, Daniel Khasabi, Shuang Liu, Jason Altschuler, Haipeng Luo, Zeyuan Allen-Zhu, Mehrdad Mahdavi, Jaehyun Park, Baris Ungun, Maria Gregori, Tengyu Ma, Kayla McCue, Esther Rolf, Jeremy Cohen, Daniel Suo, Lydia Liu, Fermi Ma, Mert Al, Amir Reza Asadi, Carl Gabel, Nati Srebro, Abbas Mehrabian, Chris Liaw, Nikhil Bansal, Naman Agarwal, Raunak Kumar, Zhize Li, Sheng Zhang, Swati Gupta, Xinyi Chen, Liang Zeng and Kunal Mittal.
I thank Udi Aharoni for his artwork and illustrations depicting algorithms in this book.
I am forever indebted to my teacher and mentor, Sanjeev Arora, without him this book would not be possible.
Finally, I am grateful for the love and support of my wife and children: Dana, Hadar, Yoav, and Oded.
The Second Version
I am most thankful to my students and colleagues that have collaborated with me on research, some of which appears in the second version of this book. Notably my collaborators on boosting methods including Nataly Brukhim, Xinyi Chen, Shay Moran, Naman Agarwal and Karan Singh.
Thanks to my students that helped me proof check new and existing sections: Edgar Minasyan, Paula Gradu, Karan Singh, Nataly Brukhim, Xinyi Chen, Naman Agarwal and Udaya Ghai.
I am thankful to Shay Moran for explaining compression schemes and how they simplify generalization for boosting.
I gratefully acknowledges the help of Ahmed Farah, Charlie Cowen-Breen and the students of “COS 597C: Computational Control Theory” for many helpful suggestions, corrections and solutions to many of the problem sets.
I am very thankful to Wouter Koolen-Wijkstra for a helpful suggestion in the analysis of the Online Newton Step algorithm.
Thanks to Shiyun Lin for finding typos and improving the presentation of the randomized regularization section.
I thank the extremely helpful and rigorous reviewers of this book found by MIT press who gave fantastic suggestions and improve the final manuscript.
As in the first version and even more so, I am grateful for the love and support of my wife and children: Dana, Hadar, Yoav, and Oded.
List of Symbols
Geometry and Calculus
Learning Theory
Optimization
Regularization
Chapter 1 Introduction
This book considers optimization as a process. In many practical applications, the environment is so complex that it is not feasible to lay out a comprehensive theoretical model and use classical algorithmic theory and mathematical optimization. It is necessary, as well as beneficial, to take a robust approach, by applying an optimization method that learns as more aspects of the problem are observed. This view of optimization as a process has become prominent in various fields, which has led to spectacular successes in modeling and systems that are now part of our daily lives.
The growing body of literature of machine learning, statistics, decision science, and mathematical optimization blurs the classical distinctions between deterministic modeling, stochastic modeling, and optimization methodology. We continue this trend in this book, studying a prominent optimization framework whose precise location in the mathematical sciences is unclear: the framework of online convex optimization (OCO), which was first defined in the machine learning literature (see section 1.4, later in this chapter). The metric of success is borrowed from game theory, and the framework is closely tied to statistical learning theory and convex optimization.
We embrace these fruitful connections and, on purpose, do not try to use any particular jargon in the discussion. Rather, this book will start with actual problems that can be modeled and solved via OCO. We will proceed to present rigorous definitions, backgrounds, and algorithms. Throughout, we provide connections to the literature in other fields. It is our hope that you, the reader, will contribute to our understanding of these connections from your domain of expertise, and expand the growing amount of literature on this fascinating subject.
In OCO, an online player iteratively makes decisions. At the time of each decision, the outcome or outcomes associated with it are unknown to the player.
After committing to a decision, the decision maker suffers a loss: every possible decision incurs a (possibly different) loss. These losses are unknown to the decision maker beforehand. The losses can be adversarially chosen, and even depend on the action taken by the decision maker.
Already at this point, several restrictions are necessary in order for this framework to make any sense at all:
The losses determined by an adversary should not be allowed to be unbounded 1Alternatively and equivalently, any performance metric for this setting should depend on the magnitude of the largest loss. This is the viewpoint taken later in the rest of this book. . Otherwise, the adversary could keep decreasing the scale of the loss at each step, and never allow the algorithm to recover from the loss of the first step. Thus, we assume that the losses lie in some bounded region.
The decision set must be somehow bounded and/or structured, though not necessarily finite.
To see why this is necessary, consider decision making with an infinite set of possible decisions. An adversary can assign high loss to all the strategies chosen by the player indefinitely, while setting apart some strategies with zero loss. This precludes any meaningful performance metric.
The OCO framework can be seen as a structured repeated game. The protocol of this learning framework is as follows.
What would make an algorithm a good OCO algorithm? As the framework is game-theoretic and adversarial in nature, the appropriate performance metric also comes from game theory: define the regret of the decision maker to be the difference between the total cost she has incurred and that of the best fixed decision in hindsight. In OCO, we are usually interested in an upper bound on the worst-case regret of an algorithm.
Let be an algorithm for OCO, which maps a certain game history to a decision in the decision set:
We formally define the regret of after iterations as:
The running time of an algorithm for OCO is defined to be the worst-case expected time to produce , for an iteration 2Here and henceforth, we denote as the set of integers . in a -iteration repeated game. Typically, the running time will depend on (the dimensionality of the decision set ), (the total number of game iterations), and the parameters of the cost functions and underlying convex set.
2 Examples of Problems That Can Be Modeled via Online Convex Optimization
Perhaps the main reason that OCO has become a leading online learning framework in recent years is its powerful modeling capability: problems from diverse domains such as online routing, ad selection for search engines, and spam filtering can all be modeled as special cases. In this section, we briefly survey a few special cases and how they fit into the OCO framework.
Perhaps the most well known problem in prediction theory is the experts problem. The decision maker has to choose among the advice of given experts. After making her choice, a loss between zero and is incurred. This scenario is repeated iteratively, and at each iteration, the costs of the various experts are arbitrary (and possibly even adversarial, trying to mislead the decision maker). The goal of the decision maker is to do as well as the best expert in hindsight.
The fundamental importance of the experts problem in machine learning warrants special attention, and we shall return to it and analyze it in detail at the end of this chapter.
2.2 Online spam filtering
Consider an online spam-filtering system. Repeatedly, emails arrive in the system and are classified as spam or valid. Obviously, such a system has to cope with adversarially generated data and dynamically change with the varying input—a hallmark of the OCO model.
At this point the reader may wonder - why use a square loss rather than any other function? The most natural choice being perhaps a loss of one if and zero otherwise.
To answer this, notice first that if both and are binary and in , then the square loss is indeed one or zero. However, moving to a continuous function allows us much more flexibility in the decision making process. We can allow, for example, the algorithm to return a number in the interval $$ depending on its confidence.
Another reason has to do with the algorithmic efficiency of finding a a good solution. This will be the subject of future chapters.
2.3 Online shortest paths
The discrete description of this problem as an experts problem, where we have an expert for each path, presents an efficiency challenge. There are potentially exponentially many paths in terms of the graph representation size.
2.4 Portfolio selection
In this section we consider a portfolio selection model that does not make any statistical assumptions about the stock market (as opposed to the standard geometric Brownian motion model for stock prices), and is called the “universal portfolio selection” model.
The goal of regret minimization, which in this case corresponds to minimizing the difference , has an intuitive interpretation. The first term is the logarithm of the wealth accumulated by the best possible in-hindsight distribution . Since this distribution is fixed, it corresponds to a strategy of rebalancing the position after every trading period, and hence, is called a constant rebalanced portfolio. The second term is the logarithm of the wealth accumulated by the online decision maker. Hence regret minimization corresponds to maximizing the ratio of the investor’s wealth to the wealth of the best benchmark from a pool of investing strategies.
A universal portfolio selection algorithm is defined to be one that, in this setting, attains regret converging to zero. Such an algorithm, albeit requiring exponential time, was first described by Cover (see bibliographic notes at the end of this chapter). The online convex optimization framework has given rise to much more efficient algorithms based on Newton’s method. We shall return to study these in detail in chapter 4.
2.5 Matrix completion and recommendation systems
The prevalence of large-scale media delivery systems such as the Netflix online video library, Spotify music service and many others, give rise to very large scale recommendation systems. One of the most popular and successful models for automated recommendation is the matrix completion model.
In this mathematical model, recommendations are thought of as composing a matrix. The customers are represented by the rows, the different media are the columns, and at the entry corresponding to a particular user/media pair we have a value scoring the preference of the user for that particular media.
For example, for the case of binary recommendations for music, we have a matrix where is the number of persons considered, is the number of songs in our library, and signifies dislike/like respectively:
In the online setting, for each iteration the decision maker outputs a preference matrix , where is a subset of all possible zero/one matrices. An adversary then chooses a user/song pair along with a “real” preference for this pair . Thus, the loss experienced by the decision maker can be described by the convex loss function,
The natural comparator in this scenario is a low-rank matrix, which corresponds to the intuitive assumption that preference is determined by few unknown factors. Regret with respect to this comparator means performing, on the average, as few preference-prediction errors as the best low-rank matrix.
We return to this problem and explore efficient algorithms for it in chapter 7.
3 A Gentle Start: Learning from Expert Advice
Consider the following fundamental iterative decision making problem:
At each time step , the decision maker faces a choice between two actions or (i.e., buy or sell a certain stock). The decision maker has assistance in the form of “experts” that offer their advice. After a choice between the two actions has been made, the decision maker receives feedback in the form of a loss associated with each decision. For simplicity one of the actions receives a loss of zero (i.e., the “correct” decision) and the other a loss of one.
We make the following elementary observations:
A decision maker that chooses an action uniformly at random each iteration, trivially attains a loss of and is “correct” of the time.
In terms of the number of mistakes, no algorithm can do better in the worst case! In a later exercise, we will devise a randomized setting in which the expected number of mistakes of any algorithm is at least .
We are thus motivated to consider a relative performance metric: can the decision maker make as few mistakes as the best expert in hindsight? The next theorem shows that the answer in the worst case is negative for a deterministic decision maker.
Let denote the number of mistakes made by the best expert in hindsight. Then there does not exist a deterministic algorithm that can guarantee less than mistakes.
Assume that there are only two experts and one always chooses option while the other always chooses option . Consider the setting in which an adversary always chooses the opposite of our prediction (she can do so, since our algorithm is deterministic). Then, the total number of mistakes the algorithm makes is . However, the best expert makes no more than mistakes (at every iteration exactly one of the two experts is mistaken). Therefore, there is no algorithm that can always guarantee less than mistakes.
This observation motivates the design of random decision making algorithms, and indeed, the OCO framework gracefully models decisions on a continuous probability space. Henceforth we prove Lemmas 1.3 and 1.4 that show the following:
Let . Suppose the best expert makes mistakes. Then:
There is an efficient deterministic algorithm that can guarantee less than mistakes;
There is an efficient randomized algorithm for which the expected number of mistakes is at most .
The weighted majority (WM) algorithm is intuitive to describe: each expert is assigned a weight at every iteration . Initially, we set for all experts . For all let be the set of experts that choose (and respectively ) at time . Define,
Next, update the weights as follows:
where is a parameter of the algorithm that will affect its performance. This concludes the description of the WM algorithm. We proceed to bound the number of mistakes it makes.
Denote by the number of mistakes the algorithm makes until time , and by the number of mistakes made by expert until time . Then, for any expert we have
We can optimize to minimize the above bound. The expression on the right hand side is of the form , that reaches its minimum at . Therefore the bound is minimized at . Using this optimal value of , we get that for the best expert
Of course, this value of cannot be used in advance since we do not know which expert is the best one ahead of time (and therefore we do not know the value of ). However, we shall see later on that the same asymptotic bound can be obtained even without this prior knowledge.
Let for all , and note that .
Notice that . However, on iterations in which the WM algorithm erred, we have
the reason being that experts with at least half of total weight were wrong (else WM would not have erred), and therefore
On the other hand, by definition we have for any expert that
Since the value of is always less than the sum of all weights , we conclude that
Taking the logarithm of both sides we get
which follow from the Taylor series of the logarithm function, to obtain that
3.2 Randomized weighted majority
In the randomized version of the WM algorithm, denoted RWM, we choose expert w.p. at time .
Let denote the number of mistakes made by RWM until iteration . Then, for any expert we have
The proof of this lemma is very similar to the previous one, where the factor of two is saved by the use of randomness:
On the other hand, by definition we have for any expert that
Since the value of is always less than the sum of all weights , we conclude that
Taking the logarithm of both sides we get
3.3 Hedge
Historically, this was observed by a different and closely related algorithm called Hedge, whose total loss bound will be of interest to us later on in the book.
Henceforth, denote in vector notation the expected loss of the algorithm by
As before, let for all , and note that .
On the other hand, by definition, for expert we have that
Since the value of is always less than the sum of all weights , we conclude that
Taking the logarithm of both sides we get
and the theorem follows by simplifying. ∎
4 Bibliographic Remarks
The OCO model was first defined by Zinkevich (2003) and has since become widely influential in the learning community and significantly extended since (see thesis and surveys (Hazan, 2006, 2011; Shalev-Shwartz, 2011)).
The problem of prediction from expert advice and the Weighted Majority algorithm were devised in (Littlestone and Warmuth, 1989, 1994). This seminal work was one of the first uses of the multiplicative updates method—a ubiquitous meta-algorithm in computation and learning, see the survey (Arora et al., 2012) for more details. The Hedge algorithm was introduced by Freund and Schapire (1997).
The Universal Portfolios model was put forth in (Cover, 1991), and is one of the first examples of a worst-case online learning model. Cover gave an optimal-regret algorithm for universal portfolio selection that runs in exponential time. A polynomial time algorithm was given in (Kalai and Vempala, 2003), which was further sped up in (Agarwal et al., 2006; Hazan et al., 2007). Numerous extensions to the model also appeared in the literature, including addition of transaction costs (Blum and Kalai, 1999) and relation to the Geometric Brownian Motion model for stock prices (Hazan and Kale, 2009).
In their influential paper, Awerbuch and Kleinberg (2008) put forth the application of online convex optimization to online routing. A great deal of work has been devoted since then to improve the initial bounds, and generalize it into a complete framework for decision making with limited feedback. This framework is an extension of OCO, called Bandit Convex Optimization (BCO). We defer further bibliographic remarks to chapter 6 which is devoted to the BCO framework.
5 Exercises
1. (Attributed to Claude Shannon) Construct market returns over two stocks for which the wealth accumulated over any single stock decreases exponentially, whereas the best constant rebalanced portfolio increases wealth exponentially. More precisely, construct two sequences of numbers in the range , that represent returns, such that:
(a) Investing in any of the individual stocks results in exponential decrease in wealth. This means that the product of the prefix of numbers in each of these sequences decreases exponentially.
(b) Investing evenly on the two assets and rebalancing after every iteration increases wealth exponentially.
(a) Consider the experts problem in which the losses are between zero and a positive real number . Give an algorithm that attains expected loss upper bounded by:
for the best constant you can (the constant should be independent of the number of game iterations , and the number of experts . Assume that is known in advance).
(b) Suppose the upper bound is not known in advance. Give an algorithm whose performance is asymptotically as good as your algorithm in part (a), up to an additive and/or multiplicative constant which is independent of . Prove your claim.
3. Consider the experts problem in which the losses can be negative and are real numbers in the range $O(\sqrt{T\log N})$ and prove your claim.
Chapter 2 Basic Concepts in Convex Optimization
In this chapter we give a gentle introduction to convex optimization and present some basic algorithms for solving convex mathematical programs. Although offline convex optimization is not our main topic, it is useful to recall the basic definitions and results before we move on to OCO. This will help in assessing the advantages and limitations of OCO. Furthermore, we describe some tools that will be our bread-and-butter later on.
The material in this chapter is far from being new. A broad and significantly more detailed literature exists, and the reader is deferred to the bibliography at the end of this chapter for references. We give here only the most elementary analysis, and focus on the techniques that will be of use to us later on.
A set is convex if for any , all the points on the line segment connecting and also belong to , i.e.,
This inequality, and generalizations thereof, is also known as Jensen’s inequality. Equivalently, if is differentiable, that is, its gradient exists for all , then it is convex if and only if
For convex and non-differentiable functions , the subgradient at is defined to be any member of the set of vectors that satisfies the above for all .
We denote by an upper bound on the norm of the subgradients of over , i.e., for all . Such an upper bound implies that the function is Lipschitz continuous with parameter , that is, for all
The optimization and machine learning literature studies special types of convex functions that admit useful properties, which in turn allow for more efficient optimization. Notably, we say that a function is -strongly convex if
The latter condition is equivalent to a Lipschitz condition over the gradients, i.e.,
If the function is twice differentiable and admits a second derivative, known as a Hessian for a function of several variables, the above conditions are equivalent to the following condition on the Hessian, denoted :
where if the matrix is positive semidefinite.
When the function is both -strongly convex and -smooth, we say that it is -well-conditioned where is the ratio between strong convexity and smoothness, also called the condition number of
In the following algorithms we shall make use of a projection operation onto a convex set, which is defined as the closest point in terms of Euclidean distance 3 We will discuss projections with respect to other distance notions in chapter 5. inside the convex set to a given point. Formally,
The computational complexity of projections is a subtle issue that depends much on the characterization of itself. Most generally, can be represented by a membership oracle—an efficient procedure that is capable of deciding whether a given belongs to or not. In this case, projections can be computed in polynomial time. In certain special cases, projections can be computed very efficiently in near-linear time. The computational cost of projections, as well as optimization algorithms that avoid them altogether, is discussed in chapter 7.
A crucial property of projections that we shall make extensive use of is the Pythagorean theorem, which we state here for completeness:
We note that there exists a more general version of the Pythagorean theorem. The above theorem and the definition of projections are true and valid not only for Euclidean norms, but for projections according to other distances that are not norms. In particular, an analogue of the Pythagorean theorem remains valid with respect to Bregman divergences (see chapter 5).
1.2 Introduction to optimality conditions
The standard curriculum of high school mathematics contains the basic facts concerning when a function (usually in one dimension) attains a local optimum or saddle point. The generalization of these conditions to more than one dimension is called the KKT (Karush-Kuhn-Tucker) conditions, and the reader is referred to the bibliographic material at the end of this chapter for an in-depth rigorous discussion of optimality conditions in general mathematical programming.
We will require a slightly more general, but equally intuitive, fact for constrained optimization: at a minimum point of a constrained convex function, the inner product between the negative gradient and direction towards the interior of is non-positive. This is depicted in figure 2.2, which shows that defines a supporting hyperplane to . The intuition is that if the inner product were positive, one could improve the objective by moving in the direction of the projected negative gradient. This fact is stated formally in the following theorem.
2 Gradient Descent
Gradient descent (GD) is the simplest and oldest of optimization methods. It is an iterative method—the optimization procedure proceeds in iterations, each improving the objective value. The basic method amounts to iteratively moving the current point in the direction of the gradient, which is a linear time operation if the gradient is given explicitly (indeed, for many functions computing the gradient at a certain point is a simple linear-time operation).
The basic template algorithm, for unconstrained optimization, is given in 2, and a depiction of the iterates it produced in figure 2.3.
For a convex function there always exists a choice of step sizes that will cause GD to converge to the optimal solution. The rates of convergence, however, differ greatly and depend on the smoothness and strong convexity properties of the objective function. The following table summarises the convergence rates of GD variants for convex functions with different convexity parameters. The rates described omit the (usually small) constants in the bounds—we focus on asymptotic rates.
In this section we address only the first row of Table 2.1. For accelerated methods and their analysis see references at the bibliographic section.
Luckily, there exists a simple choice of step sizes that yields the optimal convergence rate, called the Polyak stepsize. It has a huge advantage of not depending on the strong convexity and/or smoothness parameters of the objective function.
However, it does depend on the distance in function value to optimality and gradient norm. While the latter can be efficiently estimated, the distance to optimality is not always available if is not known ahead of time. This can be remedied, as referred to in the bibliography.
Distance to optimality in value:
Euclidean distance to optimality:
Current gradient norm
With these notations we can describe the algorithm precisely in Algorithm 3:
To prove precise convergence bounds, assume , and define:
We can now state the main guarantee of GD with the Polyak stepsize:
(GD with the Polyak Step Size) Algorithm 3 guarantees the following after steps:
2.2 Measuring distance to optimality
When analyzing convergence of gradient methods, it is useful to use potential functions in lieu of function distance to optimality, such as gradient norm and/or Euclidean distance. The following relationships hold between these quantities.
where the last inequality follows since the gradient at the global optimum is zero.
where the last inequality follows since the gradient at the global optimum is zero.
: Using smoothness, and let for ,
:
In particular, taking , we get
2.3 Analysis of the Polyak stepsize
We are now ready to prove Theorem 2.3, which directly follows from the following lemma.
Suppose that a sequence satisfies:
then for as defined in the algorithm, we have:
For convex functions with gradient bounded by ,
Summing up over iterations, and using Cauchy-Schwartz on the -dimensional vectors of and , we have
For smooth functions whose gradient is bounded by , Lemma 2.4 implies:
For strongly convex functions, Lemma 2.4 implies:
In other words, Defining , we have:
This implies that , which can be seen by induction5That follows from Lemma 2.4. For , since and . For the induction step, .. The proof is completed as follows6This assumes is even. odd leads to the same constants. :
Thus, there exists a for which . Taking the square root completes the claim.
For both strongly convex and smooth functions:
3 Constrained Gradient/Subgradient Descent
The vast majority of the problems considered in this text include constraints. Consider the examples given in section 1.2: a path is a point in the flow polytope, a portfolio is a point in the simplex and so on. In the language of optimization, we require not only to minimize a certain objective function, but also to belong to a convex set .
In this section we describe and analyze constrained gradient descent. Algorithmically, the change from the previous section is small: after updating the current point in the direction of the gradient, one may need to project back to the decision set. However, the analysis is somewhat more involved, and instructive for the later parts of this text.
Algorithmic box 4 describes a template for gradient descent over a constrained set. It is a template since the sequence of step sizes is left as an input parameter, and the several variants of the algorithm differ on its choice.
As opposed to the unconstrained setting, here we require a precise setting of the learning rate to obtain the optimal convergence rate.
For constrained minimization of -well-conditioned functions and , Algorithm 4 converges as
By strong convexity we have for every (where we denote as before):
Next, appealing to the algorithm’s definition and the choice , we have
The minimum can only grow if we take it over a subset of . Thus we can restrict our attention to all points that are convex combination of and , which we denote by the interval , and write
Where the equality is by writing as . Using strong convexity, we have for any and the minimizer :
Thus, plugging this into equation (2.3.1), we get
This gives the theorem statement by induction. ∎
4 Reductions to Non-smooth and Non-strongly Convex Functions
The previous section dealt with -well-conditioned functions, which may seem like a significant restriction over vanilla convexity. Indeed, many interesting convex functions are not strongly convex nor smooth, and as we have seen, the convergence rate of gradient descent greatly differs for these functions. We have completed the picture for unconstrained optimization, and in this section we complete it for a bounded set.
The literature on first order methods is abundant with specialized analyses that explore the convergence rate of gradient descent for more general functions. In this manuscript we take a different approach: instead of analyzing variants of GD from scratch, we use reductions to derive near-optimal convergence rates for smooth functions that are not strongly convex, or strongly convex functions that are not smooth, or general convex functions without any further restrictions.
While attaining sub-optimal convergence bounds (by logarithmic factors), the advantage of this approach is two-fold: first, the reduction method is very simple to state and analyze, and its analysis is significantly shorter than analyzing GD from scratch. Second, the reduction method is generic, and thus extends to the analysis of accelerated gradient descent (or any other first order method) along the same lines. We turn to these reductions next.
Our first reduction applies the GD algorithm to functions that are -smooth but not strongly convex.
The idea is to add a controlled amount of strong convexity to the function , and then apply the algorithm 4 to optimize the new function. The solution is distorted by the added strong convexity, but a tradeoff guarantees a meaningful convergence rate.
where we ignore constants and terms depending on and . ∎
Stronger convergence rates of can be obtained by analyzing GD from scratch, and these are known to be tight. Thus, our reduction is suboptimal by a factor of , which we tolerate for the reasons stated at the beginning of this section.
4.2 Reduction to strongly convex, non-smooth functions
Our reduction from non-smooth functions to -well-conditioned functions is similar in spirit to the one of the previous subsection. However, whereas for strong convexity the obtained rates were off by a factor of , in this section we will also be off by factor of , the dimension of the decision variable , as compared to the standard analyses in convex optimization. For tight bounds, the reader is referred to the excellent reference books and surveys listed in the bibliography section 2.6.
We apply the GD algorithm to a smoothed variant of the objective function. In contrast to the previous reduction, smoothing cannot be obtained by simple addition of a smooth (or any other) function. Instead, we need a smoothing operation. The one we describe is particularly simple and amounts to taking a local integral of the function. More sophisticated, but less general, smoothing operators exist that are based on the Moreau-Yoshida regularization, see bibliographic section for more details.
Let be -Lipschitz continuous and -strongly convex. Define for any ,
has the following properties:
If is -strongly convex, then so is
is -smooth
for all .
Before proving this lemma, let us first complete the reduction. Using Lemma 2.8 and the convergence for -well-conditioned functions the following approximation bound is obtained.
For Algorithm 6 converges as
Before proving this lemma, notice that the gradient descent method is applied with gradients of the smoothed function rather than gradients of the original objective . In this section we ignore the computational cost of computing such gradients given only access to gradients of , which may be significant. Techniques for estimating these gradients are further explored in chapter 6.
Note that by Lemma 2.8 the function is -well-conditioned for
We proceed to prove that is indeed a good approximation to the original function.
Recall that a function is -smooth if and only if for all , it holds that . Now,
This proves the second property of Lemma 2.8. We proceed to show the third property, namely that is a good approximation to .
We note that GD variants for -strongly convex functions, even without the smoothing approach used in our reduction, are known to converge quickly and without dependence on the dimension. We state the known algorithm and result here without proof (see bibliography for references).
Let be -strongly convex, and let be the iterates of Algorithm 4 applied to with . Then
4.3 Reduction to general convex functions
5 Example: Support Vector Machine Training
To illustrate the usefulness of the gradient descent method, let us describe an optimization problem that has gained much attention in machine learning and can be solved efficiently using the methods we have just analyzed.
A very basic and successful learning paradigm is the linear classification model. In this model, the learner is presented with positive and negative examples of a concept. Each example, denoted by , is represented in Euclidean space by a dimensional feature vector. For example, a common representation for emails in the spam-classification problem are binary vectors in Euclidean space, where the dimension of the space is the number of words in the language. The ’th email is a vector whose entries are given as ones for coordinates corresponding to words that appear in the email, and zero otherwise7Such a representation may seem naïve at first as it completely ignores the words’ order of appearance and their context. Extensions to capture these features are indeed studied in the Natural Language Processing literature.. In addition, each example has a label , corresponding to whether the email has been labeled spam/not spam. The goal is to find a hyperplane separating the two classes of vectors: those with positive labels and those with negative labels. If such a hyperplane, which completely separates the training set according to the labels, does not exist, then the goal is to find a hyperplane that achieves a separation of the training set with the smallest number of mistakes.
where is the sign function, and is the indicator function that takes the value if the condition is satisfied and zero otherwise.
This optimization problem, which is at the heart of the linear classification formulation, is NP-hard, and in fact NP-hard to even approximate non-trivially 8see bibliography for references to these results.. However, in the special case that a linear classifier (a hyperplane ) that classifies all of the examples correctly exists, the problem is solvable in polynomial time via linear programming.
Various relaxations have been proposed to solve the more general case, when no perfect linear classifier exists. One of the most successful in practice is the Support Vector Machine (SVM) formulation.
The soft margin SVM relaxation replaces the loss in (2.7) with a convex loss function, called the hinge-loss, given by
In figure 2.4 we depict how the hinge loss is a convex relaxation for the non-convex loss.
Further, the SVM formulation adds to the loss minimization objective a term that regularizes the size of the elements in . The reason and meaning of this additional term shall be addressed in later sections. For now, let us consider the SVM convex program:
This is an unconstrained non-smooth and strongly convex program. It follows from Theorems 2.3 and 2.10 that iterations suffice to attain an -approximate solution. We spell out the details of applying the subgradient descent algorithm to this formulation in Algorithm 7.
Notice that the learning rates are left unspecified, even though they can be explicitly set as in Theorem 2.10, or using the Polyak rate. The Polyak rate requires knowing the function value at optimality, although this can be relaxed (see bibliography).
A caveat of using gradient descent for SVM is the requirement to compute the full gradient, which may require a full pass over the data for each iteration. We will see a significantly more efficient algorithm in the next chapter!
6 Bibliographic Remarks
The reader is referred to dedicated books on convex optimization for much more in-depth treatment of the topics surveyed in this background chapter. For background in convex analysis see the texts (Borwein and Lewis, 2006; Rockafellar, 1997). The classic textbook of Boyd and Vandenberghe (2004) gives a broad introduction to convex optimization with numerous applications, see also (Boyd, 2014). For detailed rigorous convergence proofs and in depth analysis of first order methods, see lecture notes by Nesterov (2004) and books by Nemirovski and Yudin (1983); Nemirovskii (2004), as well as more recent lecture notes and texts (Bubeck, 2015; Hazan, 2019). Theorem 2.10 is taken from (Bubeck, 2015) Theorem 3.9.
The logarithmic overhead in the reductions of section 2.4 can be removed with a more careful reduction and analysis, for details see (Allen-Zhu and Hazan, 2016). A more sophisticated smoothing operator is the Moreau-Yoshida regularization: it avoids the dimension factor loss. However, it is sometimes less computationally efficient to work with (Parikh and Boyd, 2014).
The Polyak learning rate is detailed in (Polyak, 1987). A recent exposition allows obtaining the same optimal rate without knowledge of the optimal function value (Hazan and Kakade, 2019).
Using linear separators and halfspaces to learn and separate data was considered in the very early days of AI (Rosenblatt, 1958; Minsky and Papert, 1969). Notable the Perceptron algorithm was one of the first learning algorithms, and closely related to gradient descent. Support vector machines were introduced in (Cortes and Vapnik, 1995; Boser et al., 1992), see also the book of Schölkopf and Smola (2002).
Learning halfspaces with the zero-one loss is computationally hard, and hard to even approximate non-trivially (Daniely, 2016). Proving that a problem is hard to approximate is at the forefront of computational complexity, and based on novel characterizations of the complexity class NP (Arora and Barak, 2009).
7 Exercises
(a)
(b) Prove that if is twice differentiable and it holds that for any , then the condition number of over is .
(a) The sum of convex functions is convex.
(b) Let be -strongly convex and be -strongly convex. Then is -strongly convex.
(c) Let be -smooth and be -smooth. Then is -smooth.
8. * Extending Nesterov’s accelerated GD algorithm: Assume a black-box access to Nesterov’s algorithm that attains the rate of for -well-conditioned functions, as in Table 2.1. Apply a reduction to obtain the rate for -smooth functions, as in Table 2.1, up to logarithmic factors.
Chapter 3 First-Order Algorithms for Online Convex Optimization
In this chapter we describe and analyze the most simple and basic algorithms for online convex optimization (recall the definition of the model as introduced in chapter 1), which are also surprisingly useful and applicable in practice. We use the same notation introduced in §2.1. However, in contrast to the previous chapter, the goal of the algorithms introduced in this chapter is to minimize regret, rather than the optimization error (which is ill-defined in an online setting).
Table 3.1 details known upper and lower bounds on the regret for different types of convex functions as it depends on the number of prediction iterations.
The reader may recall Table 2.1 describing offline convergence of first order methods: as opposed to offline optimization, smoothness does not improve asymptotic regret rates. However, exp-concavity, a weaker property than strong convexity, comes into play and gives improved regret rates.
This chapter will present algorithms and lower bounds that realize the above known results for OCO. The property of exp-concavity and its applications, as well as logarithmic regret algorithms for exp-concave functions are deferred to the next chapter.
Perhaps the simplest algorithm that applies to the most general setting of online convex optimization is online gradient descent. This algorithm, which is based on standard gradient descent from offline optimization, was introduced in its online form by Zinkevich (see bibliography at the end of this section).
Pseudo-code for the algorithm is given in Algorithm 8, and a conceptual illustration is given in figure 3.1.
In each iteration, the algorithm takes a step from the previous point in the direction of the gradient of the previous cost. This step may result in a point outside of the underlying convex set. In such cases, the algorithm projects the point back to the convex set, i.e. finds its closest point in the convex set. Despite the fact that the next cost function may be completely different than the costs observed thus far, the regret attained by the algorithm is sublinear. This is formalized in the following theorem (recall the definition of and from the previous chapter).
Online gradient descent with step sizes guarantees the following for all :
Let . Define . By convexity
We first upper-bound using the update rule for and Theorem 2.1 (the Pythagorean theorem):
Summing (3.1) and (3.1) from to , and setting (with ):
The last inequality follows since and . ∎
The online gradient descent algorithm is straightforward to implement, and updates take linear time given the gradient. However, there is a projection step which may take significantly longer, as discussed in §2.1.1 and chapter 7.
2 Lower Bounds
The previous section introduces and analyzes a very simple and natural approach to online convex optimization. Before continuing our venture, it is worthwhile to consider whether the previous bound can be improved? We measure performance of OCO algorithms both by regret and by computational efficiency. Therefore, we ask ourselves whether even simpler algorithms that attain tighter regret bounds exist.
The computational efficiency of online gradient descent seemingly leaves little room for improvement, putting aside the projection step it runs in linear time per iteration. What about obtaining better regret?
Perhaps surprisingly, the answer is negative: online gradient descent attains, in the worst case, tight regret bounds up to small constant factors! This is formally given in the following theorem.
Any algorithm for online convex optimization incurs regret in the worst case. This is true even if the cost functions are generated from a fixed stationary distribution.
We give a sketch of the proof; filling in all details is left as an exercise at the end of this chapter.
Consider an instance of OCO where the convex set is the -dimensional hypercube, i.e.
There are linear cost functions, one for each vertex , defined as
Notice that both the diameter of and the bound on the norm of the cost function gradients, denoted G, are bounded by
The cost functions in each iteration are chosen at random, with uniform probability, from the set . Denote by the vertex chosen in iteration , and denote . By uniformity and independence, for any and chosen online, . However,
The last equality is left as an exercise.
The facts above nearly complete the proof of Theorem 3.2; see the exercises at the end of this chapter.
3 Logarithmic Regret
At this point, the reader may wonder: we have introduced a seemingly sophisticated and obviously general framework for learning and prediction, as well as a linear-time algorithm for the most general case, complete with tight regret bounds, and done so with elementary proofs! Is this all OCO has to offer?
Simple is good: the philosophy behind OCO treats simplicity as a merit. The main reason OCO has taken the stage in online learning in recent years is the simplicity of its algorithms and their analysis, which allow for numerous variations and tweaks in their host applications.
A very wide class of settings, which will be the subject of the next sections, admit more efficient algorithms, in terms of both regret and computational complexity.
In §2 we surveyed optimization algorithms with convergence rates that vary greatly according to the convexity properties of the function to be optimized. Do the regret bounds in online convex optimization vary as much as the convergence bounds in offline convex optimization over different classes of convex cost functions?
Indeed, next we show that for important classes of loss functions significantly better regret bounds are possible.
The first algorithm that achieves regret logarithmic in the number of iterations is a twist on the online gradient descent algorithm, changing only the step size. The following theorem establishes logarithmic bounds on the regret if the cost functions are strongly convex.
For -strongly convex loss functions, online gradient descent with step sizes achieves the following guarantee for all
Let . Recall the definition of regret
Define . Applying the definition of -strong convexity to the pair of points ,, we have
We proceed to upper-bound . Using the update rule for and the Pythagorean theorem 2.1, we get
Summing (3.5) from to , setting (define ), and combining with (3.4), we have:
4 Application: Stochastic Gradient Descent
A special case of Online Convex Optimization is the well-studied setting of stochastic optimization. In stochastic optimization, the optimizer attempts to minimize a convex function over a convex domain as given by the mathematical program:
However, unlike standard offline optimization, the optimizer is given access to a noisy gradient oracle, defined by
That is, given a point in the decision set, a noisy gradient oracle returns a random vector whose expectation is the gradient at the point and whose variance is bounded by .
We will show that regret bounds for OCO translate to convergence rates for stochastic optimization. As a special case, consider the online gradient descent algorithm whose regret is bounded by
Applying the OGD algorithm over a sequence of linear functions that are defined by the noisy gradient oracle at consecutive points, and finally returning the average of all points along the way, we obtain the stochastic gradient descent algorithm, presented in Algorithm 9.
Algorithm 9 with step sizes guarantees
It is important to note that in the proof above, we have used the fact that the regret bounds of online gradient descent hold against an adaptive adversary. This need arises since the cost functions defined in Algorithm 9 depend on the choice of decision .
Recall our example of Support Vector Machine training from §2.5. The task of training an SVM over a given data set amounts to solving the following convex program (equation (2.8)):
Using the technique described in this chapter, namely the OGD and SGD algorithms, we can devise a much faster algorithm than the one presented in the previous chapter. The idea is to generate an unbiased estimator for the gradient of the objective using a single example in the dataset, and use it in lieu of the entire gradient. This is given formally in the SGD algorithm for SVM training presented in Algorithm 10.
This matches the convergence rate of standard offline gradient descent. However, observe that each iteration is significantly cheaper—only one example in the data set need be considered! That is the magic of SGD; we have matched the nearly optimal convergence rate of first order methods using extremely cheap iterations. This makes it the method of choice in numerous applications.
5 Bibliographic Remarks
The OCO framework was introduced by Zinkevich (2003), where the OGD algorithm was introduced and analyzed. Precursors to this algorithm, albeit for less general settings, were introduced and analyzed in (Kivinen and Warmuth, 1997). Logarithmic regret algorithms for Online Convex Optimization were introduced and analyzed in (Hazan et al., 2007).
The stochastic gradient descent (SGD) algorithm dates back to Robbins and Monro (1951), where it was called “stochastic approximation”. The importance of SGD for machine learning was advocated for in (Bottou, 1998; Bottou and Bousquet, 2008). The literature on SGD is vast and the reader is referred to the text of Bubeck (2015) and paper by Lan (2012).
Application of SGD to soft-margin SVM training was explored in (Shalev-Shwartz et al., 2011a). Tight convergence rates of SGD for strongly convex and non-smooth functions were only recently obtained in (Hazan and Kale, 2011; Rakhlin et al., 2012; Shamir and Zhang, 2013).
6 Exercises
2. ∗ In this exercise we show how to remove some a-priory knowledge from the design of online convex optimization algorithms.
(a) Design an OCO algorithm that attains the same asymptotic regret bound as OGD, up to factors logarithmic in without knowing the parameter ahead of time.
(b) Do the same for the parameter : design an OCO algorithm that attains the same asymptotic regret bound as OGD, up to factors logarithmic in without knowing the parameter ahead of time. This time you may assume is known. You may assume that it is possible to compute projections onto without knowing its diameter.
3. In this exercise we prove a tight lower bound on the regret of any algorithm for online convex optimization.
(a) For any sequence of fair coin tosses, let be the number of head outcomes and be the number of tails. Give an asymptotically tight upper and lower bound on . That is, give an order of growth of this random variable as a function of , up to multiplicative and additive constants.
(b) Consider a 2-expert problem, in which the losses are inversely correlated: either expert one incurs a loss of one and the second expert negative one, or vice versa. Use the fact above to design a setting in which any experts algorithm incurs regret asymptotically matching the upper bound.
(c) Consider the general OCO setting over a convex set . Design a setting in which the cost functions have gradients whose norm is bounded by , and obtain a lower bound on the regret as a function of , the diameter of , and the number of game iterations.
4. Implement the SGD algorithm for SVM training. Apply it on the MNIST dataset. Compare your results to the offline GD algorithm from the previous chapter.
Chapter 4 Second-Order Methods
The motivation for this chapter is the application of online portfolio selection, considered in the first chapter of this book. We begin with a detailed description of this application. We proceed to describe a new class of convex functions that model this problem. This new class of functions is more general than the class of strongly convex functions discussed in the previous chapter. It allows for logarithmic regret algorithms, which are based on second order methods from convex optimization. In contrast to first order methods, which have been our focus thus far and relied on (sub)gradients, second order methods exploit information about the second derivative of the objective function.
In this subsection we give the formal definition of the universal portfolio selection problem that was informally described in §1.2.
Mainstream financial theory models stock prices as a stochastic process known as Geometric Brownian Motion (GBM). This model assumes that the fluctuations in the prices of the stocks behave essentially as a random walk. It is perhaps easier to think about a price of an asset (stock) on time segments, obtained from a discretization of time into equal segments. Thus, the logarithm of the price at segment , denoted , is given by the sum of the logarithm of the price at segment and a Gaussian random variable with a particular mean and variance,
This is only an informal way of thinking about GBM. The formal model is a continuous time process, similar to the discrete time stochastic process we have just described, obtained as the time intervals, means, and variances approach zero.
The GBM model gives rise to particular algorithms for portfolio selection (as well as more sophisticated applications such as options pricing). Given the means and variances of the stock prices over time of a set of assets, as well as their cross-correlations, a portfolio with maximal expected gain (mean) for a specific risk (variance) threshold can be formulated.
The fundamental question is, of course, how does one obtain the mean and variance parameters, not to mention the cross-correlations, of a given set of stocks? One accepted solution is to estimate these from historical data, e.g., by taking the recent history of stock prices.
1.2 Universal portfolio theory
The theory of universal portfolio selection is very different from the GBM model. The main difference being the lack of statistical assumptions about the stock market. The idea is to model investing as a repeated decision making scenario, which fits nicely into our OCO framework, and to measure regret as a performance metric.
How does the decision maker’s wealth change? Let be her total wealth at iteration . Then, ignoring transaction costs, we have
Over iterations, the total wealth of the investor is given by
The goal of the decision maker, to maximize the overall wealth gain , can be attained by maximizing the following more convenient logarithm of this quantity, given by
The above formulation is already very similar to our OCO setting, albeit phrased as a gain maximization rather than a loss minimization setting. Let
The convex set is the -dimensional simplex , and define the regret to be
The functions are concave rather than convex, which is perfectly fine as we are framing the problem as a maximization rather than a minimization. Note also that the regret is the negation of the usual regret notion (1.1) we have considered for minimization problems.
Since this is an online convex optimization instance, we can use the online gradient descent algorithm from the previous chapter to invest, which ensures regret (see exercises). What guarantee do we attain in terms of investing? To answer this, in the next section we reason about what in the above expression may be.
1.3 Constant rebalancing portfolios
As is a point in the -dimensional simplex, consider the special case of , i.e., the first standard basis vector (the vector that has zero in all coordinates except the first, which is set to one). The term becomes , or
As becomes large, any sublinear regret guarantee (e.g., the regret guarantee achieved using online gradient descent) achieves an average regret that approaches zero. In this context, this implies that the log-wealth gain achieved (in average over rounds) is as good as that of the first stock. Since can be taken to be any vector, sublinear regret guarantees average log-wealth growth as good as any stock!
However, can be significantly better, as shown in the following example. Consider a market of two stocks that fluctuate wildly. The first stock increases by every even day and returns to its original price the following (odd) day. The second stock does exactly the opposite: decreases by on even days and rises back on odd days. Formally, we have
Clearly, any investment in either of the stocks will not gain in the long run. However, the portfolio increases wealth by a factor of daily! Such a mixed distribution is called a fixed rebalanced portfolio, as it needs to rebalance the proportion of total capital invested in each stock at each iteration to maintain this fixed distribution strategy.
Thus, vanishing average regret guarantees long-run growth as the best constant rebalanced portfolio in hindsight. Such a portfolio strategy is called universal. We have seen that the online gradient descent algorithm gives essentially a universal algorithm with regret . Can we get better regret guarantees?
2 Exp-Concave Functions
For convenience, we return to considering losses of convex functions, rather than gains of concave functions as in the application for portfolio selection. The two problems are equivalent: we simply replace the maximization of the concave with the minimization of the convex .
In the previous chapter we have seen that the OGD algorithm with carefully chosen step sizes can deliver logarithmic regret for strongly convex functions. However, the loss function for the OCO setting of portfolio selection, is not strongly convex. Instead, the Hessian of this function is given by
which is a rank one matrix. Recall that the Hessian of a twice-differentiable strongly convex function is larger than a multiple of identity matrix and is positive definite and in particular has full rank. Thus, the loss function above is quite far from being strongly convex.
However, an important observation is that this Hessian is large in the direction of the gradient. This property is called exp-concavity. We proceed to define this property rigorously and show that it suffices to attain logarithmic regret.
For the following discussion, recall the notation of §2.1, and in particular our convention over matrices that if and only if is positive semidefinite. Exp-concavity implies strong-convexity in the direction of the gradient. This reduces to the following property:
The proof of this lemma is given as a guided exercise at the end of this chapter. We prove a slightly stronger lemma below.
The composition of a concave and non-decreasing function with another concave function is concave 9see exercises.. Therefore, since , the composition of with is concave. It follows that the function is concave. Then by the concavity of ,
Plugging in gives
Next, note that and that using the Taylor approximation, for , it holds that . Applying the inequality for implies the lemma. ∎
3 Exponentially Weighted Online Convex Optimization
Before diving into efficient second order methods, we first describe a simple algorithm based on the multiplicative updates method which gives logarithmic regret for exp-concave losses. Algorithm (11) below, called EWOO, is a close relative to the Hedge Algorithm (1). Its regret guarantee is robust: it does not include a Lipschitz constant or a diameter bound. In addition, it is particularly simple to describe and analyze.
The downside of EWOO is its running time. A naive implementation would run in exponential time of the dimension. It is possible to given a randomized polynomial time implementation based on random sampling techniques, where the polynomial depends both on the dimension as well as the number of iterations, see bibliographic section for more details.
In the analysis below, it can be observed that choosing at random with density proportional to , instead of computing the entire integral, also guarantees our regret bounds on the expectation. This is the basis for the polynomial time implementation. We proceed to give the logarithmic regret bounds.
Let . Since is -exp-concave, we have that is concave and thus
By definition of we have . Denote by the translated Minkowski set given by
By concavity of and the fact that is non-negative, we have that,
Finally, since is simply a rescaling of followed by a translation, and we are in dimensions, . Putting this together with equation (4.1), we have
We can now simplify by taking logarithms and changing sides,
where the last step is by choosing . ∎
4 The Online Newton Step Algorithm
Thus far we have only considered first order methods for regret minimization. In this section we consider a quasi-Newton approach, i.e., an online convex optimization algorithm that approximates the second derivative, or Hessian in more than one dimension. However, strictly speaking, the algorithm we analyze is also first order, in the sense that it only uses gradient information.
The algorithm we introduce and analyze, called online Newton step, is detailed in Algorithm 12. At each iteration, this algorithm chooses a vector that is the projection of the sum of the vector chosen at the previous iteration and an additional vector. Whereas for the online gradient descent algorithm this added vector was the gradient of the previous cost function, for online Newton step this vector is different: it is reminiscent to the direction in which the Newton-Raphson method would proceed if it were an offline optimization problem for the previous cost function. The Newton-Raphson algorithm would move in the direction of the vector which is the inverse Hessian times the gradient. In online Newton step, this direction is , where the matrix is related to the Hessian as will be shown in the analysis.
Since adding a multiple of the Newton vector to the current vector may result in a point outside the convex set, an additional projection step is required to obtain , the decision at time . This projection is different than the standard Euclidean projection used by online gradient descent in Section 3.1. It is the projection according to the norm defined by the matrix , rather than the Euclidean norm.
The advantage of the online Newton step algorithm is its logarithmic regret guarantee for exp-concave functions, as defined in the previous section. The following theorem bounds the regret of online Newton step.
Algorithm 12 with parameters , and guarantees
As a first step, we prove the following lemma.
The regret of online Newton step is bounded by
Let be the best decision in hindsight. By Lemma 4.3, we have for ,
According to the update rule of the algorithm . Now, by the definition of :
Multiplying the transpose of (4.2) by (4.3) we get
Since is the projection of in the norm induced by , we have by the Pythagorean theorem (see §2.1.1)
This inequality is the reason for using generalized projections as opposed to standard projections, which were used in the analysis of online gradient descent (see §3.1 Equation (3.2)). This fact together with (4.4) gives
Now, summing up over to we get that
In the last inequality we use the fact that , and the fact that the matrix is PSD and hence the last term before the inequality is negative. Thus,
Using the algorithm parameters , and our notation for the diameter we have
Since , we have . This gives the lemma. ∎
First we show that the term is upper bounded by a telescoping sum. Notice that
Since and , the largest eigenvalue of is at most . Hence the determinant of can be bounded by . Hence recalling that and , for ,
which implies the theorem for .
It remains to prove the technical lemma for positive semidefinite (PSD) matrices used above.
Let be positive definite matrices. Then
For any positive definite matrix , denote by its eigenvalues (which are positive).
In the last equality we use the facts and for positive definite matrices (see exercises). ∎
The online Newton step algorithm requires space to store the matrix . Every iteration requires the computation of the matrix , the current gradient, a matrix-vector product, and possibly a projection onto the underlying convex set .
A naïve implementation would require computing the inverse of the matrix on every iteration. However, in the case that is invertible, the matrix inversion lemma (see bibliography) states that for invertible matrix and vector ,
Thus, given and one can compute in time using only matrix-vector and vector-vector products.
The online Newton step algorithm also needs to make projections onto , but of a slightly different nature than online gradient descent and other online convex optimization algorithms. The required projection, denoted by , is in the vector norm induced by the matrix , viz. . It is equivalent to finding the point which minimizes where is the point we are projecting. This is a convex program which can be solved up to any degree of accuracy in polynomial time.
Modulo the computation of generalized projections, the online Newton step algorithm can be implemented in time and space . In addition, the only information required is the gradient at each step (and the exp-concavity constant of the loss functions).
5 Bibliographic Remarks
The Geometric Brownian Motion model for stock prices was suggested and studied as early as 1900 in the PhD thesis of Louis Bachelier (Bachelier, 1900), see also (Osborne, 1959), and used in the Nobel Prize winning work of Black and Scholes on options pricing (Black and Scholes, 1973). In a strong deviation from standard financial theory, Thomas Cover (Cover, 1991) put forth the universal portfolio model, whose algorithmic theory we have historically sketched in chapter 1. The EWOO algorithm was essentially given in Cover’s paper for the application of portfolio selection and logarithmic loss functions, and extended to exp-concave loss functions in (Hazan et al., 2006). The randomized extension of Cover’s algorithm that runs in polynomial running time is due to Kalai and Vempala (2003), and it naturally extends to EWOO.
Some bridges between classical portfolio theory and the universal model appear in (Abernethy et al., 2012). Options pricing and its relation to regret minimization was recently also explored in the work of (DeMarzo et al., 2006).
Exp-concave functions have been considered in the context of prediction in (Kivinen and Warmuth, 1999), see also (Cesa-Bianchi and Lugosi, 2006) (chapter 3.3 and bibliography). A more general condition than exp-concavity called mixability was used by Vovk (1990) to give a general multiplicative update algorithm, see also (Foster et al., 2018). For a thorough discussion of various conditions that allow logarithmic regret in online learning see (van Erven et al., 2015).
For the square-loss, (Azoury and Warmuth, 2001) gave a specially tailored and near-optimal prediction algorithm. Logarithmic regret algorithms for online convex optimization and the Online Newton Step algorithm were presented in (Hazan et al., 2007).
The Sherman-Morrison formula, a.k.a. the matrix inversion lemma, gives the form of the inverse of a matrix after a rank-1 update, see (Riedel, 1991).
6 Exercises
1. For this question, assume all functions are twice differentiable. Prove that exp-concave functions are a larger class than strongly convex and Lipschitz functions. That is, prove that a strongly convex function over a bounded domain that is also -Lipschitz is also exp-concave. Show that the converse is not necessarily true.
2. Prove that a twice-differentiable function is -exp-concave over if and only if for all ,
Hint: consider the Hessian of the function , and use the fact that the Hessian of a convex function is always positive semidefinite.
3. Write pseudo-code for a portfolio selection algorithm based on online gradient descent. That is, given a set of return vectors, spell out the exact constants and updates based upon the gradients of the reward functions. Derive the regret bound based on Theorem 3.1. You may assume that the multiplicative change in price for any single asset is bounded, and use this quantity in your regret bound. Do the same (pseudo-code and regret bound) for the Online Newton Step algorithm applied to portfolio selection. Note: you are not required to give pseudo-code for projections onto the simplex.
4. Download stock prices from your favorite online finance website over a period of at least three years. Create a dataset for testing portfolio selection algorithms by creating price-return vectors. Implement the OGD and ONS algorithms and benchmark them on your data.
5. Prove that for positive definite matrices, , the following hold: and , where denotes the determinant of .
Chapter 5 Regularization
In the previous chapters we have explored algorithms for OCO that are motivated by convex optimization. However, unlike convex optimization, the OCO framework optimizes the Regret performance metric. This distinction motivates a family of algorithms, called “Regularized Follow The Leader” (RFTL), which we introduce in this chapter.
In an OCO setting of regret minimization, the most straightforward approach for the online player is to use at any time the optimal decision (i.e., point in the convex set) in hindsight. Formally, let
This flavor of strategy is known as “fictitious play” in economics, and has been named “Follow the Leader” (FTL) in machine learning. It is not hard to see that this simple strategy fails miserably in a worst-case sense. That is, this strategy’s regret can be linear in the number of iterations, as the following example shows: Consider , let , and let for alternate between or . Thus,
The FTL strategy will keep shifting between and , always making the wrong choice.
The intuitive FTL strategy fails in the example above because it is unstable. Can we modify the FTL strategy such that it won’t change decisions often, thereby causing it to attain low regret?
This question motivates the need for a general means of stabilizing the FTL method. Such a means is referred to as “regularization”.
Although it is not strictly necessary, we assume that the regularization functions in this chapter are twice differentiable over and, for all points in the interior of the decision set, have a Hessian that is, by the strong convexity of , positive definite.
We denote the diameter of the set relative to the function as
Henceforth we make use of general norms and their dual. The dual norm to a norm is given by the following definition:
A positive definite matrix gives rise to the matrix norm . The dual norm of a matrix norm is .
The generalized Cauchy-Schwarz theorem asserts and in particular for matrix norms, (see exercises).
In our derivations, we usually consider matrix norms with respect to , the Hessian of the regularization function , as well as the inverse Hessian denoted . In such cases, we use the notation
A crucial quantity in the analysis of OCO algorithms that use regularization is the remainder term of the Taylor approximation of the regularization function, and especially the remainder term of the first order Taylor approximation. The difference between the value of the regularization function at and the value of the first order Taylor approximation is known as the Bregman divergence, given by
Denote by the Bregman divergence with respect to the function , defined as
For twice differentiable functions, Taylor expansion and the mean-value theorem assert that the Bregman divergence is equal to the second derivative at an intermediate point, i.e., (see exercises)
for some point , meaning there exists some such that . Therefore, the Bregman divergence defines a local norm, which has a dual norm. We shall denote this dual norm by
In online convex optimization, we commonly refer to the Bregman divergence between two consecutive decision points and . In such cases, we shorthand notation for the norm defined by the Bregman divergence with respect to on the intermediate point in as . The latter norm is called the local norm at iteration . With this notation, we have .
Finally, we consider below generalized projections that use the Bregman divergence as a distance instead of a norm. Formally, the projection of a point according to the Bregman divergence with respect to function is given by
2 The RFTL Algorithm and its Analysis
Recall the caveat with straightforward use of follow-the-leader: as in the bad example we have considered, the predictions of FTL may vary wildly from one iteration to the next. This motivates the modification of the basic FTL strategy in order to stabilize the prediction. By adding a regularization term, we obtain the RFTL (Regularized Follow the Leader) algorithm.
We proceed to formally describe the RFTL algorithmic template and analyze it. The analysis gives asymptotically optimal regret bounds. However, we do not optimize the constants in the regret bounds in order to improve clarity of presentation.
Throughout this chapter, recall the notation of to denote the gradient of the current cost function at the current point, i.e.,
In the OCO setting, the regret of convex cost functions can be bounded by a linear function via the inequality . Thus, the overall regret (recall definition (1.1)) of an OCO algorithm can be bounded by
The generic RFTL meta-algorithm is defined in Algorithm 13. The regularization function is assumed to be strongly convex, smooth, and twice differentiable.
2.2 The regret bound
The RFTL Algorithm 13 attains for every the following bound on the regret:
If an upper bound on the local norms is known, i.e., for all times , then we can further optimize over the choice of to obtain
To prove Theorem 5.2, we first relate the regret to the “stability” in prediction. This is formally captured by the following lemma10Historically, this lemma is known as the “FTL-BTL,” which stands for follow-the-leader vs. be-the-leader. BTL is a hypothetical algorithm that predicts at iteration , where is the prediction made by FTL. These terms were coined by Kalai and Vempala (Kalai and Vempala, 2005)..
Algorithm 13 guarantees the following regret bound
For convenience of the derivations, define the functions
By equation (5.1), it suffices to bound . As a first step, we prove the following inequality:
by induction on : Induction base: By definition, we have that , and thus for all . Induction step: Assume that for , we have
and let us prove the statement for . Since we have:
Where in the third line we used the induction hypothesis for . ∎
Recall that is a convex function and is a convex set. Denote:
By the Taylor expansion (with its explicit remainder term via the mean-value theorem) at , and by the definition of the Bregman divergence,
The inequality holds since is a minimum of over , as in Theorem 2.2. The last equality holds since the component is linear and thus does not affect the Bregman divergence. Thus,
To proceed, recall the shorthand for the norm induced by the Bregman divergence with respect to on point as . Similarly for the dual local norm . With this notation, we have . By the generalized Cauchy-Schwarz inequality,
Combining this inequality with Lemma 5.3 we obtain the theorem statement. ∎
3 Online Mirror Descent
In the convex optimization literature, “Mirror Descent” refers to a general class of first order methods generalizing gradient descent. Online Mirror descent (OMD) is the online counterpart of this class of methods. This relationship is analogous to the relationship of online gradient descent to traditional (offline) gradient descent.
For the RFTL algorithm the intuition was straightforward—the regularization was used to ensure stability of the decision. For OMD, regularization has an additional purpose: regularization transforms the space in which gradient updates are performed. This transformation enables better bounds in terms of the geometry of the space.
The OMD algorithm comes in two flavors: an agile and a lazy version. The lazy version keeps track of a point in Euclidean space and projects onto the convex decision set only at decision time. In contrast, the agile version maintains a feasible point at all times, much like OGD.
Both versions can be analyzed to give roughly the same regret bounds as the RFTL algorithm. In light of what we will see next, this is not surprising: for linear cost functions, the RFTL and lazy-OMD algorithms are equivalent!
Thus, we get regret bounds for free for the lazy version. The agile version can be shown to attain similar regret bounds, and is in fact superior in certain settings that require adaptivity. This issue is further explored in chapter 10. The analysis of the agile version is of independent interest and we give it below.
The OMD (lazy version) and RFTL are identical for linear cost functions, as we show next.
Let be linear cost functions. The lazy OMD and RFTL algorithms produce identical predictions, i.e.,
First, observe that the unconstrained minimum
By definition, also satisfies the above equation, but since is strictly convex, there is only one solution for the above equation and thus . Hence,
Since and are independent of , it follows that is minimized at the point that minimizes over which, in turn, implies that
3.2 Regret bounds for Mirror Descent
In this subsection we prove regret bounds for the agile version of the RFTL algorithm. The analysis is quite different than the one for the lazy version, and of independent interest.
The OMD Algorithm 14 attains for every the following bound on the regret:
If an upper bound on the local norms is known, i.e., for all times , then we can further optimize over the choice of to obtain
Since the functions are convex, for any ,
The following property of Bregman divergences follows from the definition: for any vectors ,
where the last inequality follows from the generalized Pythagorean theorem, as is the projection w.r.t the Bregman divergence of and is in the convex set. Summing over all iterations,
We proceed to bound . By definition of Bregman divergence, and the generalized Cauchy-Schwartz inequality,
where in the last inequality follows from . Thus, we have
Plugging back into Equation (5.3), and by non-negativity of the Bregman divergence, we get
by taking
4 Application and Special Cases
In this section we illustrate the generality of the regularization technique: we show how to derive the two most important and famous online algorithms—the online gradient descent algorithm and the online exponentiated gradient (based on the multiplicative update method)—from the RFTL meta-algorithm.
Other important special cases of the RFTL meta-algorithm are derived with matrix-norm regularization—namely, the von Neumann entropy function, and the log-determinant function, as well as self-concordant barrier regularization—which we shall explore in detail in the next chapter.
To derive the online gradient descent algorithm, we take for an arbitrary . Projection with respect to this divergence is the standard Euclidean projection (see exercises), and in addition, . Hence, the update rule for the OMD Algorithm 14 becomes:
The latter algorithm is exactly online gradient descent, as described in Algorithm 8 in chapter 3. However, both variants behave very differently, as explored in chapter 10 (see also exercises).
Theorem 5.2 gives us the following bound on the regret (where are the diameter and local norm defined with respect to the regularizer as defined in the beginning of this chapter, and is the Euclidean diameter as defined in chapter 2)
where the second inequality follows since for , the local norm reduces to the Euclidean norm.
4.2 Deriving multiplicative updates
Let be the negative entropy function, where is to be interpreted element-wise. Then , and hence the update rules for the OMD algorithm become:
which is exactly the Hedge algorithm from the first chapter!
Theorem 5.6 gives us the following bound on the regret:
If the costs per individual expert are in the range $$, it can be shown that
In addition, when is the negative entropy function, the diameter over the simplex can be shown to be bounded by (see exercises), giving rise to the bound
For an arbitrary range of costs, we obtain the exponentiated gradient algorithm described in Algorithm 15.
The regret achieved by the exponentiated gradient algorithm can be bounded using the following corollary of Theorem 5.2:
The exponentiated gradient algorithm with gradients bounded by and parameter has regret bounded by
5 Randomized Regularization
The connection between stability in decision making and low regret has motivated our discussion of regularization thus far. However, this stability need not be achieved only using strongly convex regularization functions. An alternative method to achieve stability in decisions is by introducing randomization into the algorithm. In fact, historically, this method preceded methods based on strongly convex regularization (see bibliography).
In this section we first describe a deterministic algorithm for online convex optimization that is easily amenable to speedup via randomization. We then give an efficient randomized algorithm for the special case of OCO with linear losses.
For simplicity, we consider ourselves in this section with a slightly restricted version of OCO. So far, we have not restricted the cost functions in any way, and they could depend on the choice of decision by the online learner. However, when dealing with randomized algorithms, this issue becomes a bit more subtle: can the cost functions depend on the randomness of the decision making algorithm itself? Furthermore, when analyzing the regret, which is now a random variable, dependencies across different iterations require probabilistic machinery which adds little to the fundamental understanding of randomized OCO algorithms. To avoid these complications, we make the following assumption throughout this section: the cost functions are adversarially chosen ahead of time, and do not depend on the actual decisions of the online learner. This version of OCO is called the oblivious setting, to distinguish it from the adaptive setting.
5.1 Perturbation for convex losses
The prediction in Algorithm 16 is according to a version of the follow-the-leader algorithm, augmented with an additional component of randomization. It is a deterministic algorithm that computes the expected decision according to a random variable. The random variable is the minimizer over the decision set according to the sum of gradients of the cost functions and an additional random vector.
In practice, the expectation need not be computed exactly. Estimation (via random sampling) up to a precision that depends linearly on the number of iterations would suffice.
The first parameter, , is related to the variance of , while the second, , is a measure of the sensitivity of the distribution11In harmonic analysis of Boolean functions, a similar quantity is called “average sensitivity”.. For example, if is the uniform distribution over the hypercube , then it holds that (see exercises) for the Euclidean norm
Reusing notation from previous chapters, denote by the diameter of the set according to the norm , and by the diameter according to its dual norm. Similarly, denote by and an upper bound on the norm (and dual norm) of the gradients.
Let the distribution be -stable with respect to norm . The FPL algorithm attains the following bound on the regret:
We can further optimize over the choice of to obtain
Define the random variable , and the random function as
It follows from Lemma 5.4 applied to the functions that
We now argue that . Let
Notice that may depend on each other. However, by linearity of expectation, we have that
Substituting this bound back into (5.5) we have
For the choice of as the uniform distribution over the unit hypercube , which has parameters and for the Euclidean norm, the optimal choice of gives a regret bound of . This is a factor worse than the online gradient descent regret bound of Theorem 3.1. For certain decision sets a better choice of distribution results in near-optimal regret bounds.
5.2 Perturbation for linear cost functions
The case of linear cost functions is of particular interest in the context of randomized regularization. Denote
By linearity of expectation, we have that
Thus, instead of computing precisely, we can sample a single vector , and use it to compute , as illustrated in Algorithm 17.
By the above arguments, we have that the expected regret for the random variables is the same as that for . We obtain the following Corollary:
The main advantage of this algorithm is computational: with a single linear optimization step over the decision set (which does not even have to be convex!), we attain near optimal expected regret bounds.
5.3 Follow-the-perturbed-leader for expert advice
An interesting special case (and in fact the first use of perturbation in decision making) is that of non-negative linear cost functions over the unit -dimensional simplex with costs bounded by one, or the problem of prediction of expert advice we have considered in chapter 1.
Algorithm 17 applied to the probability simplex and with exponentially distributed noise is known as the follow-the-perturbed-leader for prediction from expert advice method. We spell it out in Algorithm 18.
Notice that we take the perturbation to be distributed according to the one-sided negative exponential distribution, i.e., , or more precisely
Corollary 5.9 gives regret bounds that are suboptimal for this special case, thus we give here an alternative analysis that gives tight bounds up to constants amounting to the following theorem.
Algorithm 18 outputs a sequence of predictions such that:
Notice that as a special case of the above theorem, choosing yields a regret bound of
which is equivalent up to constant factors to the guarantee given for the Hedge algorithm in Theorem 1.5.
We start with the same analysis technique throughout this chapter: let . It follows from Lemma 5.4 applied to the functions that
where the second inequality follows by the generalized Cauchy-Schwarz inequality, and the last inequality follows since (see exercises)
Above we have that by assumption that the losses are bounded by one.
To bound the latter, notice that the probability is the leader at time is the probability that for some value that depends on the entire loss sequence till now. On the other hand, given , we have that remains the leader if , since it was a leader by a margin of more than the cost it will suffer. Thus,
Substituting this bound back into (5.5.3) we have
6 * Adaptive Gradient Descent
Thus far we have introduced regularization as a general methodology for deriving online convex optimization algorithms. The main theorem of this chapter, Theorem 5.2, bounds the regret of the RFTL algorithm for any strongly convex regularizer as
In addition, we have seen how to derive the online gradient descent and the multiplicative weights algorithms as special cases of the RFTL methodology. But are there other special cases of interest, besides these two basic algorithms, that warrant such general and abstract treatment?
There are surprisingly few cases of interest besides the Euclidean and Entropic regularizations and their matrix analogues12One such example is the self-concordant barrier regularization which we shall explore in the next chapter.. However, in this chapter we will give some justification of the abstract treatment of regularization.
Our treatment is motivated by the following question: thus far we have thought of as a strongly convex function. But which strongly convex function should we choose to minimize regret? This is a deep and difficult question which has been considered in the optimization literature since its early developments. Naturally, the optimal regularization should depend on both the convex underlying decision set, as well as the actual cost functions (see exercises for a natural candidate of a regularization function that depends on the convex decision set).
We shall treat this question no differently than we treat other optimization problems throughout this manuscript itself: we’ll learn the optimal regularization online! That is, a regularizer that adapts to the sequence of cost functions and is in a sense the “optimal” regularization to use in hindsight. This gives rise to the AdaGrad (Adaptive subGradient method) algorithm 19, which explicitely optimizes over the regularization choice in line (5) to minimize the gradient norms, which is the dominant expression in (5.7).
AdaGrad comes in two versions: diagonal and full matrix, the first being particularly efficient to implement with negligible computational overhead over online gradient descent. In the algorithm definition and throughout this chapter, the notation refers to the Moore-Penrose pseudoinverse of the matrix .
The computation in line (5) finds the regularization matrix which minimizes the norm of the gradients from within the positive semi-definite cone, with or without a diagonal constraint. This is closely related, as we shall see, to optimization w.r.t. two natural sets of matrices:
.
This results in a regularization matrix that is provably optimal in the following sense,
For with the corresponding ,
Using this lemma, we show the regret of AdaGrad is at most a constant factor larger than the minimum regret of all RFTL algorithm with regularization functions whose Hessian is fixed and belongs to the class . Furthermore, the regret of the diagonal version can be a factor smaller than that of online gradient descent for certain gradient geometries. The regret bound on AdaGrad is formally stated in the following theorem.
Let be defined by Algorithm 19 with parameters (full matrix) or (diagonal). Then for any ,
Before proceeding to the analysis, we consider when the regret bounds for AdaGrad improve upon those of Online Gradient Descent. One such case is when is the unit cube in -dimensional Euclidean space. This convex set has and . Lemma 5.11 and Theorems 5.12,5.2 imply that the regret of diagonal AdaGrad and OGD are bounded by
The relationship between the two terms depends on the matrix . If this matrix is sparse, then AdaGrad has a superior bound by at most factor. For other convex bodies, such as the Euclidean ball, and when the matrix is dense, the regret of OGD can be a factor lower.
We proceed with the proof of Theorem 5.12. The first component is the following Lemma, which generalizes the RFTL analysis to changing regularization.
Let ,
Multiplying the transpose of the first equation by the second we get
Since is the projection of in the norm induced by , we have (see §2.1.1)
This inequality is the reason for using generalized projections as opposed to standard projections, which were used in the analysis of online gradient descent (see §3.1 Equation (3.2)). This fact together with (5.8) gives
Now, summing up over to we get that
In the last inequality we use the definition . We proceed to bound the first term. To this end, define the functions
By definition, is the minimizer of over . Therefore, using the BTL Lemma 5.4, we have that
We can now continue with the proof of Theorem 5.12.
We bound both parts of Lemma 5.13, with the following two lemmas,
For both the diagonal and full matrix versions of AdaGrad, the following holds
Now combining Lemma 5.13 with the above two lemmas, and using or appropriately, we obtain the theorem. ∎
We proceed to complete the proof of the two lemmas above.
The optimization problem of choosing in line (5) of Algorithm 19 has an explicit solution, given in the following proposition (whose proof is left as an exercise).
Consider the following optimization problems, for :
Then the global optimizer to these problems is obtained at and respectively. Over the set of diagonal matrices, the global optimizer is obtained at and respectively.
A direct corollary of this proposition gives Lemma 5.11 as follows:
The remaining term from Lemma 5.13 is the expression , which we proceed to bound.
By definition , and hence using proposition 5.16 and the definition of in line (5), we have that . Since for a diagonal matrix it holds that , we have
Next, we consider the full matrix case. By definition , and hence . Thus,
7 Bibliographic Remarks
Regularization in the context of online learning was first studied in (Grove et al., 2001) and (Kivinen and Warmuth, 2001). The influential paper of Kalai and Vempala (2005) coined the term “follow-the-leader” and introduced many of the techniques that followed in OCO. The latter paper studies random perturbation as a regularization and analyzes the follow-the-perturbed-leader algorithm, following an early development by Hannan (1957) that was overlooked in learning for many years.
In the context of OCO, the term follow-the-regularized-leader was coined in (Shalev-Shwartz and Singer, 2007; Shalev-Shwartz, 2007), and at roughly the same time an essentially identical algorithm was called “RFTL” in (Abernethy et al., 2008). The equivalence of RFTL and Online Mirror Descent was observed by (Hazan and Kale, 2008). The AdaGrad algorithm was introduced in (Duchi et al., 2010, 2011), its diagonal version was also discovered in parallel in (McMahan and Streeter, 2010). The analysis of AdaGrad presented in this chapter is due to (Gupta et al., 2017).
Adaptive regularization has received significant attention due to its success in training deep neural networks, and notably the development of adaptive algorithms that incorporate momentum and other heuristics, most popular of which are AdaGrad, RMSprop (Tieleman and Hinton, 2012) and Adam (Kingma and Ba, 2014). For a survey of optimization for deep learning, see the comprehensive text of Goodfellow et al. (2016).
There is a strong connection between randomized perturbation and deterministic regularization. For some special cases, adding randomization can be thought of as a special case of deterministic strongly convex regularization, see (Abernethy et al., 2014, 2016).
8 Exercises
1. This exercise concerns the notion of a dual norm.
(a) Show that the dual norm to a matrix norm given by corresponds to the matrix norm of .
(b) Prove the generalized Cauchy-Schwarz inequality for any norm, i.e.,
2. Prove that the Bregman divergence is equal to the local norm at an intermediate point, that is:
where , and the interval is defined as
3. Let be the (shifted) Euclidean regularization function. Prove that the corresponding Bregman divergence is the Euclidean metric. Conclude that projections with respect to this divergence are standard Euclidean projections.
4. Prove that the agile and lazy versions of the OMD meta-algorithm are different, in the sense that they can produce different predictions over the same setting and cost functions. Show this for the case that the regularization is Euclidean and the decision set is the Euclidean ball.
6. Prove that for the uniform distribution over the unit hypercube , the parameters defined in §5.5 with respect to the Euclidean norm can be bounded as .
7. Let be a one-sided multi-dimensional exponential distribution, such that a vector is distributed over each coordinate exponentially:
(Hint: use the Chernoff bound) Extra credit: prove that where is the -th harmonic number.
Prove that is a norm if and only if is convex.
9. ∗∗ Prove a lower bound of on the regret of the RFTL algorithm with as a regularizer.
10. ∗ Prove that for positive definite matrices it holds that
(b)
11. ∗ Consider the following minimization problem where :
Prove that its minimizer is given by , and the minimum is obtained at .
Chapter 6 Bandit Convex Optimization
In many real-world scenarios the feedback available to the decision maker is noisy, partial or incomplete. Such is the case in online routing in data networks, in which an online decision maker iteratively chooses a path through a known network, and her loss is measured by the length (in time) of the path chosen. In data networks, the decision maker can measure the RTD (round trip delay) of a packet through the network, but rarely has access to the congestion pattern of the entire network.
Another useful example is that of online ad placement in web search. The decision maker iteratively chooses an ordered set of ads from an existing pool. Her reward is measured by the viewer’s response—if the user clicks a certain ad, a reward is generated according to the weight assigned to the particular ad. In this scenario, the search engine can inspect which ads were clicked through, but cannot know whether different ads, had they been chosen to be displayed, would have been clicked through or not.
The examples above can readily be modeled in the OCO framework, with the underlying sets being the convex hull of decisions. The pitfall of the general OCO model is the feedback; it is unrealistic to expect that the decision maker has access to a gradient oracle at any point in the space for every iteration of the game.
The Bandit Convex Optimization (short: BCO) model is identical to the general OCO model we have explored in previous chapters with the only difference being the feedback available to the decision maker.
As before, let denote the total number of game iterations (i.e., predictions and their incurred loss). Let be an algorithm for BCO, which maps a certain game history to a decision in the decision set. We formally define the regret of that predicted to be
2 The Multiarmed Bandit (MAB) Problem
A classical model for decision making under uncertainty is the multiarmed bandit (MAB) model. The term MAB nowadays refers to a multitude of different variants and sub-scenarios that are too large to survey. This section addresses perhaps the simplest variant—the non-stochastic MAB problem—which is defined as follows:
Iteratively, a decision maker chooses between different actions , while, at the same time, an adversary assigns each action a loss in the range $i_{t}$ and observes this loss, and nothing else. The goal of the decision maker is to minimize her regret.
The reader undoubtedly observes this setting is identical to the setting of prediction from expert advice, the only difference being the feedback available to the decision maker: whereas in the expert setting the decision maker can observe the rewards or losses for all experts in retrospect, in the MAB setting, only the losses of the decisions actually chosen are known.
It is instructive to explicitly model this problem as a special case of BCO. Take the decision set to be the set of all distributions over actions, i.e., is the -dimensional simplex. The loss function is taken to be the linearization of the costs of the individual actions, that is:
The MAB problem exhibits an exploration-exploitation tradeoff: an efficient (low regret) algorithm has to explore the value of the different actions in order to make the best decision. On the other hand, having gained sufficient information about the environment, a reasonable algorithm needs to exploit this action by picking the best action.
The simplest way to attain a MAB algorithm would be to separate exploration and exploitation. Such a method would proceed by
With some probability, explore the action space (i.e., by choosing an action uniformly at random). Use the feedback to construct an estimate of the actions’ losses.
Otherwise, use the estimates to apply a full-information experts algorithm as if the estimates are the true historical costs.
This simple scheme already gives a sublinear regret algorithm, presented in algorithm 20.
Algorithm 20, with being the the online gradient descent algorithm, guarantees the following regret bound:
Therefore the regret of the simple algorithm can be related to that of on the estimated functions.
On the other hand, the simple MAB algorithm does not always play according to the distribution generated by : with probability it plays uniformly at random, which may lead to a regret of one on these exploration iterations. Let be those iterations in which . This is captured by the following lemma:
The simple algorithm of the previous section can be improved by combining the exploration and exploitation steps. This gives a near-optimal regret algorithm, called EXP3, presented below.
Ultimately, the EXP3 algorithm attains a worst case regret bound of , which is nearly optimal (up to a logarithmic term in the number of actions).
Algorithm 21 with non-negative losses and guarantees the following regret bound:
We proceed to derive an algorithm for the more general setting of bandit convex optimization that attains near-optimal regret.
3 A Reduction from Limited Information to Full Information
In this section we derive a low regret algorithm for the general setting of bandit convex optimization. In fact, we shall describe a general technique for designing bandit algorithms, which is composed of two parts:
A general technique for taking an online convex optimization algorithm that uses only the gradients of the cost functions (formally defined below), and applying it to a family of vector random variables with carefully chosen properties.
Designing the random variables that allow the template reduction to produce meaningful regret guarantees.
We proceed to describe the two parts of this reduction, and in the remainder of this chapter we describe two examples of using this reduction to design bandit convex optimization algorithms.
The key idea behind many of the efficient algorithms for bandit convex optimization is the following: although we cannot calculate explicitly, it is possible to find an observable random variable that satisfies . Thus, can be seen as an estimator of the gradient. By substituting for in an OCO algorithm, we will show that many times it retains its sublinear regret bound.
Formally, the family of regret minimization algorithms for which this reduction works is captured in the following definition.
(first order OCO Algorithm) Let be an OCO (deterministic) algorithm receiving an arbitrary sequence of differential loss functions , and producing decisions . is called a first order online algorithm if the following holds:
Let be the linear function , then for every iteration :
We can now consider a formal reduction from any first order online algorithm to a bandit convex optimization algorithm as follows.
Perhaps surprisingly, under very mild conditions the reduction above guarantees the same regret bounds as the original first order algorithm up to the magnitude of the estimated gradients. This is captured in the following lemma.
Then the following holds for all :
Therefore, deterministically applying a first order method on the random functions is equivalent to applying on a stochastic first order approximation of the deterministic functions . Thus by the full-information regret bound of we have:
where we used . Similarly, since is fixed we have that . The lemma follows from taking the expectation of Equation (6.2). ∎
3.2 Part 2: point-wise gradient estimators
In the preceding part we have described how to convert a first order algorithm for OCO to one that uses bandit information, using specially tailored random variables. We now describe how to create these vector random variables.
Although we cannot calculate explicitly, it is possible to find an observable random variable that satisfies , and serves as an estimator of the gradient.
The question is how to find an appropriate , and in order to answer it we begin with an example in a 1-dimensional case.
A 1-dimensional gradient estimate Recall the definition of the derivative:
The above shows that for a 1-dimensional derivative, two evaluations of are required. Since in our problem we can perform only one evaluation, let us define as follows:
Thus, in expectation, for small , approximates .
We define to be a -smoothed version of :
where is drawn from a uniform distribution over the unit ball. This construction is very similar to the one used in Lemma 2.8 in context of convergence analysis for convex optimization. However, our goal here is very different.
Note that when is linear, we have . We shall address the case in which is indeed linear as a special case, and show how to estimate the gradient of , which, under the assumption, is also the gradient of . The following lemma shows a simple relation between the gradient and a uniformly drawn unit vector.
Using Stokes’ theorem from calculus, we have
From (6.4), and by definition of expectation, we have
where is the volume of an n-dimensional ball of radius . Similarly,
Combining (6.4), (6.5), (6.6), and (6.7), and the fact that the ratio of the volume of a ball in dimensions and the sphere of dimension is gives the desired result. ∎
Under the assumption that is linear, Lemma 6.7 suggests a simple estimator for the gradient . Draw a random unit vector , and let .
The sphere estimator above is at times difficult to use: when the center of the sphere is very close to the boundary of the decision set only a very small sphere can fit completely inside. This results in a gradient estimator with large variance.
In such cases, it is useful to consider ellipsoids rather than spheres. Luckily, the generalisation to ellipsoidal sampling for gradient estimation is a simple corollary of our derivation above:
4 Online Gradient Descent without a Gradient
The simplest and historically earliest application of the BCO-to-OCO reduction outlined before is the application of the online gradient descent algorithm to the bandit setting. The FKM algorithm (named after its inventors, see bibliographic section) is outlined in algorithm 23.
For simplicity, we assume that the set contains the unit ball centered at the zero vector, denoted . Denote . It is left as an exercise to show that is convex for any and that all balls of radius around points in are contained in .
We also assume for simplicity that the adversarially chosen cost functions are bounded by one over , i.e., that for all .
The FKM algorithm is an instantiation of the generic reduction from bandit convex optimization to online convex optimization with spherical gradient estimators over the set . It iteratively projects onto , in order to have enough space for spherical gradient estimation. This degrades its performance by a controlled quantity. Its regret is bounded as follows.
Algorithm 23 with parameters guarantees the following expected regret bound
Recall our notation of . Denote
Then by properties of projections we have , where is the diameter of . Thus, assuming that the cost functions are -Lipschitz, we have
5 * Optimal Regret Algorithms for Bandit Linear Optimization
A special case of BCO that is of considerable interest is BLO—Bandit Linear Optimization. This setting has linear cost functions, and captures the network routing and ad placement examples discussed in the beginning of this chapter, as well as the non-stochastic MAB problem.
In this section we give near-optimal regret bounds for BLO using techniques from interior point methods for convex optimization.
The generic OGD method of the previous section suffers from three pitfalls:
The gradient estimators are biased, and estimate the gradient of a smoothed version of the real cost function.
The gradient estimators require enough “wiggle room” and are thus ill-defined on the boundary of the decision set.
The gradient estimates have potentially large magnitude, proportional to the distance from the boundary.
Fortunately, the first issue is non-existent for linear functions - the gradient estimators turn out to be unbiased for linear functions. In the notation of the previous chapters, we have for linear functions:
Thus, Lemma 6.7 gives us a stronger guarantee:
To resolve the second and third issues we use self-concordant barrier functions, a rather advanced technique from interior point methods for convex optimization.
Self-concordant barrier functions were devised in the context of interior point methods for optimization as a way of ensuring that the Newton method converges in polynomial time over bounded convex sets. In this brief introduction we survey some of their beautiful properties that will allow us to derive an optimal regret algorithm for BLO.
is three times continuously differentiable and convex, and approaches infinity along any sequence of points approaching the boundary of .
where the third order differential is defined as:
We assume that always has full rank. In BCO applications this is easy to ensure by adding a fictitious quadratic function to the barrier, which does not affect the overall regret by more than a constant.
Let be a self-concordant barrier and . The Dikin ellipsoid is
i.e., the -unit ball centered around , is completely contained in .
In our next analysis we will need to bound for , for which the following lemma is useful:
Let be a -self concordant function over , then for all :
where
The function is called the Minkowski function for , and its output is always in the interval $y\mathcal{K}\pi_{\mathbf{x}}(\mathbf{y})\to 1$.
Another important property of self-concordant functions is the relationship between a point and the optimum, and the norm of the gradient at the point, according to the local norm, as given by the following lemma.
Let be such that , and let . Then
5.2 A near-optimal algorithm
We have now set up all the necessary tools to derive a near-optimal BLO algorithm, presented in algorithm 24.
For appropriate choice of , the SCRIBLE algorithm guarantees
First, we note that never steps outside of the decision set. The reason is that and lies in the Dikin ellipsoid centered at .
where the latter equality follows since is linear, and thus its smoothed version is identical to itself.
A final observation is that line 6 in the algorithm is an invocation of the RFTL algorithm with the self-concordant barrier serving as a regularisation function. The RFTL algorithm for linear functions is a first order OCO algorithm and thus Lemma 6.5 applies.
Here we use our notation from the previous chapter for the local norm .
To bound the last expression, we use Lemma 6.12, and the definition of where is a self-concordant barrier. Thus,
since by definition of . Recall that to use Lemma 6.12, we need , which is true by choice of and since
It remains to bound the Bregman divergence with respect to , for which we use a similar technique as in the analysis of algorithm 23, and bound the regret with respect to , which is the projection of onto . Using equation (6.8), we can bound the overall regret by:
Taking and , the above bound implies our theorem.
6 Bibliographic Remarks
The Multi-Armed Bandit problem has history going back more than fifty years to the work of Robbins (1952), see the survey of Bubeck and Cesa-Bianchi (2012) for a much more detailed history. The non-stochastic MAB problem and the EXP3 algorithm, as well as tight lower bounds were given in the seminal paper of Auer et al. (2003). The logarithmic gap in attainable regret for non-stochastic MAB was resolved in (Audibert and Bubeck, 2009).
Bandit Convex Optimization for the special case of linear cost functions and the flow polytope, was introduced and studied by Awerbuch and Kleinberg (2008) in the context of online routing. The full generality BCO setting was introduced by Flaxman et al. (2005), who gave the first efficient and low-regret algorithm for BCO. Tight bounds for BCO were obtained by Bubeck et al. (2015) for the one dimensional case, via an inefficient algorithm by Hazan and Li (2016), and finally with a polynomial time algorithm in Bubeck et al. (2017).
The special case in which the cost functions are linear, called Bandit Linear Optimization, received significant attention. Dani et al. (2008) gave an optimal regret algorithm up to constants depending on the dimension. Abernethy et al. (2008) gave an efficient algorithm and introduced self-concordant barriers to the bandit setting. Self-concordant barrier functions were devised in the context of polynomial-time algorithms for convex optimization in the seminal work of Nesterov and Nemirovskii (1994). Lower bounds for regret in the bandit linear optimization setting were studied by Shamir (2015).
In this chapter we have considered the expected regret as a performance metric. Significant literature is devoted to high probability guarantees on the regret. High probability bounds for the MAB problem were given in (Auer et al., 2003), and for bandit linear optimization in (Abernethy and Rakhlin, 2009). Other more refined metrics have been recently explored in (Dekel et al., 2012) and in the context of adaptive adversaries in (Neu et al., 2014; Yu and Mannor, 2009; Even-Dar et al., 2009; Mannor and Shimkin, 2003; Yu et al., 2009).
For a recent comprehensive text on bandit algorithms see (Lattimore and Szepesvári, 2020).
7 Exercises
1. Prove a lower bound on the regret of any algorithm for BCO: show that for the special case of BCO over the unit sphere, any online algorithm must incur a regret of .
3. Let be convex. Show that the set is convex.
4. Let be convex and contain the unit ball centered at zero. Show that for any point , the ball of radius centered at is contained in .
6. Consider the BCO setting with the following twist: at every iteration, the player is allowed to observe two evaluations of the function, as opposed to just one. That is, the player gives , and observes . Regret is measured w.r.t. , as usual:
(a) Show how to construct a biased gradient estimator for with arbitrary small bias and constant variance, that is independent of the bias.
(b) Show how to use the gradient estimator from the previous part to give an efficient algorithm for this setting that attains regret.
Chapter 7 Projection-Free Algorithms
In many computational and learning scenarios the main bottleneck of optimization, both online and offline, is the computation of projections onto the underlying decision set (see §2.1.1). In this chapter we introduce projection-free methods for online convex optimization, that yield more efficient algorithms in these scenarios.
The motivating example throughout this chapter is the problem of matrix completion, which is a widely used and accepted model in the construction of recommendation systems. For matrix completion and related problems, projections amount to expensive linear algebraic operations and avoiding them is crucial in big data applications.
We start with a detour into classical offline convex optimization and describe the conditional gradient algorithm, also known as the Frank-Wolfe algorithm. Afterwards, we describe problems for which linear optimization can be carried out much more efficiently than projections. We conclude with an OCO algorithm that eschews projections in favor of linear optimization, in much the same flavor as its offline counterpart.
The vectors are called the left and right singular vectors respectively. The non-zero singular values are the square roots of the eigenvalues of the matrix (and ). The matrix can be written as
where , the matrix is an orthogonal basis of the left singular vectors of , the matrix is an orthogonal basis of right singular vectors, and is a diagonal matrix of singular values. This form is called the singular value decomposition for .
It can be shown (see exercises) that the nuclear norm is equal to the trace of the square root of the matrix times its transpose, i.e.,
2 Motivation: Recommender Systems
Media recommendations have changed significantly with the advent of the Internet and rise of online media stores. The large amounts of data collected allow for efficient clustering and accurate prediction of users’ preferences for a variety of media. A well-known example is the so called “Netflix challenge”—a competition of automated tools for recommendation from a large dataset of users’ motion picture preferences.
One of the most successful approaches for automated recommendation systems, as proven in the Netflix competition, is matrix completion. Perhaps the simplest version of the problem can be described as follows.
The entire dataset of user-media preference pairs is thought of as a partially-observed matrix. Thus, every person is represented by a row in the matrix, and every column represents a media item (movie). For simplicity, let us think of the observations as binary—a person either likes or dislikes a particular movie. Thus, we have a matrix where is the number of persons considered, is the number of movies at our library, and and signify “dislike”, “like” and “unknown” respectively:
The natural goal is to complete the matrix, i.e., correctly assign or to the unknown entries. As defined so far, the problem is ill-posed, since any completion would be equally good (or bad), and no restrictions have been placed on the completions.
The intuitive interpretation of this property is that each entry in can be explained by only numbers. In matrix completion this means, intuitively, that there are only factors that determine a persons preference over movies, such as genre, director, actors and so on.
Now the simplistic matrix completion problem can be well-formulated as in the following mathematical program. Denote by the Euclidean norm only on the observed (non starred) entries of , i.e.,
The mathematical program for matrix completion is given by
Since the constraint over the rank of a matrix is non-convex, it is standard to consider a relaxation that replaces the rank constraint by the nuclear norm. It is known that the nuclear norm is a lower bound on the matrix rank if the singular values are bounded by one (see exercises). Thus, we arrive at the following convex program for matrix completion:
We consider algorithms to solve this convex optimization problem next.
3 The Conditional Gradient Method
In this section we return to the basics of convex optimization—minimization of a convex function over a convex domain as studied in chapter 2.
Note that in the CG method, the update to the iterate may be not be in the direction of the gradient, as is the result of a linear optimization procedure in the direction of the negative gradient. This is depicted in figure 7.1.
The following theorem gives an essentially tight performance guarantee of this algorithm over smooth functions. Recall our notation from chapter 2: denotes the global minimizer of over , denotes the diameter of the set , and denotes the suboptimality of the objective value in iteration .
The CG algorithm applied to -smooth functions with step sizes attains the following convergence guarantee
As done before in this manuscript, we denote . For any set of step sizes, we have
We reached the recursion , and by Lemma 7.2 we obtain,
Let be a sequence that satisfies the recurence
Then taking implies
As an example of an application for the conditional gradient algorithm, recall the mathematical program given by (7.1). The gradient of the objective function at point is
Over the set of bounded-nuclear norm matrices, the linear optimization of line 3 in algorithm 25 becomes,
For simplicity, let’s consider square symmetric matrices, for which the nuclear norm is equivalent to the trace norm, and the above optimization problem becomes
It can be shown that this program is equivalent to the following (see exercises):
Hence, this is an eigenvector computation in disguise! Computing the largest eigenvector of a matrix takes linear time via the power method, which also applies more generally to computing the largest singular value of rectangular matrices. With this, step 3 of algorithm 25, which amounts to mathematical program (7.1), becomes computing , the largest eigenvector of . Algorithm 25 takes on the modified form described in Algorithm 26.
How does this compare to previous convex optimization methods for solving the same matrix completion problem? As a convex program, we can apply gradient descent, or even more advantageously in this setting, stochastic gradient descent as in §3.4. Recall that the gradient of the objective function at point takes the simple form (7.3). A stochastic estimate for the gradient can be attained by observing just a single entry of the matrix , and the update itself takes constant time as the gradient estimator is sparse. However, the projection step is significantly more difficult.
In this setting, the convex set is the set of bounded nuclear norm matrices. Projecting a matrix onto this set amounts to calculating the SVD of the matrix, which is similar in computational complexity to algorithms for matrix diagonalization or inversion. The best known algorithms for matrix diagonalization are superlinear in the matrices’ size, and thus impractical for large datasets that are common in applications.
In contrast, the CG method does not require projections at all, and replaces them with linear optimization steps over the convex set, which we have observed to amount to singular vector computations. The latter can be implemented to take linear time via the power method or the Lanczos algorithm (see bibliography).
Thus, the Conditional Gradient method allows for optimization of the mathematical program (7.1) with a linear-time operation (eigenvector using power method) per iteration, rather than a significantly more expensive computation (SVD) needed for gradient descent.
4 Projections versus Linear Optimization
The conditional gradient (Frank-Wolfe) algorithm described before does not resort to projections, but rather computes a linear optimization problem of the form
When is the CG method computationally preferable? The overall computational complexity of an iterative optimization algorithm is the product of the number of iterations and the computational cost per iteration. The CG method does not converge as well as the most efficient gradient descent algorithms, meaning it requires more iterations to produce a solution of a comparable level of accuracy. However, for many interesting scenarios the computational cost of a linear optimization step (7.4) is significantly lower than that of a projection step.
Let us point out several examples of problems for which we have very efficient linear optimization algorithms, whereas our state-of-the-art algorithms for computing projections are significantly slower.
In the example pointed out in the preceding section of matrix completion, known methods for projection onto the spectahedron, or more generally the bounded nuclear-norm ball, require singular value decompositions, which take superlinear time via our best known methods. In contrast, the CG method requires maximal eigenvector computations which can be carried out in linear time via the power method (or the more sophisticated Lanczos algorithm).
Various routing and graph problems can be modeled as convex optimization problems over a convex set called the flow polytope.
Since the flow polytope is just the convex hull of – paths in the graph, minimizing a linear objective over it amounts to finding a minimum weight path given weights for the edges. For the shortest path problem we have very efficient combinatorial optimization algorithms, namely Dijkstra’s algorithm.
Thus, applying the CG algorithm to solve any convex optimization problem over the flow polytope will only require iterative shortest path computations.
A common way to represent a permutation or ordering is by a permutation matrix. Such are square matrices over that contain exactly one entry in each row and column.
Doubly-stochastic matrices are square, real-valued matrices with non-negative entries, in which the sum of entries of each row and each column amounts to 1. The polytope that defines all doubly-stochastic matrices is called the Birkhoff-von Neumann polytope. The Birkhoff-von Neumann theorem states that this polytope is the convex hull of exactly all permutation matrices.
Since a permutation matrix corresponds to a perfect matching in a fully connected bipartite graph, linear minimization over this polytope corresponds to finding a minimum weight perfect matching in a bipartite graph.
Consider a convex optimization problem over the Birkhoff-von Neumann polytope. The CG algorithm will iteratively solve a linear optimization problem over the BVN polytope, thus iteratively solving a minimum weight perfect matching in a bipartite graph problem, which is a well-studied combinatorial optimization problem for which we know of efficient algorithms. In contrast, other gradient based methods will require projections, which are quadratic optimization problems over the BVN polytope.
A matroid is pair where is a set of elements and is a set of subsets of called the independent sets which satisfy various interesting proprieties that resemble the concept of linear independence in vector spaces. Matroids have been studied extensively in combinatorial optimization and a key example of a matroid is the graphical matroid in which the set is the set of edges of a given graph and the set is the set of all subsets of which are cycle-free. In this case, contains all the spanning trees of the graph. A subset could be represented by its identifying vector which lies in which also gives rise to the matroid polytope which is just the convex hull of all identifying vectors of sets in . It can be shown that some matroid polytopes are defined by exponentially many linear inequalities (exponential in ), which makes optimization over them difficult.
On the other hand, linear optimization over matroid polytopes is easy using a simple greedy procedure which runs in nearly linear time. Thus, the CG method serves as an efficient algorithm to solve any convex optimization problem over matroids iteratively using only a simple greedy procedure.
5 The Online Conditional Gradient Algorithm
In this section we give a projection-free algorithm for OCO based on the conditional gradient method, which is projection-free and thus carries the computational advantages of the CG method to the online setting.
It is tempting to apply the CG method straightforwardly to the online appearance of functions in the OCO setting, such as the OGD algorithm in §3.1. However, it can be shown that an approach that only takes into account the last cost function is doomed to fail. The reason is that the conditional gradient method takes into account the direction of the gradient, and is insensitive to its magnitude.
Instead, we apply the CG algorithm step to the aggregate sum of all previous cost functions with added Euclidean regularization. The resulting algorithm is given formally in Algorithm 27.
We can prove the following regret bound for this algorithm. While this regret bound is suboptimal in light of the previous upper bounds we have seen, its suboptimality is compensated by the algorithm’s lower computational cost.
Online conditional gradient (Algorithm 27) with parameters , attains the following guarantee
As a first step in analyzing Algorithm 27, consider the points
These are exactly the iterates of the RFTL algorithm from chapter 5, namely Algorithm 13 with the regularization being , applied to cost functions with a shift, namely:
Using our previous notation, denote by , and by . The main lemma we require to proceed is the following, which relates the iterates to the optimal point according to the aggregate function .
The iterates of Algorithm 27 satisfy for all
As the functions are -smooth, applying the offline Frank-Wolfe analysis technique, and in particular Equation (7.3) to the function we obtain:
In addition, by definition of and we have
Since is -strongly convex, we have
Above we used the following derivation, that holds by choice of parameters and : since are all non-negative, we have
We now claim that the theorem follows inductively. The base of the induction holds since, for , the definition of implies
Assuming the bound is true for , we now show it holds for as well:
as required. The last inequality follows by the definition of (see exercises).
We proceed to use this lemma in order to prove our theorem:
By definition, the functions are -strongly convex. Thus, we have for :
Let , and notice that this satisfies the constraint of Lemma 7.4, which requires . In addition, for large enough. Hence,
6 Bibliographic Remarks
The matrix completion model has been extremely popular since its inception in the context of recommendation systems (Srebro, 2004; Rennie and Srebro, 2005; Salakhutdinov and Srebro, 2010; Lee et al., 2010; Candes and Recht, 2009; Shamir and Shalev-Shwartz, 2011).
The conditional gradient algorithm was devised in the seminal paper by Frank and Wolfe (1956). Due to the applicability of the FW algorithm to large-scale constrained problems, it has been a method of choice in recent machine learning applications, to name a few: (Hazan, 2008; Jaggi and Sulovský, 2010; Lacoste-Julien et al., 2013; Jaggi, 2013; Dudík et al., 2012; Harchaoui et al., 2012; Hazan and Kale, 2012; Shalev-Shwartz et al., 2011b; Bach et al., 2012; Tewari et al., 2011; Garber and Hazan, 2011, 2013; Bellet et al., 2014). In the context of matrix completion and recommendation systems, several faster variants of the Frank-Wolfe method were proposed (Garber, 2016; Allen-Zhu et al., 2017)
The online conditional gradient algorithm is due to Hazan and Kale (2012). An optimal regret algorithm, attaining the bound, for the special case of polyhedral sets was devised in (Garber and Hazan, 2013).
Recent works consider accelerating projection-free optimization using variance reduction (Lan and Zhou, 2016; Hazan and Luo, 2016), and the case of projection-free algorithms with stochastic gradient oracles (Mokhtari et al., 2018; Chen et al., 2018; Xie et al., 2019).
For an analysis of the running time of the power and Lanczos methods for computing eigenvectors see (Kuczyński and Woźniakowski, 1992). For modern algorithms for fast computation of the singular value decomposition see (Allen-Zhu and Li, 2016; Musco and Musco, 2015).
7 Exercises
1. Prove that if the singular values are smaller than or equal to one, then the nuclear norm is a lower bound on the rank, i.e., show
2. Prove that the trace is related to the nuclear norm via
3. In this question we show that maximizing a linear function over the spectahedron can be reduced to a maximal eigenvector computation.
Prove that it has the same solution as the mathematical program:
(b) Show how to use eigenvector computations to maximize a general (a-symmetric) linear functions over the spectahedron.
4. Prove that for positive integers , any and it holds that
5. Download the MovieLens dataset from the web. Implement an online recommendation system based on the matrix completion model: implement the OCG and OGD algorithms for matrix completion. Benchmark your results.
Chapter 8 Games, Duality, and Regret
In this chapter we tie the material covered thus far to some of the most intriguing concepts in optimization and game theory. We shall use the existence of online convex optimization algorithms with sublinear regret to prove two fundamental properties: convex duality in mathematical optimization, and von Neumann’s minimax theorem in game theory.
Historically, the theory of games was developed by von Neumann in the early 1930’s. In an entirely different scientific thread, the theory of linear programming (LP) was advanced by Dantzig a decade later. Dantzig describes in his memoir a notable meeting between himself and von Neumann at Princeton in 1947. In this meeting, according to Dantzig, after describing the geometric and algebraic versions of linear programming, von Neumann essentially formulated and proved linear programming duality:
“I don’t want you to think I am pulling all this out of my sleeve at the spur of the moment like a magician. I have just recently completed a book with Oscar Morgenstern on the theory of games. What I am doing is conjecturing that the two problems are equivalent. The theory that I am outlining for your problem is an analogue to the one we have developed for games.” 13Taken from (Gass, 2006)
At that time, the topic of discussion was not the existence and uniqueness of equilibrium in zero-sum games, which is captured by the minimax theorem. Both concepts were originally captured and proved using very different mathematical techniques: the minimax theorem was originally proved using machinery from mathematical topology, whereas linear programming duality was shown using convexity and geometric tools.
More than half a century later, Freund and Schapire tied both concepts, which were by then known to be strongly related, to regret minimization. We shall follow their lead in this chapter, introduce the relevant concepts and give concise proofs using the machinery developed earlier in this manuscript.
The chapter can be read with basic familiarity with linear programming and little or no background in game theory. We define linear programming and zero-sum games succinctly, barely enough to prove the duality theorem and the minimax theorem. The reader is referred to the numerous wonderful texts available on linear programming and game theory for a much more thorough introduction and definitions.
The above formulation can be transformed into several different forms via basic manipulations. For example, any LP can be transformed to an equivalent LP with the variables taking only non-negative values. This can be accomplished by writing every variable as , with . It can be verified that this transformation leaves us with another LP, whose variables are non-negative, and contains at most twice as many variables (see exercises section for more details).
We are now ready to define a central notion in LP and state the duality theorem:
and the objectives of both problems are either equal or unbounded.
Instead of studying duality directly, we proceed to define zero-sum games and an analogous concept to duality.
2 Zero-sum Games and Equilibria
The theory of games is an established research field in economic theory. We give here brief definitions of the main concepts studied in this chapter.
Let us start with an example of a zero-sum game we all know: the rock-paper-scissors game. In this game each of the two players chooses a strategy: either rock, scissors or paper. The winner is determined according to the following table, where denotes a draw, denotes that the row player wins, and denotes a column player victory.
The rock-paper-scissors game is called a “zero-sum” game since one can think of the numbers as losses for the row player (loss of resembles victory, loss and draw), in which case the column player receives a loss which is exactly the negation of the loss of the row player. Thus the sum of losses which both players suffer is zero in every outcome of the game.
Noticed that we termed one player as the “row player” and the other as the “column player” corresponding to the matrix losses. Such a matrix representation is far more general:
A two-player zero-sum-game in normal form is given by a matrix . The loss for the row player playing strategy is equal to the negative loss (reward) of the column player playing strategy and equal to .
The fact that the losses were defined in the range $$ is arbitrary, as the concept of main importance we define next is invariant to scaling and shifting by a constant.
A central concept in game theory is equilibrium. There are many different notions of equilibria. In two-player zero-sum games, a pure equilibrium is a pair of strategies with the following property: given that the column player plays , there is no strategy that dominates - i.e., every other strategy gives higher or equal loss to the row player. Equilibrium also requires that a symmetric property for strategy holds - it is not dominated by any other strategy given that the row player plays .
It can be shown that some games do not have a pure equilibrium as defined above, e.g., the rock-paper-scissors game. However, we can extend the notion of a strategy to a mixed strategy - a distribution over pure strategies. The loss of a mixed strategy is the expected loss according to the distribution over pure strategies. More formally, if the row player chooses and column player chooses then the expected loss of the row player (which is the negative reward to the column player) is given by:
We say that is dominant with respect to if and only if it is not dominated by any other mixed strategy. A pair is an equilibrium for game if and only if both and are dominant with respect to each other. It is a good exercise for the reader at this point to find an equilibrium for the rock-paper-scissors game.
At this point, some natural questions arise: Is there always an equilibrium in a given zero-sum game? Can it be computed efficiently? Are there natural repeated-game-playing strategies that reach it?
As we shall see, the answer to all questions above is affirmative. Let us rephrase these questions in a different way. Consider the optimal row strategy, i.e., a mixed strategy , such that the expected loss is minimized, no matter what the column player does. The optimal strategy for the row player would be:
Notice that we use the notation rather than , since in general the set of strategies attaining the minimal loss over worst-case column strategies can contain more than a single strategy. Similarly, the optimal strategy for the column player would be:
Playing these strategies, no matter what the column player does, the row player would pay no more than
With these definitions we can state von Neumann’s famous minimax theorem:
In any zero-sum game, it holds that .
This theorem answers all our above questions on the affirmative. The value is called the value of the game, and its existence and uniqueness imply that any and in the appropriate optimality sets are an equilibrium.
We proceed to give a constructive proof of von Neumann’s theorem which also yields an efficient algorithm as well as natural repeated-game playing strategies that converge to it.
The von Neumann theorem is equivalent to the duality theorem of linear programming in a very strong sense, and either implies the other via simple reduction. Thus, it suffices to prove only von Neumann’s theorem to prove the duality theorem.
The first part of this equivalence is shown by representing a zero-sum game as a primal-dual linear program instance, as we do now.
Observe that the definition of an optimal row strategy and value is equivalent to the following LP:
To see that the optimum of the above is attained at , note that the constraint is equivalent to the constraint , since:
The dual program to the above LP is given by
By similar arguments, the dual program precisely defines and . The duality theorem asserts that , which gives von Neumann’s theorem.
The other direction, i.e., showing that von Neumann’s theorem implies LP duality, is slightly more involved. Basically, one can convert any LP into the format of a zero-sum game. Special care is needed to ensure that the original LP is indeed feasible, as zero-sum games are always feasible and linear programs need not be. The details are left as an exercise at the end of this chapter.
3 Proof of von Neumann Theorem
In this section we give a proof of von Neumann’s theorem using online convex optimization algorithms with sublinear regret.
The first part of the theorem, which is also known as weak duality in the LP context, is rather straightforward:
Direction 1 ():
The second and main direction, known as strong duality in the LP context, requires the technology of online convex optimization we have proved thus far:
Direction 2 ():
We consider a repeated game defined by the matrix . For , the row player provides a mixed strategy , column player plays mixed strategy , and the loss of the row player, which equals to the reward of the column player, equals .
Spelling out the EG strategy for this particular instance, we have
Then, by appropriate choice of and Corollary 5.7, we have
The column player plays her best response to the row player’s strategy, that is:
Thus . As , we obtain part 2 of the theorem. ∎
Notice that besides the basic definitions, the only tool used in the proof is the existence of sublinear regret algorithms for online convex optimization. The fact that the regret bounds for OCO algorithms were defined without restricting the cost functions, and that they can be adversarially chosen, is crucial for the proof. The functions are defined according to , which is chosen based on . Thus, the cost functions we constructed are adversarially chosen after the decision was made by the row player.
4 Approximating Linear Programs
The technique in the preceding section not only proves the minimax theorem, and thus linear programming duality, but also entails an efficient algorithm. Using the equivalence of zero-sum games and linear programs, this efficient algorithm can be used to solve linear programming. We now spell out the details of this algorithm in the context of zero-sum games.
Almost immediately we obtain from the previous derivation the following:
The returned vector of Algorithm 28 is a -approximate solution to the zero-sum game and linear program it describes.
Following the exact same steps of the previous derivation, we have
Thus, to obtain an -approximate solution, one would need iterations, each involving a simple update procedure.
5 Bibliographic Remarks
Game theory was founded in the late 1920’s-early ’30s, whose cornerstone was laid in the classic text “Theory of Games and Economic Behavior” by Neumann and Morgenstern (1944).
Linear programming is a fundamental mathematical optimization and modeling tool, dating back to the 1940’s and the work of Kantorovich (1940) and Dantzig (1951). Duality for linear programming was conceived by von Neumann, as described by Dantzig in an interview (Albers et al., 1986). For in depth treatment of the theory of linear programming there are numerous comprehensive texts, e.g., (Bertsimas and Tsitsiklis, 1997; Matousek and Gärtner, 2007).
The beautiful connection between low-regret algorithms and solving zero-sum games was discovered by Freund and Schapire (1999). More general connections of convergence of low-regret algorithms to equilibria in games were studied by Hart and Mas-Colell (2000), and more recently in (Even-dar et al., 2009; Roughgarden, 2015).
Approximation algorithms that arise via simple Lagrangian relaxation techniques were pioneered by Plotkin et al. (1995). See also the survey (Arora et al., 2012) and more recent developments that give rise to sublinear time algorithms (Clarkson et al., 2012; Hazan et al., 2011).
6 Exercises
1. Prove that equilibrium strategy pairs in zero-sum games are not unique. That is, construct a zero-sum game for which there is more than one equilibrium.
3. Read Adler’s exposition on the equivalence of linear programming and zero sum games (Adler, 2013). Explain how to convert a linear program to a zero-sum game.
4. Consider a repeated zero-sum game over a matrix in which both players change their mixed strategies according to a low-regret algorithm over the linear cost/reward functions of the game. Prove that the average value of the game approaches that of an equilibrium of the game given by .
5. ∗ Write a semidefinite program as a zero-sum game. Write down an algorithm for approximating the solution of a semidefinite program using OCO algorithms, and sketch an analysis of its correctness and performance bound.
Chapter 9 Learning Theory, Generalization, and Online Convex Optimization
In our treatment of online convex optimization so far we have only implicitly discussed learning theory. The framework of OCO was shown to capture applications such as learning classifiers online, prediction with expert advice, online portfolio selection and matrix completion, all of which have a learning aspect. We have introduced the metric of regret and gave efficient algorithms to minimize regret in various settings. We have also argued that minimizing regret is a meaningful approach for many online prediction problems. However, the relation to other theories of learning was not discussed thus far.
In this section we draw a formal and strong connection between OCO and the theory of statistical learning. We begin by giving the basic definitions of statistical learning theory, and proceed to describe how the applications studied in this manuscript relate to this model. We then continue to show how regret minimization in the setting of online convex optimization gives rise to computationally efficient statistical learning algorithms.
The theory of statistical learning addresses the problem of learning a concept from examples. A concept is a mapping from domain to labels , denoted .
As an example, consider the problem of optical character recognition. In this setting, the domain can be all bitmap images, the label set is the Latin (or other) alphabet, and the concept maps a bitmap into the character depicted in the image.
Statistical theory models the problem of learning a concept by allowing access to labelled examples from the target distribution. The learning algorithm has access to pairs, or samples, from an unknown distribution
The goal is to be able to predict as a function of , i.e., to learn a hypothesis, or a mapping from to , denoted , with small error with respect to the distribution . In the case that the label set is binary , or discrete such as in optical character recognition, the generalization error of an hypothesis with respect to distribution is given by
We henceforth consider learning algorithms that observe a sample from the distribution , denoted for a sample of examples, , and produce a hypothesis based on this sample.
The goal of statistical learning can thus be summarised as follows:
Given access to i.i.d. samples from an arbitrary distribution over corresponding to a certain concept, learn a hypothesis which has arbitrarily small generalization error with respect to a given loss function.
In the problem of optical character recognition the task is to recognize a character from a given image in bitmap format. To model it in the statistical learning setting, the domain is the set of all bitmap images for some integer . The label set is the latin alphabet, and the concept maps a bitmap into the character depicted in the image.
Consider the naive algorithm which fits the perfect hypothesis for a given sample, in this case set of bitmaps. Namely, is the hypothesis which correctly maps any given bitmap input to its correct label , and maps all unseen bitmaps to the character
Clearly, this hypothesis does a very poor job of generalizing from experience - all images that have not been observed yet will be classified without regard to their properties, surely an erroneous classification most times. However - the training set, or observed examples, are perfectly classified by this hypothesis!
This disturbing phenomenon is called “overfitting,” a central concern in machine learning. Before continuing to add the necessary components in learning theory to prevent overfitting, we turn our attention to a formal statement of when overfitting can appear.
1.2 No free lunch?
The following theorem shows that learning, as stated in the goal of statistical learning theory, is impossible without restricting the hypothesis class being considered. For simplicity, we consider the zero-one loss in this section.
Consider any domain of size , and any algorithm which outputs a hypothesis given a sample of size . Then there exists a concept and a distribution such that:
The generalization error of the concept is zero.
With probability at least , the error of the hypothesis generated by is at least .
The proof of this theorem is based on the probabilistic method, a useful technique for showing the existence of combinatorial objects by showing that the probability they exist in some distributional setting is bounded away from zero. In our setting, instead of explicitly constructing a concept with the required properties, we show it exists by a probabilistic argument.
We show that for any learning algorithm, there is some learning task (i.e., “hard” concept) that it will not learn well. Formally, take to be the uniform distribution over . Our proof strategy will be to show the following inequality, where we take a uniform distribution over all concepts
After showing this step, we will use Markov’s Inequality to conclude the theorem.
We proceed by using the linearity property of expectations, which allows us to swap the order of expectations, and then conditioning on the event that .
All terms in the above expression, and in particular the first term, are non-negative and at least . Also note that since the domain size is and the sample is of size , we have . Finally, observe that for all since we are given that the “true” concept is chosen uniformly at random over all possible concepts. Hence, we get that:
which is the intermediate step we wanted to show. The random variable attains values in the range $\frac{1}{4}\frac{1}{4}$ is non-empty. Thus, there exists a concept such that
where, as assumed beforehand, is the uniform distribution over .
We now conclude with Markov’s Inequality: since the expectation above over the error is at least one-fourth, the probability over examples such that the error of over a random sample is at least one-tenth is at least
1.3 Examples of learning problems
The conclusion of the previous theorem is that the space of possible concepts being considered in a learning problem needs to be restricted for any meaningful guarantee. Thus, learning theory concerns itself with concept classes, also called hypothesis classes, which are sets of possible hypotheses from which one would like to learn. We denote the concept (hypothesis) class by .
Common examples of learning problems that can be formalized in this model and the corresponding definitions include:
Optimal character recognition: In the problem of optical character recognition the domain consists of all bitmap images for some integer , the label set is a certain alphabet, and the concept maps a bitmap image into the character depicted in it. A common (finite) hypothesis class for this problem is the set of all decision trees with bounded depth.
Recommendation systems: recall the online convex optimization formulation of this problem in section 7.2. A statistical learning formulation for this problem is very similar. The domain is a direct sum of two sets . Here is a certain media item, and every person is an item . The label set is binary, where one indicates a positive sentiment for the person to the particular media item, and zero a negative sentiment.
1.4 Defining generalization and learnability
We are now ready to give the fundamental definition of statistical learning theory, called Probably Approximately Correct (PAC) learning:
The set of samples from the underlying distribution is called the training set. The error in the above definition is called the generalization error, as it describes the overall error of the concept as generalized from the observed training set. The behavior of the number of samples as a function of the parameters and the concept class is called the sample complexity of .
The definition of PAC learning says nothing about computational efficiency. Computational learning theory usually requires, in addition to the definition above, that the algorithm is efficient, i.e., polynomial running time with respect to and the representation of the hypothesis class. The representation size for a discrete set of concepts is taken to be the logarithm of the number of hypotheses in , denoted .
If the hypothesis returned by the learning algorithm belongs to the hypothesis class , as in the definition above, we say that is properly learnable. More generally, may return hypothesis from a different hypothesis class, in which case we say that is improperly learnable.
The fact that the learning algorithm can learn up to any desired accuracy is called the realizability assumption and greatly reduces the generality of the definition. It amounts to requiring that a hypothesis with near-zero error belongs to the hypothesis class. In many cases, concepts are only approximately learnable by a given hypothesis class, or inherent noise in the problem prohibits realizability (see exercises).
This issue is addressed in the definition of a more general learning concept, called agnostic learning:
With these definitions, we can state the fundamental theorem of statistical learning theory for finite hypothesis classes:
Every finite concept class is agnostically PAC learnable with sample complexity that is .
In the following sections we prove this theorem, and in fact a more general statement that holds also for certain infinite hypothesis classes. The complete characterization of which infinite hypothesis classes are learnable is a deep and fundamental question, whose complete answer was given by Vapnik and Chervonenkis (see bibliography). The question of which (finite or infinite) hypothesis classes are efficiently PAC learnable, especially in the improper sense, is still at the forefront of learning theory today.
2 Agnostic Learning using Online Convex Optimization
In this section we show how to use online convex optimization for agnostic PAC learning. Following the paradigm of this manuscript, we describe and analyze a reduction from agnostic learning to online convex optimization. The reduction is formally described in Algorithm 29.
For this reduction we assumed that the concept (hypothesis) class is a convex subset of Euclidean space. A similar reduction can be carried out for discrete hypothesis classes (see exercises). In fact, the technique we explore below will work for any hypothesis set that admits a low regret algorithm, and can be generalized to infinite hypothesis classes that are known to be learnable.
Let be the hypothesis in the class that minimizes the generalization error. Using the assumption that guarantees sublinear regret, our simple reduction implies PAC learning, as given in the following theorem.
How general is the theorem above? In the previous chapters we have described and analyzed OCO algorithms with regret guarantees that behave asymptotically as or better. This translates to sample complexity of (see exercises), which is known to be tight for certain scenarios.
To prove this theorem we need some tools from probability theory, such as the concentration inequalities that we survey next.
Let us briefly discuss the notion of a martingale in probability theory. For intuition, it is useful to recall the simple random walk. Let be a Rademacher random variable which takes values
A simple symmetric random walk is described by the sum of such random variables, depicted in figure 9.1. Let be the position after steps of this random walk. The expectation and variance of this random variable are .
The phenomenon of measure concentration addresses the probability of a random variable to attain values within range of its standard deviation. For the random variable , this probability is much higher than one would expect using only the first and second moments. Using only the variance, it follows from Chebychev’s inequality that
However, the event that is centred around is in fact much tighter, and can be bounded by the Hoeffding-Chernoff lemma as follows
Thus, deviating by a constant from the standard deviation decreases the probability exponentially, rather than polynomially. This well-studied phenomenon generalizes to sums of weakly dependent random variables and martingales, which are important for our application.
A sequence of random variables is called a martingale if it satisfies:
A similar concentration phenomenon to the random walk sequence occurs in martingales. This is captured in the following theorem by Azuma.
Let \big{\{}X_{i}\big{\}}_{i=1}^{T} be a martingale of random variables that satisfy . Then:
2.2 Analysis of the reduction
We start by defining a sequence of random variables that form a martingale. Let
Let us verify that is indeed a bounded martingale. Notice that by definition of , we have that
In addition, by our assumption that the loss is bounded, we have that (see exercises)
Therefore we can apply Azuma’s theorem to the martingale , or rather its consequence (9.2), and get
Plugging in the definition of , dividing by and using :
A similar martingale can be defined for rather than , and repeating the analogous definitions and applying Azuma’s inequality we get:
For notational convenience, let us use the following notation:
By convexity we have that . Thus, with probability at least ,
3 Learning and Compression
Thus far we have considered finite and certain infinite hypothesis classes, and shown that they are efficiently learnable if there exists an efficient regret-minimization algorithm for a corresponding OCO setting.
In this section we describe yet another property which is sufficient for PAC learnability: the ability to compress the training set. This property is particularly easy to state and use, especially for infinite hypothesis classes. It does not, however, imply efficient algorithms.
Intuitively, if a learning algorithm is capable to express an hypothesis using a small fraction of the training set, we will show that it generalizes well to unseen data. For simplicity, we only consider learning problems that satisfy a variant of the realizablility assumption, i.e., the compression scheme generates a hypothesis that attains zero error.
More formally, we define the notion of a compression scheme for a given learning problem as follows. The definition and theorem henceforth can be generalized to allow for loss functions, but for simplicity, consider only the zero-one loss function for this section.
(Compression Scheme) A distribution over admits a compression scheme of size , realized by an algorithm , if the following holds. For any , let be a sample from . There exists an , such that the algorithm accepts the set of examples , and returns a hypothesis , which satsifies:
The main conclusion of this section is that a learning problem that admits a compression scheme of size is PAC learnable with sample complexity proportional to . This is formally given the following theorem.
Let be a data distribution that admits a compression scheme of size realized by algorithm . Then with probability at least over the choice of a training set , it holds that
Denote by the error of an hypothesis on a sample of i.i.d. examples, where the sample is taken independently of . Since the examples are chosen independently, the probability that a hypothesis with has is at most . Denote the event of satisfying these two conditions by .
Consider a compression scheme for distribution of size , realized by , and a sample of size . By definition of a compression scheme, the hypothesis returned by is based on examples chosen from the set . We can bounds the probability of the event that and , denoted by , as follows,
For , we have that
Since the compression scheme is guaranteed to return a hypothesis such that , this implies that with probability at least , the hypothesis has . ∎
4 Bibliographic Remarks
The foundations of statistical and computational learning theory were put forth in the seminal works of Vapnik (1998) and Valiant (1984) respectively. There are numerous comprehensive texts on statistical and computational learning theory, see e.g., (Kearns and Vazirani, 1994), and the recent text (Shalev-Shwartz and Ben-David, 2014).
Reductions from the online to the statistical (a.k.a. “batch”) setting were initiated by Littlestone (Littlestone, 1989). Tighter and more general bounds were explored in (Cesa-Bianchi et al., 2006; Cesa-Bianchi and Gentile, 2008; Zhang, 2005).
The probabilistic method is attributed to Paul Erdos, see the illuminating text of Alon and Spencer (Alon and Spencer, 1992).
The relationship between compression and PAC learning was studied in the seminal work of Littlestone and Warmuth (1986). For more on the relationship and historical connections between statistical learning and compression see the inspiring chapter in (Wigderson, 2019). More recently Moran and Yehudayoff (2016); David et al. (2016) show that compression is equivalent to learnability in general supervised learning tasks and give quantitative bounds for this relationship.
The use of compression for proving generalization error bounds has been applied in (Hanneke et al., 2019) for regression and in (Gottlieb et al., 2018; Kontorovich et al., 2017) for nearest neighbor classification. Another application is the recent work of Bousquet et al. (2020) which gives optimal generalization error bounds for support vector machines using compression.
5 Exercises
1. Strengthen the no free lunch Theorem 9.1 to show the following: For any , there exists a finite domain , such that for any learning algorithm which given a sample produces hypothesis , there exists a distribution and a concept such that
(b) .
2. Let be an agnostic learning algorithm for the finite hypothesis class and the zero-one loss. Consider any concept which is realized by , and the concept which is obtained by replacing the label associated with each domain entry randomly with probability every time is sampled independently. That is:
Prove that can -approximate the concept : that is, show that can be used to produce a hypothesis that has error
with probability at least for every with sample complexity polynomial in .
4. (Sample complexity of SVM) Consider the class of hypothesis given by hyperplanes in Euclidean space with bounded norm
Give an algorithm to PAC-learn this class with respect to the hinge loss function using reduction (29). Analyze the resulting computational and sample complexity.
5. Show how to use a modification of reduction 29 to learn a finite (non-convex) hypothesis class efficiently, i.e., without enumerating over all hypothesis. For this question, success probability of is sufficient. Hint: instead of returning , consider returning a hypothesis at random.
6. Consider the hypothesis class of all axis-aligned rectangles in the plane. That is, consider all hypothesis parametrized by four real numbers, , such that
Prove that this hypothesis class admits a compression scheme of size .
Prove that this class has a compression scheme of size .
Chapter 10 Learning in Changing Environments
In online convex optimization the decision maker iteratively makes a decision without knowledge of the future, and pays a cost based on her decision and the observed outcome. The algorithms that we have studied thus far are designed to perform nearly as well as the best single decision in hindsight. The performance metric we have advocated for, average regret of the online player, approaches zero as the number of game iterations grows.
In scenarios in which the outcomes are sampled from some (unknown) distribution, regret minimization algorithms effectively “learn” the environment and approach the optimal strategy. This was formalized in chapter 9. However, if the underlying distribution changes, no such claim can be made.
Consider for example the online shortest path problem we have studied in the first chapter. It is a well observed fact that traffic in networks exhibits changing cyclic patterns. A commuter may choose one path from home to work on a weekday, but a completely different path on the weekend when traffic patterns are different. Another example is the stock market: in a bull market the investor may want to purchase technology stocks, but in a bear market perhaps they would shift their investments to gold or government bonds.
When the environment undergoes many changes, standard regret may not be the best measure of performance. In changing environments, the online convex optimization algorithms we have studied thus far for strongly convex or exp-concave loss functions exhibit undesirable “static” behavior, and converge to a fixed solution.
In this chapter we introduce and study a generalization of the concept of regret called adaptive regret, to allow for a changing prediction strategy. We start with examining the notion of adapting in the problem of prediction from expert advice. We then continue to the more challenging setting of online convex optimization, and derive efficient algorithms for minimizing this more refined regret metric.
Before giving the main performance metric studied in this chapter, we consider the first natural approach: measuring regret w.r.t. any sequence of decisions. Clearly, in general it is impossible to compete with an arbitrary changing benchmark. However, it is possible to give a refined analysis that shows what happens to the regret of an online convex optimization algorithm vs. changing decisions.
More precisely, define the dynamic regret of an OCO algorithm with respect to a sequence as:
To analyze the dynamic regret, some measure of the complexity of the sequence is necessary. Let be the path length of the comparison sequence defined as
It is natural to expect the regret to scale with the path length, as indeed the following theorem shows. For a fixed comparator , the path length is one, and thus Theorem 10.1 recovers the standard regret bound. For simplicity, we assume that the time horizon is known ahead of time, and so is the path length of the comparator sequence, although these limitations can be removed (see bibliographic section).
Online Gradient Descent (algorithm 8) with step size guarantees the following dynamic regret bound:
Using our notation, and following the steps of the proof of Theorem 3.1,
Using convexity and summing this inequality across time we get
The theorem now follows by choice of . ∎
This simple modification to the analysis of online gradient descent naturally extends to online mirror descent, as well as to other notions of path distance of the comparison sequence.
We now turn to another metric of performance that requires more advanced methods than we have seen thus far. This metric can be shown to be more general than dynamic regret, in the sense that the bounds we prove also imply low dynamic regret.
2 The Notion of Adaptive Regret
The main performance metric we consider in this chapter is designed to measure the performance of a decision maker in a changing environment. It is formally given in the following definition.
The adaptive regret of an online convex optimization algorithm is defined as the maximum regret it achieves over any contiguous time interval. Formally,
As opposed to standard regret, the power of this definition stems from the fact that the comparator is allowed to change. In fact, it is allowed to change indefinitely with every interval of time.
For an algorithm with low adaptive regret, as opposed to standard regret, how would its performance guarantee differ in a changing environment? Consider the problem of portfolio selection, for which time can be divided into disjoint segments with different characteristics: bear market in the first iterations and bull market in the last iterations. A (standard) sublinear regret algorithm is only required to converge to the average of both optimal portfolios, clearly an undesirable outcome. However, an algorithm with sublinear adaptive regret bounds would necessarily converge to the optimal portfolio in both intervals.
The Online Gradient Descent algorithm over general convex losses, with step sizes , attains an adaptive regret guarantee of
and this bound is tight. This is a simple consequence of the analysis we have already seen in chapter 3, and left as an exercise. Unfortunately this guarantee is meaningless for intervals of length .
Recall that for strongly convex loss functions, the OGD algorithm with the optimal learning rate schedule attains regret. However, it does not attain any non-trivial adaptive regret guarantee: its adaptive regret can be as large as , and this is also left as an exercise.
An OCO algorithm is said to be strongly adaptive if its adaptive regret can be bounded by its regret over the interval up to logarithmic terms in , i.e.
The natural question is thus: are there algorithms that attain the optimal regret guarantee, and simultaneously the optimal adaptive regret guarantee? As we shall see, the answer is affirmative in a strong sense: we shall describe and analyze algorithms that are optimal in both metrics. Furthermore, these algorithms can be implemented with small computational overhead over the non-adaptive methods we have already studied.
3 Tracking the Best Expert
Consider the fundamental problem studied in the first chapter of this text, prediction from expert advice, but with a small twist. Instead of a static best expert, consider the setting in which different experts are the “best expert” in different time intervals. More precisely, consider the situation in which time can be divided into disjoint intervals such that each admits a different “locally best” expert. Can we learn to track the best expert?
This tracking problem was historically the first motivation to study adaptivity in online learning. Indeed, as shown by Herbster and Warmuth (see bibliographic section), there is a natural algorithm that attains optimal regret bounds.
The Fixed Share algorithm, describe in Algorithm 30, is a variant of the Hedge Algorithm 1. On top of the familiar multiplicative updates, it adds a uniform exploration term whose purpose is to avoid the weight of any expert from becoming too small. This provably allows a regret bound that tracks the best expert in any interval.
In line with the notation we have used throughout this manuscript, we denote decisions in a convex decision set by . An expert suggests decision , and suffers loss according to a convex loss function denoted . The main performance guarantee for the Fixed Share algorithm is given in the theorem below.
Given a sequence of -exp-concave loss functions, the Fixed-Share algorithm with guarantees
Notice that this is a different guarantee than adaptive regret as per Definition 10.2, as the decision set is discrete. However, it is a crucial component in the adaptive algorithms we will explore in the next section.
As a direct conclusion from this theorem, it can be shown (see exercises) that if the best expert changes times in a sequence of length , the overall regret compared to the best expert in every interval is bounded by
To prove this theorem, we start with the following lemma, which is a fine-grained analysis of the multiplicative weights properties:
Using the -exp concavity of ,
Theorem 10.3 can now be derived as a corollary:
By summing up over the interval , and using the lower bound on , we have
4 Efficient Adaptive Regret for Online Convex Optimization
The Fixed-Share algorithm described in the previous section is extremely practical and efficient for discrete sets of experts. However, to exploit the full power of OCO we require an efficient algorithm for continuous decision sets.
Consider for example the problems of online portfolio selection and online shortest paths: naïvely applying the Fixed-Share algorithm is computationally inefficient. Instead, we seek an algorithm which takes advantage of the efficient representation of these problems in the language of convex programming.
We present such a method called FLH, or Follow the Leading History. The basic idea is to think of different online convex optimization algorithms starting at different time points as experts, and apply a version of Fixed Share to these experts.
The main performance guarantee is given in the following theorem.
In particular, taking guarantees
Notice that FLH invokes at iteration at most times. Hence its running time is bounded by times that of . This can still be prohibitive as the number of iterations grows large. In the next section, we show how the ideas from this algorithm can give rise to an efficient adaptive algorithm with only computational overhead and slightly worse regret bounds.
The analysis of FLH is very similar to that of Fixed Share, with the main subtleties due to the fact that the time horizon is not assumed to be known ahead of time, and thus the number of experts varies with time.
Instead of giving the full analysis, which is deferred to the exercises, we give a simplified version of FLH which does assume a-priory knowledge of , and whose analysis can be directly reduced to that of Theorem 10.3.
The simplified version of FLH is given in Algorithm 32, and it guarantees the following adaptive regret bound.
Applying Theorem 10.3 to the experts defined in Simple FLH, guarantees for every interval in time , and by choice of , for every ,
In particular, consider the sequence of predictions given by the ’th expert, for which we have
The theorem now follows since this holds for every iterval . ∎
5 * Computationally Efficient Methods
In the previous section we studied adaptive regret, introduced and analyzed an algorithm that attains near optimal adaptive regret bounds. However, FLH suffers from a significant computational and memory overhead: it requires maintaining copies of an online convex optimization algorithm. This computational overhead, which is proportional to the number of iterations, can be prohibitive in many applications. In this section our goal is to implement the algorithmic template of FLH efficiently and using little space.
To be more precise, henceforth denote the running time per iteration of algorithm as . Recall that at time , FLH stores all predictions and has to compute weights for all of them. This requires running time of at least .
The FLH2 algorithm, described in Algorithm 33, significantly cuts down this running time to being only logarithmic in the current time iteration parameter . To achieve this, FLH2 applies a pruning method to cut down the number of active online algorithms from to . However, its adaptive regret guarantee is slightly worse, and suffers a multiplicative factor of as compared to FLH.
Before giving the exact details of this pruning method, we state the performance guarantee for FLH2.
The main conclusion from this theorem is obtained by using FLH2 with being the ONS algorithm from chapter 4. This gives adaptive regret of and running time which is polynomial in natural parameters of the problem and poly-logarithmic in the number of iterations.
Before diving into the analysis, we explain the main new ingredient. At the heart of this algorithm is a new method for incorporating history. We will show that it suffices to store only experts at time , rather than all experts as in FLH.
At time , there is a working set of experts. In FLH, this set can be thought of to contain , where each is the algorithm starting from iteration . For the next round, a new expert is added to get . The complexity and regret of FLH is directly related to the cardinality of these sets.
The key to decreasing the sizes of the sets is to also remove (or prune) some experts. Once an expert is removed, it is never used again. The algorithm will perform the multiplicative update and mixing steps (steps 5 and 7 in algorithm 33) only on the working set of experts.
The problem of maintaining the set of active experts can be thought of as the following abstract data streaming problem. Suppose the integers are being “processed” in a streaming fashion. At time , we have “read” the positive integers up to and maintain a very small subset of them in . At time we create from : we are allowed to add to only the integer , and remove some integers already in . Our aim is to maintain a set which satisfies:
For every positive , .
For all , .
The first property of the sets intuitively means that is “well spread out” in a logarithmic scale. This is depicted in Figure 10.1. The second property ensures computational efficiency.
Indeed, the procedure “Prune” maintains with these exact properties, and is detailed after we prove Theorem 10.7.
We proceed to prove the main theorem. We start with an analogue of Lemma 10.4.
The following holds for all ,
Using the -exp concavity of -
To complete the proof, we note the following two facts that are analogous to the ones used in Claim 10.4:
For ,
Proving these facts is left as an exercise.
Using this we can prove the following Lemma.
Consider the regret in with respect to expert ,
Given the properties of , we can show that in any interval the regret incurred is small.
base case: For the regret is bounded by
The interval has size at most , and by induction the algorithm has regret of at most on this interval. This gives a total of regret on . ∎
The running time of FLH2 is bounded by . Since , we can bound the running time by . This fact, together with Lemma 10.10, completes the proof. ∎
We now explain the pruning procedure used to maintain the set .
We specify the lifetime of integer - if , where is odd, then the lifetime of is . Suppose the lifetime of is . Then for any time , integer is alive at . The set is simply the set of all integers that are alive at time . Obviously, at time , the only integer added to is - this immediately proves Property (3). We now prove the other properties.
(Property (2)) For each , let us count the number of integers of the form ( odd) alive at . The lifetimes of these integers are . The only integers alive lie in the interval . Since all of these integers of this form are separated by gaps of size at least , there are at most a constant number of such integers alive at . In total, the size of is . ∎
6 Bibliographic Remarks
Dynamic regret bounds for online gradient descent were proposed by Zinkevich (2003), and further studied in (Besbes et al., 2015). It was shown in (Zhang et al., 2018) that adaptive regret bounds imply dynamic regret bounds.
The study of learning in changing environments can be traced to the seminal work of Herbster and Warmuth (1998) in the context of tracking for the problem of prediction from expert advice. Their technique was later extended to tracking of experts from a small pool (Bousquet and Warmuth, 2003).
The problem of tracking a large set of experts efficiently was studied using the Fixed-Share technique in (Singer, 1998; Kozat and Singer, 2007; György et al., 2005).
The deviation from Fixed-Share to the FLH technique and the notion of adaptive regret were introduced in Hazan and Seshadhri (2007). These techniques were subject of later study and extensions (Adamskiy et al., 2016; Zhang et al., 2019). Daniely et al. (2015) study adaptive regret for weakly convex loss functions and introduced the term “strongly adaptive”, which differentiates the weakly and strongly convex settings. They note that FLH is a strongly adaptive algorithm.
The use of an exponential look-back for prediction has roots in information theory (Willems and Krom, 1997; Shamir and Merhav, 2006). Efficient methods for streaming, that were used in this chapter to maintaining a small set of active experts, were studied in the steaming algorithms literature (Gopalan et al., 2007).
Adaptive regret algorithms were motivated by applications involving changing environments, such as the portfolio selection problem. More recently they were applied for time series prediction (Anava et al., 2013) and the control of dynamical systems (Gradu et al., 2020).
7 Exercises
2. Prove that the OGD algorithm for convex functions, with step sizes , has an adaptive regret guarantee of , and that this is tight. Prove that the lazy version of OGD, from chapter 5, behaves differently and has an adaptive regret bound of .
3. Prove that the OGD algorithm with step size for strongly convex functions, has adaptive regret which is lower bounded by .
4. Consider the problem of prediction from expert advice with -exp-concave loss functions, where the best expert switches times. That is, time can be divided into segments , such that the best expert in each segment is different. Show that the regret of the Fixed Share algorithm vs. the best -switching expert (a strategy that is allowed to change experts times) is bounded by
5. Spell out a choice of parameter for the Fixed Share algorithm that does not require knowledge of the number of iterations in advance. Prove an analogue of Theorem 10.3 with your choice of .
7. Prove the following facts used in the proof of Proposition 10.8:
(a) For ,
8. Implement meta-algorithms FLH and FLH2 with the ONS algorithm, and apply the resulting method on the portfolio selection problem. Benchmark your results and compare to ONS and OGD.
Chapter 11 Boosting and Regret
In this chapter we consider a fundamental methodology of machine learning: boosting. In the statistical learning setting, roughly speaking, boosting refers to the process of taking a set of rough “rules of thumb” and combining them into a more accurate predictor.
Consider for example the problem of Optical Character Recognition (OCR) in its simplest form: given a set of bitmap images depicting hand-written postal-code digits, classify those that contain the digit “1” from those of “0”.
Seemingly, discerning the two digits seems a difficult task taking into account the different styles of handwriting, inconsistent styles even for the same person, label errors in the training data, etc. However, an inaccurate rule of thumb is rather easy to produce: in the bottom-left area of the picture we’d expect many more dark bits for “1”s than if the image depicts a “0”. This is, of course, a rather inaccurate classifier. It does not consider the alignment of the digit, thickness of the handwriting, and numerous other factors. Nevertheless, as a rule of thumb - we’d expect better-than-random performance and some correlation with the ground truth.
The inaccuracy of the crude single-bit predictor is compensated by its simplicity. It is not hard to implement a classifier based upon this rule of thumb, which is very efficient indeed. The natural and fundamental question which now arises is: can several such rules of thumb be combined into a single, accurate and efficient classifier?
In the rest of this chapter we shall formalize this question in the statistical learning theory framework. We then proceed to use the technology developed in this manuscript, namely regret minimization algorithms for online convex optimization, to answer this question in the affirmative. Our development will be somewhat non-standard: we’ll describe a black-box reduction from regret-minimization to boosting. This allows any of the OCO methods previously discussed in this text to be used as the main component of a boosting algorithm.
Throughout this chapter we use the notation and definitions of chapter 9 on learning theory, and focus on statistical learnability rather than agnostic learnability. More formally, we assume the so called “realizability assumption”, which states that for a learning problem over hypothesis class there exists some such that its generalization error is zero, or formally
Using the notations of the previous chapter, we can define the following seemingly weaker notion than statistical learnability.
The concept class is said to be -weakly-learnable if the following holds. There exists an algorithm that accepts and returns an hypothesis in that satisfies: for any there exists large enough such that for any distribution over pairs , for , and samples from this distribution, it holds that with probability ,
This is an apparent weakening of the definition of statistical learnability that we have described in chapter 9: the error is not required to approach zero. The standard case of statistical learning in the context of boosting is called “strong learnability”. An algorithm that achieves weak learning is referred to as a weak learner, and respectively we can refer to a strong learner as an algorithm that attains statistical learning, i.e., allows for generalization error arbitrarily close to zero, for a certain concept class.
The central question of boosting can now be formalized: are weak learning and strong learning equivalent? In other words, is there an (efficient?) procedure that has access to a weak oracle for a concept class, and returns a strong learner for the class?
Miraculously, the answer is affirmative, and gives rise to one of the most effective paradigms in machine learning.
2 Boosting by Online Convex Optimization
In this section we describe a reduction from OCO to boosting. The template is similar to the one we have used in chapter 9: using one of the numerous algorithms for online convex optimization we have explored in this manuscript, as well as access to a weak learner, we create a procedure for strong learning.
Our derivation focuses on simplicity rather than generality. As such, we make the following assumptions:
We restrict ourselves to the classical setting of binary classification. Boosting to real-valued losses is also possible, but outside our scope. Thus, we assume the loss function to be the zero-one loss, that is:
We assume that the concept class is realizable, i.e., there exists an such that . There are results on boosting in the agnostic learning setting, these are surveyed in the bibliographic section.
We denote the distribution over examples , where , as a point in . That is, a point is a non-negative vector that integrates to one over all examples. For simplicity, we think of as a finite, and therefore belongs to the dimensional simplex, i.e., is a discrete distribution over elements.
We henceforth denote the weak learning algorithm by , and denote by a call to the weak learning algorithm over distribution that satisfies
With these assumptions and definitions we are ready to prove the main result: a reduction from weak learning to strong learning using an online convex optimization algorithm with a sublinear regret bound. Essentially, our task would be to find a hypothesis which attains zero error on a given sample.
2.2 Algorithm and analysis
Pseudocode for the boosting algorithm is given in Algorithm 34. This reduction accepts as input a -weak learner and treats it as a black box, returning a function which we’ll prove is a strong learner.
The reduction also accepts as input an online convex optimization algorithm denoted . The underlying decision set for the OCO algorithm is the -dimensional simplex, where is the sample size. Thus, its decisions are distributions over examples. The cost functions are linear, and assign a value of zero or one, depending on whether the current hypothesis errs on a particular example. Hence, the cost at a certain iteration is the expected error of the current hypothesis (chosen by the weak learner) over the distribution chosen by the low-regret algorithm.
It is important to note that the final hypothesis which the algorithm outputs does not necessarily belong to - the initial hypothesis class we started off with.
Algorithm 34 returns a hypothesis such that with probability at least ,
Given , we denote its empirical error on the sample , weighted by the distribution , by:
Notice that by definition of we have . Since is the output of a -weak-learner on the distribution , we have for all ,
This applies for each separately, and by the union bound we have
Denote by be the set of all missclassified examples by . Let the uniform distribution over .
Combining the previous two observations, we have with probability at least that
This is a contradiction. We conclude that a distribution cannot exist, and thus all examples in are classified correctly.
2.3 AdaBoost
A special case of the template reduction we have described is obtained when the OCO algorithm is taken to be the Multiplicative Updates method we have come to know in the manuscript.
Corollary 5.7 gives a bound of on the regret of the EG algorithm in our context. This bounds in Algorithm 34 by .
Closely related is the AdaBoost algorithm, which is one of the most useful and successful algorithms in Machine Learning at large (see bibliography). Unlike the Boosting algorithm that we have analyzed, AdaBoost doesn’t have to know in advance the parameter of the weak learners. Pseudo code for the AdaBoost algorithm is given in 35.
2.4 Completing the picture
In our discussion so far we have focused only on the empirical error over a sample. To show generalization and complete the Boosting theorem, one must show that zero empirical error on a large enough sample implies generalization error on the underlying distribution.
Notice that the hypothesis returned by the Boosting algorithms does not belong to the original concept class. This presents a challenge for certain methods of proving generalization error bounds that are based on measure concentration over a fixed hypothesis class.
Both issues are resolved using the implication that compression implies generalization, as given in Theorem 9.9. We sketch the argument below, and the precise derivation is left as an exercise.
Roughly speaking, boosting algorithm 34 runs on examples for rounds, returns a final hypothesis that is the majority vote of hypothesis, and classifies correctly all examples of the training set.
Suppose that the weak learning algorithm has sample complexity of size : given examples, it returns a hypothesis with generalization error at most with probability at least . Further, suppose the original training set of examples was sampled from distribution .
Since classifies correctly the entire training set, it follows that the distribution has a compression scheme of size
Therefore, using Theorem 9.9, we have that,
Now one can obtain an arbitrary small generalization error by choosing as a function of . Notice that this argument makes an assumption only about the sample complexity of the weak learning algorithm, rather than the hypothesis class .
3 Bibliographic Remarks
The theoretical question of Boosting and posed and addressed in the work of Schapire (1990); Freund (1995). The AdaBoost algorithm was proposed in the seminal paper of Freund and Schapire (1997). The latter paper also contains the essential ingredients for the reduction from general low-regret algorithms to boosting.
Boosting has had significant impact on theoretical and practical data analysis as described by the statistician Leo Breiman (Olshen, 2001). For a much more comprehensive survey of Boosting theory and applications see the recent book (Schapire and Freund, 2012).
The theory for agnostic boosting is more recent, and several different definitions and settings exist, see (Kalai et al., 2008; Kalai and Servedio, 2005; Kanade and Kalai, 2009; Feldman, 2009; Ben-David et al., 2001), the most general of which is perhaps by Kanade and Kalai (2009).
A unified framework for realizable and agnostic boosting, for both the statistical and online settings, is given in (Brukhim et al., 2020).
The theory of boosting has been extended to real valued learning via the theory of gradient boosting (Friedman, 2002). More recently it was extended to online learning (Leistner et al., 2009; Chen et al., 2012, 2014; Beygelzimer et al., 2015a, b; Agarwal et al., 2019; Jung et al., 2017; Jung and Tewari, 2018; Brukhim and Hazan, 2020).
4 Exercises
1. Describe a boosting algorithm based on the online gradient descent algorithm. Give a bound on its running time.
2. Download the MNIST dataset from the web. Implement weak learners to differentiate a pair of digits of your choice according to a single bit. Implement AdaBoost and apply it to your weak learners. Summarize your results and conclusions.
3. ∗ Consider the problem of agnostic boosting, in which the existence of a zero-error hypothesis is not assumed.
(a) Write down an alternative definition of a weak learning algorithm for the agnostic setting.
(b) Write down a reasonable goal for a boosting algorithm.
(c) Write down an analogue of Theorem 11.2 for agnostic boosting (without proof).
4. Compute the number of samples required to achieve a generalization error of , using boosting algorithm 34 and a weak learning algorithm with sample complexity bound .
Chapter 12 Online Boosting
This text considers online optimization and learning, and it is a natural question to ask whether the technique of boosting has an analogue in the online world? What is a “weak learner” in online convex optimization, and how can one strengthen it? This is the subject of this chapter, and we shall see that boosting can be extremely powerful and useful in the setting of online convex optimization.
Recall the classical problem of prediction from expert advice from the first chapter of this text. A learner iteratively makes decisions and receives loss according to an arbitrarily chosen loss function. For its decision making, the learner is assisted by a pool of experts. Classical algorithms such as the Hedge algorithm 1, guarantees a regret bound of , where is the number of experts, and this is known to be tight.
However, in many problems of interest, the class of experts is too large to efficiently manipulate. This is particularly evident in contextual learning, as formally defined below, where the experts are policies – functions mapping contexts to action. In such instances, even if a regret bound of is meaningful, the algorithms achieving this bound are computationally inefficient; their running time is linear in . This linear dependence is many times unacceptable: the effective number of policies mapping contexts to actions is exponential in the number of contexts.
The boosting approach to address this computational intractability is motivated by the observation that it is often possible to design simple rules-of-thumb that perform slightly better than random guesses. Analogously to the weak learning oracles from chapter 11, We propose that the learner has access to an “online weak learner” - a computationally cheap mechanism capable of guaranteeing multiplicatively approximate regret against a base hypotheses class.
In the rest of this chapter we describe efficient algorithms that when provided weak learners, compete with the convex hull of the base hypotheses class with near-optimal regret.
As a more precise example to the motivation we just surveyed, we formalize online boosting for binary prediction from expert advice. At iteration , a set of experts denoted , observe a context , and predict a binary outcome . The loss of each expert is taken to be the binary loss, for a true label . The Hedge algorithm from the first chapter applies to this problem, and guarantees a regret of for a finite . However, the case in which is extremely large, maintaining the weights is prohibitive computationally.
A weak online learner in this setting is an algorithm which is guaranteed to attain at most a factor loss from the best expert in class, for some , up to an additive sublinear regret term. Formally, for any sequence of contexts and labels ,
The online boosting question can now be phrased as follows: given access to a weak online learning algorithm , can we design an efficient online algorithm that guarantees vanishing regret over ? More formally, let
1.2 Example: personalized article placement
In the problem of matching articles to visitors of a web-page on the Internet, a number of articles are available to be placed in a given web-page for a particular visitor. The goal of the decision maker, in this case the article placer, is to find the most relevant article that will maximize the probability of a visitor click.
It is usually the case that context is available, in the form of user profile, preferences surfing history and so forth. This context is invaluable in terms of placing the most relevant article. Thus, the decision of the article-placer is to choose from a policy: a mapping from context to article.
The space of policies is significantly larger than the space of articles and space of contexts: its size is the power of articles to the cardinality of contexts. This motivates the use of online learning algorithms whose computational complexity is independent of the number of experts.
The natural formulation of this problem is not binary prediction, but rather multi-class prediction. Formulating this problem in the language of online convex optimization is left as an exercise.
2 The Contextual Learning Model
Boosting in the context of online convex optimization is most useful for the contextual learning problem which we now describe.
We have studied numerous methods capable of minimizing regret for this setting in this text, all assumed that we have access to the set , and depend on its diameter in some way.
To avoid this dependence, we consider an alternative access model to . A weak learner for the OCO setting is defined as follows.
An online learning algorithm is a -weak OCO learner (WOCL) for and , if for any sequence of contexts and linear loss functions , for which 15The results henceforth hold with a different constant if we replace one by a different scaling., we have
where is the center of mass of .
This definition differs in two aspects from the types of regret minimization guarantees we have seen thus far. For one, the algorithm competes with a -multiple of the best comparator in hindsight, and is “weak” in this precise manner.
Secondly, a multiplicative guarantee is not invariant for a constant shift. This is the reason for the existence of an additional component, , in the regret bound. This can be thought of as the cost of a random, or naive predictor. A weak learner must, at the very least, perform better than this naive and non-anticipating predictor!
It is convenient to henceforth assume that the loss functions are shifted such that . Under this assumption, we can rephrase -WOCL as
3 The Extension Operator
The main difficulty is coping with the approximate guarantee that the WOCL provides. Therefore the algorithm we describe henceforth scales the predictions returned by the weak learner by a factor of . This means that the scaled decisions do not belong to the original decision set anymore, and need to be projected back.
First, denote the Euclidean distance function to a set as (see also section 13.2),
where the smoothing operator was defined as per Lemma 2.8.
The important take-away from these operators is the following lemma, whose importance is crucial in the OCO boosting algorithm 36, as it projects infeasible points that are obtained from the weak learners to the feasible domain.
The -extension of a function satisfies the following:
For every point , we have .
The projection of a point, whose gradient is bounded by , onto improves the -extension function, for , value up to a small term,
Since for all , this follows immediately from Lemma 2.8.
Denote for brevity. Then
4 The Online Boosting Method
The online boosting algorithm we describe in this section is closely related to the online Frank-Wolfe algorithm from chapter 7. Not only does it deliver in boosting WOCL to strong learning, but it gives an even stronger guarantee: low regret over the convex hull of the hypothesis class.
Algorithm 36 efficiently converts a weak online learning algorithm into an OCO algorithm with vanishing regret in a black-box manner. The idea is to apply the weak learning algorithm on linear functions that are gradients of the loss. The algorithm then recursively applies another weak learner on the gradients of the residual loss, and so forth.
However, the Frank-Wolfe method is not applied directly to the loss functions, but rather to a proxy loss which defined using the extension operation in 12.2. Importantly, algorithm 36 has a running time that is independent of .
Notice that if , the algorithm stills gives a significant advantage as compared to the weak learner: the regret guarantee is vs. the convex hull of , as compared to the best single hypothesis.
The predictions generated by Algorithm 36 with satisfy
It is possible to obtain tighter bounds by a factor of the dimension, and other constant terms, using a more sophisticated smoothing operator. References for these tighter results are given in the bibliographic section at the end of this chapter.
The regret bound of Theorem 12.4 is nearly as good as we could hope for. The first term approaches zero as the number of weak learners grows. The second term is sublinear as the regret of the weak learner. It is scaled by a factor of , which we can expect due to the approximate guarantee of the weak learner.
Before proving the theorem, let us define some notations we use. The algorithm defines the extension of the loss functions as
We apply the setting of , as required by Lemma 12.3, and by Lemma 2.8, is -smooth. Also, denote by the convex hull of the set , and let
to be the best hypothesis in the convex hull of in hindsight, i.e., the best convex combination of hypothesis from . Notice that since the loss functions are generally convex and non-linear, this convex combination is not necessarily a singleton. We define as the decisions of this hypothesis.
The main crux of the proof is given by the following lemma.
For smoothed loss functions that are -smooth and Lipschitz, it holds that
Recall that is smooth by our assumption. Therefore:
By using the definition and linearity of , we have
Now, note the following equivalent restatement of the WOCL guarantee, which again utilizes linearity of to conclude: linear loss on a convex combination of a set is equal to the same convex combination of the linear loss applied to individual elements.
Using the above and that , we have
Denoting , we are left with
This is a recursive relation that can be simplified by applying Lemma 7.2 from chapter 7. We obtain that . ∎
We are ready to prove the main guarantee of Algorithm 36.
Using both parts of Lemma 12.3 in succession, we have
Next, recall by Lemma 2.8, that is -smooth. By applying Lemma 12.5, and optimizing , we have
where the last inequality is only to obtain a nicer expression.
It remains to bound , and we claim that . To see this, notice that the function is -Lipschitz, since
Thus, by the definition of the extension operator and the functions , we have that . ∎
5 Bibliographic Remarks
The theory of boosting, which we have surveyed in chapter 11, originally applied to binary classification problems. Boosting for real-valued regression was studied in the theory of gradient boosting by Friedman (2002).
Online boosting, for both the classification and regression settings was studied much later (Leistner et al., 2009; Chen et al., 2012, 2014; Beygelzimer et al., 2015a, b; Agarwal et al., 2019; Jung et al., 2017; Jung and Tewari, 2018; Brukhim and Hazan, 2020). The relationship to the Frank-Wolfe method was explicit in these works, and also studied in (Freund et al., 2017; Wang et al., 2015). A framework which encapsulates both agnostic and realizable boosting, for both offline and online settings, is given in (Brukhim et al., 2020).
Boosting for the full online convex optimization setting, with a multiplicative approximation and general convex decision set, was obtained in (Hazan and Singh, 2021). The latter also give tighter bounds by a factor of the dimension than those presented in this text using a more sophisticated smoothing technique known as the Moreau-Yoshida regularization (Beck, 2017).
The contextual experts and bandits problems have been proposed by Langford and Zhang (2008) as a decision making framework with large number of policies. In the online setting, several works study the problem with emphasis on efficient algorithms given access to an optimization oracle (Rakhlin and Sridharan, 2016; Syrgkanis et al., 2016a, b; Rakhlin and Sridharan, 2016). For surveys on contextual bandit algorithms and applications of this model see (Zhou, 2015; Bouneffouf and Rish, 2019).
6 Exercises
1. Derive, from Algorithm 36, an algorithm for online binary classification. Spell out its regret guarantee.
2. Formulate the online personalized article placement problem in the language of online convex optimization (what is the decision set?). Define a weak learner in this context, and the final boosting guarantee from Theorem 12.4.
3. ∗ Define the Moreau-Yoshida regularization (or smoothing operator) as:
Prove that given any -Lipschitz , the smoothed function satisfies:
(a) is -smooth, and -Lispchitz.
4. ∗ Use the Moreau-Yoshida regularization to improve the bounds of Theorem 12.4 by a factor of the dimension.
Chapter 13 Blackwell Approachability and Online Convex Optimization
The history of adversarial prediction started with the seminal works of mathematicians David Blackwell and James Hannan. In most of the text thus far, we have presented the viewpoint of sequential prediction and loss minimization, taken by Hannan. This was especially true in chapter 5, as the FPL algorithm dates back to his work. In this chapter we turn to a dual view of regret minimization, called “Blackwell approachability”. Approachability theory originated in the work of Blackwell, and was discovered simultaneously to that of Hannan. A short historical account is surveyed in the bibliographic materials at the end of this chapter.
For decades the relationship between regret minimization in general convex games and Blackwell approachability was not fully understood. The common thought was, in fact, that Blackwell approachability is a stronger notion. In this chapter we show that approachability and online convex optimization are equivalent in a strong sense: an algorithm for one task implies an algorithm for the other with no loss of computational efficiency.
As a side benefit to this equivalence, we deduce a proof of Blackwell’s approachability theorem using the existence of online convex optimization algorithms. This proof applies to a more general version of approachabilty, over general vector games, and comes with rates of convergence that are borrowed from the OCO algorithms we have already studied.
While previous chapters had a practical motivation and introduced methods for online learning, this chapter is purely theoretical, and devoted to give an alternate viewpoint of online convex optimization from a game theoretic perspective.
Von Neumann’s minimax theorem, that we have studied in chapter 8, establishes a central result in the theory of two-player zero-sum games by providing a prescription to both players. This prescription is in the form of a pair of optimal mixed strategies: each strategy attains the optimal worst-case value of the game without knowledge of the opponent’s strategy. However, the theorem fundamentally requires that both players have a utility function that can be expressed as a scalar.
In 1956, in response to von Neumann’s result, David Blackwell posed an intriguing question: what guarantee can we hope to achieve when playing a two-player game with a vector-valued payoff?
A vector-valued game is defined similarly to zero-sum games as we have defined in Definition 8.2, with reward/loss vectors replacing the scalar rewards/losses.
Similar to scalar games, we can define mixed strategies as distributions over pure strategies, and denote the expected reward vector for playing mixed strategies by
We henceforth consider more general vector games than originally considered in the literature. The additional generality allows for uncountably many strategies for both players, and allows the strategies to originate from bounded convex and closed sets in Euclidean space.
The goal of a zero-sum game is clear: to guarantee a certain loss/reward. What should be the vector game generalization? Blackwell proposed to ask “can we guarantee that our vector payoff lies in some closed convex set ?”
It is left as an exercise at the end of this chapter to show that an immediate analogue of Von Neumann’s theorem does not exist: there is no single mixed strategy that ensures the vector payoff lies in a given set. However, this does not rule out an asymptotic notion, if we allow the game to repeat indefinitely, and ask whether there exists a strategy to ensure that the average reward vector lies in a certain set, or at least approaches it in terms of Euclidean distance. This is exactly the solution concept that Blackwell proposed as defined formally below.
Using the notation we have used throughout this text, we denote the (Euclidean) distance to a bounded, closed and convex set as
Under this notion, we can now allow the player to implement an adaptive strategy for a repeated version of the game, and we require that the average reward vector comes arbitrarily close to . Blackwell’s theorem characterizes which sets in Euclidean space are approachable. We give it below in generalized form,
The approachability condition spelled out in the equation above is both necessary and sufficient. The necessity of this condition is left as an exercise, and the more interesting implication is that any set that satisfies this condition is, in fact, approachable. Our reductions henceforth give an explicit proof of Blackwell’s theorem, and we leave it as an exercise to draw the explicit conclusion of this theorem from the first efficient reduction.
The relationship between Blackwell approachability in vector games and OCO may not be evident at this point. However, we proceed to show that the two notions are in fact algorithmically equivalent.
In the next section we show that any algorithm for OCO can be efficiently converted to an approachability algorithm for vector games. Following this, we show the other direction as well: an approachability algorithm for vector games gives an OCO algorithm with no loss of efficiency!
2 From Online Convex Optimization to Approachability
In this section we give an efficient reduction from OCO to approachability. Namely, assume that we have an OCO algorithm denoted , that attains sublinear regret. Our goal is to design a Blackwell approachability algorithm for a given vector game and closed, bounded convex set . Thus, the reduction in this section shows that OCO is a stronger notion than approachabiliy. This direction is perhaps the more surprising one, and was discovered more recently, see bibliographic section for an historical account of this development.
Since we are looking to approach a given set, it is natural to consider minimizing the distance of our reward vector to the set. Recall we denote the (Euclidean) distance to a set as . The support function of closed convex set is given by
Notice that this function is convex, since it is a maximum over linear functions.
Using the definition of the support function,
Blackwell’s theorem characterizes approachable sets: it is necessary and sufficient to be able to find a best response , to any , such that . To proceed with the reduction, we need an equivalent condition stated formally as follows.
For a generalized vector game , the following to conditions are equivalent:
Blackwell’s theorem asserts that if and only if is approachable. Using Sion’s generalization to the Von Neumann minimax theorem from chapter 8,
Thus, the second statement of the lemma is satisfied if and only if .
As mentioned previously, the necessity of Blackwell’s condition is left as an exercise. To prove sufficiency, we assume that form (2) of Blackwell’s condition as in Lemma 13.6 is satisfied. Formally, we henceforth assume that the vector game and set are equipped with a best response oracle , such that
We proceed with the formal proof of sufficiency, constructively specified in Algorithm 37. Notice that in this reduction, the functions are concave, and the OCO algorithm is used for maximization.
Algorithm 37, with input OCO algorithm , returns the vector that approaches the set at a rate of
Notice that equation (13.2) implies that for as defined in the algorithm, we have
This theorem explicitly relates OCO with approachability, and since we have already proved the existence of efficient OCO algorithms in this text, it can be used to formally prove Blackwell’s theorem. Completing the details is left as an exercise.
3 From Approachability to Online Convex Optimization
In this subsection we show the converse reduction: given an approachability algorithm, we design an OCO algorithm with no loss of computational efficiency. This direction was essentially shown by Blackwell for discrete decision problems, as described in more detail in the bibliographic section. We prove it here in the full generality of OCO.
Formally, given an approachability algorithm , denote by an upper bound on its rate of convergence to the set as a function of the number of iterations . That is, for a given vector game, denote by the average reward vector. Then guarantees
Given an approachability algorithm , we henceforth create an OCO algorithm with vanishing regret.
Approachability is in a certain geometric sense a dual to OCO. To see this, we require several geometric notions, that are explicitly required for the reduction from approachability to OCO.
It is left as an exercise to prove that is a convex set, and that for cones, the polar to the polar is the original set.
That is, we take all points in the polar set to the direct sum .
This definition of the polar set gives rise to the following quantitative characterization.
3.2 The reduction
Algorithm 38 takes as an input a Blackwell approachability algorithm that guarantees, under the necessary and sufficient condition, convergence to a given set. It also takes as an input a set for OCO.
The reduction considers a vector game with decision sets and approachability set , and generates a sequence of decisions that guarantee low regret as we prove next.
Since this reduction creates the approachability set as a function of , we need to prove that indeed the set is approachable. We show this in the next subsection.
The reduction defined in Algorithm 38, for any input algorithm , produces an OLO algorithm such that
The approachability algorithm guarantees . Using the definition of and Lemma 13.8 we have
3.3 Existence of a best response oracle
Notice that the reduction of this section from approachability to OCO does not require the best response oracle. However, Blackwell’s approachability theorem does require this oracle as sufficient and necessary, and thus for the set we constructed to be approachable at all, such an oracle needs to exist. This is what we show next.
Consider the vectors constructed in the reduction. A best response oracle finds, for every vector , a vector that guarantees . In our case, this translates to the condition
In other words, the best response oracle corresponds to a procedure that given , finds a vector such that
This is an optimization oracle for the set !
4 Bibliographic Remarks
David Blackwell’s celebrated Approachability Theorem was published in (Blackwell, 1956). The first no-regret algorithm for a discrete action setting was given in a seminal paper by James Hannan in (Hannan, 1957) the next year. That same year, Blackwell pointed out (Blackwell, 1954) that his approachability result leads, as a special case, to an algorithm with essentially the same low-regret guarantee proven by Hannan. For Hannan’s account of events see (Gilliland et al., 2010).
Over the years several other problems have been reduced to Blackwell approachability, including asymptotic calibration (Foster and Vohra, 1998), online learning with global cost functions (Even-Dar et al., 2009) and more (Mannor and Shimkin, 2008). Indeed, it has been presumed that approachability, while establishing the existence of a no-regret algorithm, is strictly more powerful than regret-minimization; hence its utility in such a wide range of problems.
However, this was recently shown not to be the case. Abernethy et al. (2011) showed that approachability is in fact equivalent to OCO. This result is the basis of the material presented in this chapter. One side of their reduction was simplified and generalized in (Shimkin, 2016).
5 Exercises
1. Prove that Von Neumann’s theorem does not hold for vector games, i.e., give an example of a vector game such that there is no single mixed strategy that ensures the vector payoff lies in a given set. Show that this is true even for approachable sets.
3. Prove that Blackwell’s condition is necessary, i.e., prove that for a set to be approachable in a given vector game, there must exist an oracle such that