A New Understanding of Prediction Markets Via No-Regret Learning

We explore the striking mathematical connections that exist between market scoring rules, cost function based prediction markets, and no-regret learning. We show that any cost function based prediction market can be interpreted as an algorithm for the commonly studied problem of learning from expert advice by equating trades made in the market with losses observed by the learning algorithm. If the loss of the market organizer is bounded, this bound can be used to derive an O(sqrt(T)) regret bound for the corresponding learning algorithm. We then show that the class of markets with convex cost functions exactly corresponds to the class of Follow the Regularized Leader learning algorithms, with the choice of a cost function in the market corresponding to the choice of a regularizer in the learning problem. Finally, we show an equivalence between market scoring rules and prediction markets with convex cost functions. This implies that market scoring rules can also be interpreted naturally as Follow the Regularized Leader algorithms, and may be of independent interest. These connections provide new insight into how it is that commonly studied markets, such as the Logarithmic Market Scoring Rule, can aggregate opinions into accurate estimates of the likelihood of future events.


INTRODUCTION
Imagine you are interested in learning an accurate estimate of the probability that the United States unemployment rate for a particular month will fall below 10%. You could choose to spend hours digging through news articles, reading financial reports, and weighing various opinions against each other, eventually coming up with a reasonably informed estimate. However, you could potentially save yourself a lot of hassle (and obtain a better estimate!) by appealing to the wisdom of crowds.
A prediction market is a financial market designed for information aggregation. For example, in a cost function based prediction market [5], the organizer (or market maker ) trades a set of securities corresponding to each potential outcome of an event. The market maker might offer a security that pays $1 if and only if the United States unemployment rate for January 2010 is above 10%. A risk neutral trader who believes that the true probability that the unemployment rate will be above 10% is p should be willing to buy a share of this security at any price below $p. Similarly, he should be willing to sell a share of this security at any price above $p. For this reason, the current market price of this security can be viewed as the population's collective estimate of how likely it is that the unemployment rate will be above 10%.
These estimates have proved quite accurate in practice in a wide variety of domains. (See Ledyard et al. [27] for an impressive assortment of examples.) The theory of rational expectations equilibria offers some insight into why prediction markets in general should converge to accurate prices, but is plagued by strong assumptions and no-trade theorems [31]. Furthermore, this theory says nothing of why particular prediction market mechanisms, such as Hanson's increasingly popular Logarithmic Market Scoring Rule (LMSR) [15,16], might produce more accurate estimates than others in practice. In this work, we aim to provide additional insight into the learning power of particular market mechanisms by highlighting the deep mathematical connections between prediction markets and no-regret learning.
It should come as no surprise that there is a connection between prediction markets and learning. The theories of markets and learning are built upon many of the same fundamental concepts, such as proper scoring rules (called proper losses in the learning community) and Bregman divergences. To our knowledge, Chen et al. [6] were the first to formally demonstrate a connection, showing that the standard Randomized Weighted Majority regret bound [9] can be used as a starting point to rederive the well-known bound on the worst-case loss of a LMSR marker maker. (They went on to show that PermELearn, an extension of Weighted Majority to permutation learning [20], can be used to efficiently run LMSR over combinatorial outcome spaces for betting on rankings.) As we show in Section 4, the converse is also true; the Weighted Majority regret bound can be derived directly from the bound on the worst-case loss of a market maker using LMSR. However, the connection goes much deeper.
In Section 4, we show how any cost function based prediction market with bounded loss can be interpreted as a no-regret learning algorithm. Furthermore, if the loss of the market maker is bounded, this bound can be used to derive an O( √ T ) regret bound for the corresponding learning algorithm. The key ides is to view the trades made in the market as losses observed by the learning algorithm. We can then think of the market maker as learning a probability distribution over outcomes by treating each observed trade as a training instance.
In Section 5, we go on to show that the class of convex cost function based markets exactly corresponds to the class of Follow the Regularized Leader learning algorithms [34,18,17] in which weights are chosen at each time step to minimize a combination of empirical loss and a convex regularization term. This allows us to interpret the se-lection of a cost function for the market as the selection of a regularizer for the learning problem. Furthermore, we prove an equivalence between another common class of prediction markets, market scoring rules, and convex cost function based markets, 1 which immediately implies that market scoring rules can be interpreted as Follow the Regularized Leader algorithms too. These connections provide insight into why it is that prediction markets tend to yield such accurate estimates in practice.
Before describing our results in more detail, we review the relevant concepts and results from the literature on prediction markets and no-regret learning in Sections 2 and 3.

PREDICTION MARKETS
In recent years, a variety of compelling prediction market mechanisms have been proposed and studied, including standard call market mechanisms and Pennock's dynamic parimutuel markets [30]. In this work we focus on two broad classes of mechanisms: Hanson's market scoring rules [15,16] and cost function based prediction markets as described in Chen and Pennock [5]. We also briefly discuss the related class of Sequential Convex Parimutuel Mechanisms [1] in Section 5.4.

Market Scoring Rules
Scoring rules have long been used in the evaluation of probabilistic forecasts. In the context of prediction markets and elicitation, scoring rules are used to encourage individuals to make careful assessments and truthfully report their beliefs [33,11,26]. In the context of machine learning, scoring rules are used as loss functions to evaluate and compare the performance of different algorithms [3,32].
Formally, let {1, · · · , N } be a set of mutually exclusive and exhaustive outcomes of a future event. A scoring rule s maps a probability distribution p to a score si( p) for each outcome i, with si( p) taking values in the extended real line [−∞, ∞]. Intuitively, this score represents the reward of a forecaster might receive for predicting the distribution p if the outcome turns out to be i. A scoring rule is said to be regular relative to the probability simplex . This implies that si( p) is finite whenever pi > 0. A scoring rule is said to be proper if a risk-neutral forecaster who believes the true distribution over outcomes to be p has no incentive to report any alternate distribution p ′ , that is, if The rule is strictly proper if this inequality holds with equality only when p = p ′ .
Two examples of regular, strictly proper scoring rules commonly used in both elicitation and in machine learning are the the quadratic scoring rule [2]: and the logarithmic scoring rule [13]: with arbitrary parameters a1, · · · , aN and parameter b > 0. The uses and properties of scoring rules are too extensive 1 A similar but weaker correspondence between market scoring rules and cost function based markets was discussed in Chen and Pennock [5] and Agrawal et al. [1].
to cover in detail here. For a nice survey, see Gneiting and Raftery [12]. Market scoring rules were developed by Hanson [15,16] as a method of using scoring rules to pool opinions from many different forecasters. Market scoring rules are sequentially shared scoring rules. Formally, the market maintains a current probability distribution p. At any time, a trader can enter the market and change this distribution to an arbitrary distribution p ′ of her choice. 2 If the outcome turns out to be i, she receives a (possibly negative) payoff of si( p ′ ) − si( p). For example, in the popular Logarithmic Market Scoring Rule (LMSR), which is based on the logarithmic scoring rule in Equation 2, a trader who changes the distribution from p to p ′ receives a payoff of b log(p ′ i /pi). Since the trader has no control over p, a myopic trader who believes the true distribution to be r maximizes her expected payoff by maximizing i risi( p ′ ). Thus if s is a strictly proper scoring rule, traders have an incentive to change the market's distribution to match their true beliefs. The idea is that if traders update their own beliefs over time based on market activity, the market's distribution should eventually converge to the collective beliefs of the population.
Each trader in a market scoring rule is essentially responsible for paying the previous trader's score. Thus the market maker is responsible only for paying the score of the final trader. Let p0 be the initial probability distribution of the market. The worst case loss of the market maker is then The worst case loss of the market maker running an LMSR initialized to the uniform distribution is b log N .
Note that the parameters a1, · · · , aN of the logarithmic scoring rule do not affect either the payoff of traders or the loss of the market maker in the LMSR. For simplicity, in the remainder of this paper when discussing the LMSR we assume that ai = 0 for all i.

Cost Function Based Markets
As before, let {1, · · · , N } be a set of mutually exclusive and exhaustive outcomes of an event. In a cost function based market, a market maker offers a security corresponding to each outcome i. The security associated with outcome i pays off $1 if i happens, and $0 otherwise. 3 Different mechanisms can be used to determine how these securities are priced. Each mechanism is specified using a differentiable cost function C : R N → R. This cost function is simply a potential function describing the amount of money currently wagered in the market as a function of the quantity of shares purchased. If qi is the number of shares of security i currently held by traders, and a trader would like to purchase ri shares of each security (where ri could be zero or even negative, representing the sale of shares), the trader must pay C( q + r) − C( q) to the market maker. The instantaneous price of security i (that is, the price per share of an infinitely small number of shares) is then pi = ∂C( q)/∂qi.
We say that a cost function is valid if the associated prices satisfy two simple conditions: 1. For every i ∈ {1, · · · , N } and every q ∈ R N , pi( q) ≥ 0.
2. For every q ∈ R N , N i=1 pi( q) = 1 . The first condition ensures that the price of a security is never negative. If the current price of the security associated with an outcome i were negative, a trader could purchase shares of this security at a guaranteed profit. The second condition ensures that the prices of all securities sum to 1. If the prices summed to something less than (respectively, greater than) 1, then a trader could purchase (respectively, sell) small equal quantities of each security for a guaranteed profit. Together, these conditions ensure that there are no arbitrage opportunities in the market.
These conditions also ensure that the current prices can always be viewed as a valid probability distribution over the outcome space. In fact, these prices represent the market's current estimate of the probability that outcome i will occur.
The following theorem gives sufficient and necessary conditions for the cost function C to be valid. While these properties of cost functions have been discussed elsewhere [5,1], the fact that they are both sufficient and necessary for any valid cost function C is important for our later analysis. As such, we state the full proof here for completeness. The partial derivatives ∂C( q)/∂qi exist for all q ∈ R N and i ∈ {1, . . . , N }.

Positive Translation Invariance:
For any q and any constant k, C( q + k 1) = C( q) + k.
Proof. Differentiability is necessary and sufficient for the price functions to be well-defined at all points. It is easy to see that requiring the cost function to be monotonic is equivalent to requiring that pi( q) ≥ 0 for all i and q. We will show that requiring positive translation invariance is equivalent to requiring that the prices always sum to one. First, assume that N i=1 pi( q) = 1 for all q. For any fixed value of q, define u = u(a) = q + a 1 and let ui be the ith component of u. Then for any k, This is precisely translation invariance. Now assume instead that positive translation invariance holds. Fix any arbitrary q ′ and k and define q = q ′ + k 1. Notice that by setting q ′ and k appropriately, we can make q take on any arbitrary values. We have, pi( q).
One quantity that is useful for comparing different market mechanisms is the worst-case loss of the market maker, This is simply the difference between the maximum amount that the market maker might have to pay the winners and the amount of money collected by the market maker.
The Logarithmic Market Scoring Rule described above can be specified as a cost function based prediction market [15,5]. Then cost function of the LMSR is and the corresponding prices are This formulation is equivalent to the market scoring rule formulation in the sense that a trader who changes the market probabilities from r to r ′ in the MSR formulation receives the same payoff for every outcome i as a trader who changes the quantity vectors from any q to q ′ such that p( q) = r and p( q ′ ) = r ′ in the cost function formulation.

LEARNING FROM EXPERT ADVICE
We now briefly review the problem of learning from expert advice. In this framework, an algorithm makes a sequence of predictions based on the advice of a set of N experts and receives a corresponding sequence of losses. 4 The goal of the algorithm is to achieve a cumulative loss that is "almost as low" as the cumulative loss of the best performing expert in hindsight. No statistical assumptions are made about these losses. Indeed, algorithms are expected to perform well even if the sequence of losses is chosen by an adversary.
Formally, at every time step t ∈ {1, · · · , T }, every expert i ∈ {1, · · · , N } receives a loss ℓi,t ∈ [0, 1]. The cumulative loss of expert i at time T is then defined as Li,T = T t=1 ℓi,t. An algorithm A maintains a weight wi,t for each expert i at time t, where n i=1 wi,t = 1. These weights can be viewed as a distribution over the experts. The algorithm then receives its own instantaneous loss ℓA,t = n i=1 wi,tℓi,t, which can be interpreted as the expected loss the algorithm would receive if it always chose an expert to follow according to the current distribution. The cumulative loss of A up to time T is defined in the natural way as wi,tℓi,t. It is unreasonable to expect the algorithm to achieve a small cumulative loss if none of the experts perform well. As such, it is typical to measure the performance of an algorithm in terms of its regret, defined to be the difference between the cumulative loss of the algorithm and the loss of the best performing expert, that is, An algorithm is said to have no regret if the average per time step regret approaches 0 as T approaches infinity.
The popular Randomized Weighted Majority (WM) algorithm [28,9] is an example of a no-regret algorithm. Weighted Majority uses weights where η > 0 is a tunable parameter known as the learning rate. It is well known that the regret of WM after T trials can be bounded as When T is known in advance, It has been shown that the weights chosen by Weighted Majority are precisely those that minimize a combination of empirical loss and an entropic regularization term [24,25,20]. More specifically, the weights at time t are precisely those that minimize among all w ∈ ∆N , where H is the entropy. This makes Weighted Majority an example of broader class of algorithms collectively known as Follow the Regularized Leader algorithms [34,18,17]. This class of algorithms grew out of the following fundamental insight of Kalai and Vempala [22]. Consider first the aptly named Follow the Leader algorithm, which chooses weights at time t to minimize N i=1 wi,tLi,t−1. This algorithm simply places all of its weight on the single expert (or set of experts) with the best performance on previous examples. As such, this algorithm can be highly unstable, dramatically changing its weights from one time step to the next. It is easy to see that Follow the Leader suffers Ω(T ) regret in the worst case when the best expert changes frequently. For example, if there are only two experts with losses starting at 1/2, 0 and then alternating 0, 1 , 1, 0 , 0, 1 , 1, 0 , · · · , then FTL places a weight of 1 on the losing expert at every point in time.
To overcome this instability, Kalai and Vempala [22] suggested adding a random perturbation to the empirical loss of each expert, and choosing the expert that minimizes this perturbed loss. 5 However, in general this perturbation need not be random. Instead of adding a random perturbation, it is possible to gain the necessary stability by adding a regularizer R and choosing weights to minimize This Follow the Regularized Leader (FTRL) approach gets around the instability of FTL and guarantees low regret for a wide variety of regularizers, as evidenced by the following bound of Hazan and Kale [18].
Lemma 1 (Hazan and Kale [18]). For any regularizer R, the regret of FTRL can be bounded as This lemma quantifies the trade-off that must be considered when choosing a regularizer. If the range of the regularizer is too small, the weights will change dramatically from one round to the next, and the first term in the bound will be large. On the other hand, if the range of the regularizer is too big, the weights that are chosen will be too far from the true loss minimizers and the second term will blow up.
It is generally assumed that the regularizer R is strictly convex. This assumption ensures that Equation 3 has a unique minimizer and that this minimizer can be computed efficiently. Hazan [17] shows that if R is strictly convex then it is possible to achieve a regret of O( √ T ). In particular, by optimizing η appropriately the regret bound in Lemma 1 can be upper bounded by

INTERPRETING PREDICTION MAR-KETS AS NO-REGRET LEARNERS
With this foundation in place, we are ready to describe how any bounded loss market maker can be interpreted as an algorithm for learning from expert advice. The key idea is to equate the trades made in the market with the losses observed by the learning algorithm. We can then view the market maker as essentially learning a probability distribution over outcomes by treating each observed trade as a training instance.
More formally, consider any cost function based market maker with instantaneous price functions pi for each outcome i. We convert such a market maker to an algorithm for learning from expert advice by setting the weight of expert i at time t using where ǫ > 0 is a tunable parameter and Lt−1 = L1,t−1, · · · , LN,t−1 is the vector of cumulative losses at time t−1. In other words, the weight on expert i at time t in the learning algorithm is the instantaneous price of security i in the market when −ǫLj,t−1 shares have been purchased (or ǫLj,t−1 shares have been sold) of each security j. We discuss the role of the parameter ǫ in more detail below. First note that for any valid cost function based prediction market, setting the weights as in Equation 5 entails valid expert learning algorithm. Since the prices of any valid prediction market must be non-negative and sum to one, the weights of the resulting algorithm are guaranteed to satisfy these properties too. Furthermore, the weights are a function of only the past losses of each expert, which the algorithm is permitted to observe.
Below we show that applying this conversion to any bounded-loss market maker with slowly changing prices yields a learning algorithm with O( √ T ) regret. The quality of the regret bound obtained depends on the trade-off between market maker loss and how quickly the prices change. We then show how this bound can be used to rederive the standard regret bound of Weighted Majority, the converse of the result of Chen et al. [6].

A Bound on Regret
In order to derive a regret bound for the learning algorithm defined in Equation 5, it is necessary to make some restrictions on how quickly the prices in the market change. If market prices change too quickly, the resulting learning algorithm will be unstable and will suffer high worst-case regret, as was the case with the naive Follow The Leader algorithm described in Section 3. To capture this idea, we introduce the notion of φ-stability, defined as follows.
Definition 1. We say that a set of price functions p is φ-stable for a constant φ if pi is continuous and piecewise differentiable for all i ∈ {1, · · · , N } and Defining φ-stability in terms of the Di,j allows us to quantify how slowly the prices change even when the price functions are not differentiable at all points. We can then derive a regret bound for the resulting learning algorithm using the following simple lemma. This lemma states that when the quantity vector in the market is q, if the price functions are φ-stable, then the amount of money that the market maker would collect for the purchase of a small quantity ri of each security i is not too far from the amount that the market maker would have collected had he instead priced the shares according to the fixed price p( q).
Lemma 2. Let C be any valid cost function yielding φstable prices. For any ǫ > 0, any q ∈ R N , and any r ∈ R N such that |ri| ≤ ǫ for i ∈ {1, · · · , N }, The proof is in Appendix A.
With this lemma in place, we are ready to derive the regret bound. In the following theorem, it is assumed that T is known a priori and therefore can be used to set ǫ. If T is not known in advance, a standard "doubling trick" can be applied [4]. The idea behind the doubling trick is to partition time into periods of exponentially increasing length, restarting the algorithm each period. This leads to similar bounds with only an extra factor of log(T ).
Theorem 2. Let C be any valid cost function yielding φstable prices. Let B be a bound on the worst-case loss of the market maker mechanism associated with C. Let A be the expert learning algorithm with weights as in Equation 5 with ǫ = 2B/(φT ). Then for any sequence of expert losses ℓi,t ∈ [0, 1] over T time steps, Proof. By setting the weights as in Equation 5, we are essentially simulating a market over N outcomes. Let ri,t denote the number of shares of outcome i purchased at time step t in this simulated market, and denote by rt the vector of these quantities for all i. Note that ri,t is completely in our control since we are simply simulating a market, thus we can choose to set ri,t = −ǫℓi,t for all i and t. We have that ri,t ∈ [−ǫ, 0] for all i and t since ℓi,t ∈ [0, 1]. Let qi,t = t t ′ =1 r i,t ′ be the total number of outstanding shares of security i after time t, with qt denoting the vector over all i. The weight assigned to expert i at round t of the learning algorithm corresponds to the instantaneous price of security i in the simulated market immediately before round t, that is, wi,t = pi(−ǫ Lt−1) = pi( qt−1).
By the definition of worst-case market maker loss, maxi qi,t − (C( qt) − C( 0)) ≤ B. It is easy to see that we can rewrite the left-hand side of this equation to obtain max i∈{1,··· ,N} From Lemma 2, this gives us that Substituting pi( qt−1) = wi,t and ri,t = −ǫℓi,t, we get Setting ǫ = 2B/(φT ) yields the bound.

Rederiving the Weighted Majority Bound
Chen et al. [6] showed that the Weighted Majority regret bound can be used as a starting point to rederive the worst case loss of b log N of an LMSR market maker. Here we show that the converse is also true; by applying Theorem 2, we can rederive the Weighted Majority bound from the bounded market maker loss of LMSR.
In order to apply Theorem 2, we must provide a bound on how quickly LMSR prices can change. This is given in the following lemma, the proof of which is in Appendix B.
Lemma 3. Let p be the pricing function of a LMSR with parameter b > 0. Then Using Equation 5 to transform the LMSR into a learning algorithm, we end up with weights Setting ǫ = 2B/(φT ) = b log N/T , we see that these weights are equivalent to those used by Weighted Majority with the learning rate η = ǫ/b = log N/T . As mentioned above, this is the optimal setting of η. Notice that these weights do not depend on the value of the parameter b in the prediction market.
We can now apply Theorem 2 to rederive the standard Weighted Majority regret bound stated in Section 3. In particular, setting B = b log N and φ = 2/b, we get that when η = log(N )/T ,

CONNECTIONS BETWEEN MARKET SCORING RULES, COST FUNCTIONS, AND REGULARIZATION
In this section, we establish the formal connections among market scoring rules, cost function based markets, and the class of Follow the Regularized Leaders algorithms. We start with a representation theorem for cost function based markets, which is crucial in our later analysis.

A Representation Theorem for Convex Cost Functions
In this section we show a representation theorem for convex cost functions. The proof of this theorem relies on the connection between convex cost functions and a class of functions known in the finance literature as convex risk measures, which was first noted by Agrawal et al. [1]. Convex risk measures were originally introduced by Föllmer and Schied [8] to model different attitudes towards risk in financial markets. A risk measure ρ can be viewed as a mapping from a vector of returns (corresponding to each possible outcome of an event) to a real number. The interpretation is that a vector of returns x is "preferred to" the vector x ′ under a risk measure ρ if and only if ρ( x) < ρ( x ′ ).
Formally, a function ρ is a convex risk measure if it satisfies the following three properties: 1. Convexity: ρ( x) is a convex function of x.
The financial interpretations of these properties are not important in our setting. More interesting for us is that Föllmer and Schied [8] provide a representation theorem that states that a function ρ is a convex risk measure if and only if it can be represented as where α : ∆N → (−∞, ∞] is a convex, lower semicontinuous function referred to as a penalty function. This fact is useful because it allows us to obtain the following result, which was alluded to informally by Agrawal et al. [1]. The full proof is included here for completeness.

Lemma 4. A function C is a valid convex cost function if and only if it is differentiable and can be represented as
for a convex and lower semi-continuous function α. Furthermore, for any quantity vector q, the price vector p( q) corresponding to C is the distribution p maximizing N i=1 piqi − α( p).
Proof. Consider any differentiable function C : R N → R. Let ρ( q) = C(− q). Clearly by definition, ρ satisfies decreasing monotonicity if and only if C satisfies increasing monotonicity, and ρ satisfies negative translation invariance if and only if C satisfies positive translation invariance. Furthermore, ρ is convex if and only if C is convex. By Theorem 1, this implies that C is a valid convex cost function if and only if ρ is a convex risk measure. The first half of the lemma then follows immediately from the representation theorem of Föllmer and Schied [8].
Now, because α( p) is guaranteed to be convex, N i=1 piqi− α( p) is a concave function of p. The constraints N i=1 pi = 1 and pi ≥ 0 define a closed convex feasible set. Thus, the problem of maximizing N i=1 piqi − α( p) with respect to p has a global optimal solution and first-order KKT conditions are both necessary and sufficient. Let p * ( q) denote an optimal p for this optimization problem. Then, . By the envelope theorem [29], if C( q) is differentiable, we have that for any i, p * i ( q) = ∂C( q)/∂qi = pi( q). Thus the market prices are precisely those which maximize the inner expression of the cost function.
Furthermore, by a version of the envelope theorem [23], to ensure that C is differentiable, it is sufficient to show that α is strictly convex and differentiable. Corollary 1. A function C is a valid convex cost function if it can be represented as in Equation 6 for a strictly convex and differentiable function α. For any q, the price vector p( q) is the distribution p maximizing N i=1 piqi−α( p).
The ability to represent any valid cost function in this form allows us to define a bound on the worst-case loss of the market maker in terms of the penalty function of the corresponding convex risk measure.
Lemma 5. The worst-case loss of the market maker defined by the cost function in Equation 6 is no more than Proof. The worst-case loss of the market maker is The inequality follows from the fact that for any functions f and g over any domain

Convex Cost Functions and Market Scoring Rules
As described in Section 2, the Logarithmic Market Scoring Rule market maker can be defined as either a market scoring rule or a cost function based market. The LMSR is not unique in this regard. As we show in this section, any regular, strictly proper market scoring rule with differentiable scoring functions can be represented as a cost function based market. Likewise, any convex cost function satisfying a few mild conditions corresponds to a market scoring rule. As long as the market probabilities are nonzero, the market scoring rule and corresponding cost function based market are equivalent. More precisely, a trader who changes the market probabilities from r to r ′ in the market scoring rule is guaranteed to receive the same payoff for every outcome i as a trader who changes the quantity vectors from any q to q ′ such that p( q) = r and p( q ′ ) = r ′ in the cost function formulation as long as every component of r and r ′ is nonzero. Moreover, any price vector that is achievable in the market scoring rule (that is, any p for which si( p) is finite for all i) is achievable by the cost function based market.
The fact that there exists a correspondence between certain market scoring rules and certain cost function based markets was noted by Chen and Pennock [5]. They pointed out that the MSR with scoring function s and the cost function based market with cost function C are equivalent if for all q and all outcomes i, C( q) = qi − si( p). However, they did not provide any guarantees about the circumstances under which this condition can be satisfied. Agrawal et al. [1] also made use of the equivalence between markets when this strong condition holds. Our result gives very general precise conditions under which an MSR is equivalent to a cost function based market.
Recall from Lemma 4 that any convex cost function C can be represented as C( q) = sup p∈∆ N N i=1 piqi − α( p) for a convex function α. Let αC denote the function α corresponding to the cost function C. In the following, we con-sider cost functions derived from scoring rules s by setting and scoring rules derived from convex cost functions with We show that there is a mapping between a mildly restricted class of convex cost function based markets and a mildly restricted class of strictly proper market scoring rules such that for every pair in the mapping, Equations 7 and 8 both hold. Furthermore, we show that the markets satisfying these equations are equivalent in the sense described above.
Theorem 3. There is a one-to-one and onto mapping between the set of convex cost function based markets with strictly convex and differentiable potential functions αC and the class of strictly proper, regular market scoring rules with differentiable scoring functions s such that for each pair in the mapping, Equations 7 and 8 hold.
Furthermore, each pair of markets in this mapping are equivalent when prices for all outcomes are positive, that is, the profit of a trade is the same in the two markets if the trade starts with the same market prices and results in the same market prices and the prices for all outcomes are positive before and after the trade. Additionally, every price vector p achievable in the market scoring rule is achievable in the cost function based market.

Proof. We first show that the function αC in Equation 7
is strictly convex and differentiable and the scoring rule in Equation 8 is regular, strictly proper and differentiable. We then show that Equations 7 and 8 are equivalent. Finally, we show the equivalence between the two markets.
Consider the function αC in Equation 7. Since we have assumed that si is differentiable for all i, αC is differentiable too. Additionally, it is known that a scoring rule is strictly proper only if its expected value is strictly convex [12], so αC is strictly convex.
Consider the scoring rule defined in Equation 8. By Theorem 1 of Gneiting and Raftery [12], a regular scoring rule si( p) is strictly proper if and only if there exists a strictly convex function G( p) such that where Gj ( p) is any subderivative of G with respect to pj (if G is differentiable,Ġj = ∂G( p)/∂pj). This immediately implies that the scoring rule defined in Equation 8 is a regular strictly proper scoring rule since α( p) is strictly convex. We will see below that si is also differentiable.

It is easy to see that Equation 8 implies Equation 7. Suppose Equation 8 holds. Then
This also shows that si is differentiable for all i, since the derivative of αC is well-defined at all points and To see that Equation 7 implies Equation 8, suppose that Equation 7 holds. We know that the scoring rule s can be expressed as in Equation 9 for some function G. For this particular G, Since G( p) = αC ( p) and αC is differentiable (meaning that ∂αC /∂pi is the only subderivative of αC with respect to pi), this implies Equation 8.
We have established the equivalence between Equations 7 and 8. We now show that a trader gets exactly the same profit for any realized outcome in the two markets if the market prices are positive.
Suppose in the cost function based market a trader changes the outstanding shares from q to q ′ . This trade changes the market price from p( q) to p( q ′ ). If outcome i occurs, the trader's profit is pj( q)qj + αC ( p( q)) .
When pi( q) > 0 and pi( q ′ ) > 0, µi( q) = µi( q ′ ) = 0. In this case, the profit of the trader in the cost function based market is the same as that in the market scoring rule market when he changes the market probability from p( q) to p( q ′ ). Finally, observe that using the cost function based market it is possible to achieve any price vector r with finite scores si( r) by setting qi = si( r) for all i. By Lemma 4, for this setting of q, p( q) is the vector p that maximizes N i= pisi( r) − N i=1 pisi( p). Since s is strictly proper, this is maximized at p = r. Since s is regular, this implies that it is possible to achieve any prices in the interior of the probability simplex using the cost function based market (and any prices p on the exterior as long as si( p) is finite for all i).

Convex Cost Functions and FTRL
Consider a prediction market with a convex cost function represented as C( q) = sup p∈∆ N N i=1 piqi − α( p) and the corresponding learning algorithm with weights wi,t = pi(−ǫ Lt−1). (Recall that Lt−1 = L1,t−1, · · · , LN,t−1 is the vector of cumulative losses at time t − 1.) By Lemma 4, the weights chosen at time t are those that maximize the expression −ǫ N i=1 wiLi,t−1 − α( w), or equivalently, those that minimize the expression This expression is of precisely the same form as Equation 3, with α playing the role of the regularizer and ǫ controlling the trade-off between the regularizer and the empirical loss. This implies that every convex cost function based prediction market can be interpreted as a Follow the Regularized Leader algorithm with a convex regularizer! By applying Theorem 2 and Lemma 5, we can easily bound the regret of the resulting algorithm as follows.
Theorem 4. Let C be any valid convex cost function yielding φ-stable prices, and let αC be the penalty function associated with C.
Let A be the expert learning algorithm with weights as in Equation 5 with ǫ = 2 sup p, p ′ ∈∆ N (αC ( p) − αC ( p ′ ))/(φT ). Then for any sequence of expert losses ℓi,t ∈ [0, 1] over T time steps, This bound is very similar to the bound for FTRL given in Equation 4, with φ playing the role of λ. The connections we established in the previous section imply that every strictly proper market scoring rule can also be interpreted as a FTRL algorithm, now with a strictly convex regularizer. Conversely, any FTRL algorithm with a differentiable and strictly convex regularizer can be viewed as choosing weights at time t to minimize the quantity N i=1 wi (ǫLi,t−1 + si( w)) for a strictly proper scoring rule s. Perhaps it is no surprise that the weight updates of FTRL algorithms can be framed in terms of proper scoring rules given that proper scoring rules are commonly used as loss functions in machine learning [3,32] and FTRL has previously been connected to Bregman divergences [34,18,17] which are known to be related to scoring rules [12].
This connection hints at why market scoring rules and convex cost function based markets may be able to obtain accurate estimates of probability distributions in practice. Both types of markets are essentially learning the distributions by treating market trades as training data. Beyond that, both markets correspond to well-understood learning algorithms with stable weights and guarantees of no regret.

Relation to the SCPM
Agrawal et al. [1] present another way of describing convex cost function based prediction markets, which they call the Sequential Convex Pari-Mutuel Mechanism (SCPM). The SCPM is defined in terms of limit orders instead of market prices, but the underlying mathematics are essentially the same. In the SCPM, traders specify a maximum quantity of shares that they would like to purchase and a maximum price per share that they are willing to spend. The market then decides how many shares of the trade to accept by solving a convex optimization problem.
Agrawal et al. [1] show that for every SCPM, there is an equivalent convex cost function based market. For each limit order, the number of shares accepted by the market maker in the SCPM is the minimum of the number of shares requested by the trader and the number of shares that it would take to drive the market price of the shares in the corresponding cost function based market to the limit price of the trader. Thus our results imply that any SCPM mechanism can also be interpreted as a Follow the Regularized Leader algorithm for learning from expert advice.
We remark that Agrawal et al. [1] also describe an interpretation of the SCPM in terms of convex risk measures and suggest that the associated penalty function is related to the underlying problem of learning the distribution over outcomes. However, their interpretation is very different from ours. They view the penalty function as characterizing "the market maker's commitment to learning the true distribution" since it impacts both the worst case market maker loss and the willingness of the market maker to accept limit orders. On the contrary, we view the penalty function as a regularizer necessary to make the market prices stable.

EXAMPLE: THE QUADRATIC MSR AND ONLINE GRADIENT DESCENT
In the previous section we described the relationship between market scoring rules, cost function based markets with convex cost functions, and Follow the Regularized Leader algorithms. We discussed how the Logarithmic Market Scoring Rule can be represented equivalently as a cost function based market, and how it corresponds to Weighted Majority in the expert learning setting. In this section, we illustrate the relationship through another example. In particular, we show that the Quadratic Market Scoring Rule can be written equivalently as a cost function based market (namely the Quad-SCPM of Agrawal et al. [1]). We then show that this market corresponds to the well-studied online gradient descent algorithm in the learning setting and give a bound on the regret of this algorithm using Theorem 4.
The Quadratic Market Scoring Rule (QMSR) is the mar-ket scoring rule corresponding to the quadratic scoring function in Equation 1. As was the case in the LMSR, the parameters a1, · · · , aN do not affect the prices or payments of this market. As such, we assume that ai = 0 for all i. Theorem 3 implies that we can construct a cost function based market with equivalent payoffs to the QMSR whenever prices are nonzero using the cost function This is precisely the cost function associated with the Quad-SCPM market with a uniform prior, which was previously known to be equivalent to the QMSR when prices are nonzero [1]. The worst case loss of the market maker in both markets is b(N − 1)/N .
Following the argument in Section 5.3, this market corresponds to the FTRL algorithm with regularizer η = 1/b and i . It has been observed that using FTRL with a regularizer of this form is equivalent to online gradient descent [19,17]. Thus we can use Theorem 4 to show a regret bound for gradient descent.

DISCUSSION
We have demonstrated the elegant mathematical connection between market scoring rules, cost function based prediction markets, and no-regret learning. This connection is thought-provoking on its own, as it yields to new interpretations of well-known prediction market mechanisms. The interpretation of the penalty function as a regularizer can shed some light on which market scoring rule or cost function based market is best to run under different assumptions about traders.
Additionally, this connection has the potential to be of use in the design of new prediction market mechanisms and learning algorithms. In recent years there has been an interest in finding ways to tractably run market scoring rules over combinatorial or infinite outcome spaces [7,10,6]. For example, a market maker might wish to accept bets over permutations ("horse A will finish the race ahead of horse B"), Boolean spaces ("either a Democrat will win the 2010 senate race in Delaware or a Democrat will win in North Dakota"), or real numbers ("Google's revenue in the first quarter of 2010 will be between $x and $y"), in which case simply running a naive implementation of an LMSR (for example) would be infeasible. As mentioned above, by exploiting the connection between Weighted Majority and the LMSR, Chen et al. [6] showed that an extension of the Weighted Majority algorithm to permutation learning [20] could be used to approximate prices in an LMSR over per-mutations. Given our new understanding of the connection between markets and learning and the growing literature on no-regret algorithms for large or infinite sets of experts [21], it seems likely that similar learning-based techniques could be developed to calculate market prices for other types of large outcome spaces too.

A. PROOF OF LEMMA 2
Fix the vectors q and r. Let u(s) = q + s r. Similarly to how we have defined Di,j ( t), define ∂s is defined at x, 0 otherwise.
Using Di in place of the derivative allows us to integrate over the derivative even when it is not defined at single points. For any point at which the derivatives are defined, we have pi( u(·))ri .
Applying the fundamental theorem of calculus, we have that Rearranging terms, this gives us that To prove the lemma, it is sufficient to bound the absolute value of the expression on the right. This is where the φstability of the prices comes into play. At any point where the derivatives are defined, Since we have assumed that the prices are piecewise differentiable this implies that This bounds the absolute value of the right hand side of the equation above and proves the lemma.

B. PROOF OF LEMMA 3
For every i and every j = i, we have and ∂pi( q) ∂qj = ∂ ∂qj Thus we have We would like to find the prices that maximize this quantity. Dropping the argument q to simply notation, this is equivalent to solving a simple optimization problem: It is straight-forward to show (e.g., using the KKT conditions) that this expression is maximized when the prices are equal across all securities, so pi = 1/N for all i. Then

C. STABILITY OF QUAD-SCPM PRICES
The cost function of Quad-SCPM can be written as By Lemma 4, the price function of Quad-SCPM is defined by the optimal solution to the optimization problem in this function. The Lagrange function corresponding to the constrained optimization problem is µipi.
Because the objective function is strictly concave in p, there is a unique optimal solution that satisfies the KKT conditions: ∂L/∂pi = 0 ∀i, N i=1 pi = 1, pi ≥ 0 ∀i, µi ≥ 0 ∀i, and µipi = 0 ∀i. Thus, the price function is defined by When 1/N + qi/(2b) − N i=1 qi/(2bN ) > 0, µi = 0 and pi > 0 for all i and the price function is which is the same as that of QMSR. In this case, we have ∀i and ∂pi ∂qj = − 1 2bN ∀j = i .
Consider the case in which the prices for some outcomes equal 0. Given q, let M = {m : pm > 0, µm = 0} be the set of outcomes that have positive prices. Let K = {k : p k = 0, µ k > 0} be the set of the outcomes that have a positive µ k . Let L = {l : p l = 0, µ l = 0} be the set of outcomes for which both p l and µ l are 0. Denotep = minm∈M pm and µ = min k∈K µ k . For 0 < |ǫ| < min{μ, 2bp(N − |K| − |L|)}, we consider the following cases: • L = ∅ and i ∈ M Consider changing q to q ′ , where q ′ i = qi + ǫ and q ′ j = qj ∀j = i. We can verify that the price function for q ′ is defined by • L = ∅ and i ∈ M Consider changing q to q ′ , where q ′ i = qi + ǫ and q ′ j = qj ∀j = i. The new prices are defined by ∀j ∈ M, j = i p ′ k = p k = 0 ∀k ∈ K p ′ l = p l = 0 ∀l ∈ L µ ′ j = µj = 0 ∀j ∈ M µ ′ k = µ k + ǫ N−|K|−|L| ∀k ∈ K µ ′ l = µ l + ǫ N−|K|−|L| ∀l ∈ L if ǫ > 0, and From the above, we can see that the prices of all outcomes are continuous while we changing qi in its ǫneighborhood. However, ∂pi/∂qi, ∂pj/∂qi, and ∂p l /∂qi are not defined at q for all i, j ∈ M , i = j, and l ∈ L, because the left and right derivatives do not equal. We only have ∂p k /∂qi = 0 for all k ∈ K and i ∈ M . • L = ∅, l ∈ L When changing q to q ′ , where q ′ l = q l + ǫ and q ′ j = qj ∀j = l, similar to the above case, the new optimal solution is different for ǫ > 0 and ǫ < 0. In particular, when ǫ > 0, )ǫ, ∀j ∈ M ∪ L such that j = l, and p ′ k = p k = 0 ∀k ∈ K. When ǫ < 0, p ′ j = pj ∀j, µ ′ l = µ l − ǫ, and µ ′ j = µj ∀j = k. We can see that the prices of all outcomes are continuous while we changing q l in its ǫ-neighborhood. But ∂p l /∂q l and ∂pj/∂q l are not defined at q for all j ∈ M ∪ L, j = l, and l ∈ L, because the left and right derivatives do not equal. ∂p k /∂q l = 0 for all k ∈ K and l ∈ L.
• k ∈ K Consider changing q to q ′ , where q ′ k = q k + ǫ and q ′ j = qj ∀j = k, the new prices are defined by p ′ j = pj ∀j, µ ′ k = µ k − ǫ, and µ ′ j = µj ∀j = k. Thus, we have ∂p k /∂q k = 0 ∀k ∈ K, ∂pj/∂q k = 0 ∀k, j ∈ K, and ∂pj/∂q k = 0 ∀j ∈ M, k ∈ K. The above shows that the price functions are continuous everywhere, but not differentiable everywhere. In particular, when L is not empty (i.e., given q there exists some outcome i such that both pi( q) and µi( q) are zero), some of the partial derivatives are not defined at q. This corresponds to the second and third cases shown above. We further note that in these two cases, for any i ∈ M and l ∈ L, any change in qi or q l will cause the set of L to become empty, because either p l or µ l will become positive for all l ∈ L. This means that the prices are differentiable almost everywhere, with the only exceptions at finite number of points when L = ∅.