Introduction
A deployed machine learning model is typically only reliable when the data distribution it was trained on is consistent with the distribution it currently sees. In reality, this consistency can break in many ways: a hospital replaces an imaging scanner, a camera lens degrades, or the questions a user asks a large language model evolve over time. Labels usually arrive late or not at all, so the resulting drop in accuracy can go unnoticed for a long time. Monitoring the inputs for distribution shift gives an early warning, which can trigger model retraining, additional data collection, or human review. A common approach is to monitor a scalar score of each incoming input, such as the confidence of a classifier [14 ] or the likelihood under a density model [34 ] , and to raise an alarm once the scores no longer resemble those of in-distribution data. In particular, a useful monitor should meet at least two key requirements. First, false alarms must stay minimal no matter how long the monitor runs, so the probability of rejecting a true null should be anytime valid . Second, shifts rarely happen at the start of deployment; a model usually operates normally for a long and unknown period before, say, a sensor degrades or incoming images become corrupted. So, a good monitor should detect a shift quickly , whenever it happens.
The framework of testing by betting [37 , 33 ] allows one to design algorithms that meet the first requirement by construction. In this framework, a gambler starts with unit wealth and repeatedly places bets that are fair under the null hypothesis of no shift, and statistical evidence for distribution shift is accumulated by the wealth process. As no bet is favorable under the null, the wealth is a nonnegative supermartingale, and by Ville’s inequality [44 ] it exceeds level 1 / α 1/\alpha 1/ α at any time with probability at most α \alpha α . Conformal test martingales (CTMs) [48 ] (Vovk 2021) apply this idea to monitoring for distribution shift by betting on conformal p p p -values, which rank each new score among all observations seen so far. Because the ranking uses test data, however, new scores collected after a shift gradually enter the reference pool; post-shift observations then look typical, weakening the evidence against the null, an effect known as test-time contamination [26 , 36 ] . To tackle this issue, Shaer et al. [ [36 ] proposed conditional CTMs (CCTMs), which instead compare every test score with a fixed reference dataset D 0 \mathcal{D}_0 D 0 and add a penalty that absorbs the estimation error of the reference distribution.
Crucially, the additional penalty term, ϵ ∣ η ∣ \epsilon|\eta| ϵ ∣ η ∣ , for a bet size of η \eta η is not differentiable at η = 0 \eta= 0 η = 0 , and Shaer et al. [ [36 ] learn the bet with the online Newton step (ONS) [12 ] as proposed by Cutkosky and Orabona [ [5 ] . The resulting detector carries several hyperparameters: a smoothing constant to smooth ∣ η ∣ |\eta| ∣ η ∣ , a bound on the bet size, a clipping threshold that sets small bets to zero, and a warm-up period, with different clipping thresholds and warm-up lengths used for synthetic and image data. A good value will depend on how long the null period lasts, which is exactly what is unknown . More fundamentally, ONS is designed to compete with the best constant bet in hindsight, which is a poor target when the shift comes late. Before the shift, the optimal bet is precisely zero, since systematic wealth growth is impossible under the null, and every nonzero constant bet will cause wealth decay at a rate proportional to its size. Therefore, every nonzero constant bet needs a number of post-shift observations that grows linearly with the length of the null period to recover its expected wealth loss, so competing with the best constant bet guarantees little for late shifts. Empirically, we measured that the median delay of the CCTM grows roughly 9 times for a shift after t 0 = 4000 t_0 = 4000 t 0 = 4000 null samples (§ 5 ).
In this paper, we address both problems: hyperparameter tuning and the slow response to late shifts. These are our contributions:
An equivalent reformulation of conditional CTMs. Our key observation is that bet selection for the penalized betting function of Shaer et al. [ [36 ] is equivalent to investing in a three-asset market (§ 2 ). So, the nonsmooth penalty becomes a linear function of the portfolio weights. The test martingale keeps the original betting function and is bounded below by the market wealth, so the reformulation needs no smoothing and costs no power.
A parameter-free detector. With the new formulation, betting strategies can be built with the tools from online portfolio selection, which offers algorithms with wealth guarantees on every sequence of returns [3 , 22 , 21 ] . To adapt to an unknown shift time, we propose a restarting universal portfolio with a heavy-tailed allocation of the initial wealth among the start times (§ 3 ). Each portfolio thus holds cash until its start time, so the one started right after the shift loses no wealth during the null period and then competes with the best constant-rebalanced portfolio (CRP) on the post-shift data alone. Apart from the test level and the confidence level of the reference band, it has no hyperparameters.
Adaptivity to an unknown shift time. In § 4 , we show that false alarms are controlled anytime. For a detectable shift after t 0 t_0 t 0 null observations, the cost of not knowing t 0 t_0 t 0 a priori is ln t 0 + O ( ln ln t 0 ) \ln t_0 + O(\ln\ln t_0) ln t 0 + O ( ln ln t 0 ) , measured in log-wealth. So, the delay grows only logarithmically with t 0 t_0 t 0 , compared with the linear growth for constant bets. We also prove that ln t 0 \ln t_0 ln t 0 is unavoidable: under anytime false-alarm control, no procedure detects shifts with a delay of smaller order than ln t 0 \ln t_0 ln t 0 uniformly over all t 0 t_0 t 0 , even if the pre- and post-shift distributions are known.
Efficient implementation. Despite this adaptivity, restarting a universal portfolio at every round costs O ( T 3 ) O(T^3) O ( T 3 ) over a horizon of T T T when computed directly. We give a divide-and-conquer FFT-based algorithm that computes exactly the portfolio sequence in O ( T 2 ln T ) O(T^2 \ln T) O ( T 2 ln T ) time (§ 3.2 ).
On synthetic and ImageNet-C data, our detector’s delay is nearly flat in shift time, while those of conditional/standard CTMs grow steadily; after 4000–8000 null samples, we detect shifts two to five times faster.
Abbreviated Related Work. Sequential change detection has a long history, starting with the CUSUM procedure [25 ] . However, classical theory [19 , 18 , 42 ] generally assumes simple and parametric settings with known pre- and post-change distributions, and its guarantees generally control the average run length (ARL) to a false alarm under the null, which bounds how soon a false alarm is expected but allows one to occur eventually with probability one. E-detectors [38 ] extend CUSUM-type and Shiryaev–Roberts (SR)-type procedures to certain composite and nonparametric settings by starting a new e-process (a generalization of a test supermartingale) at every round and combining them, with a guarantee on the ARL to false alarm. For ARL control under the null of exchangeability, Vovk [2021] similarly studies CUSUM- and SR-type standard CTMs. Our detector also starts a new bettor at every round, but it combines them with weights that sum to one, so that the total wealth itself is a valid test supermartingale. This yields a stronger, unbounded-horizon guarantee: given a reference dataset whose confidence band holds, the probability of raising a false alarm is at most α \alpha α anytime. Under this criterion, a delay growing logarithmically with the shift time is unavoidable (§ 4 ). For additional related work on sequential change detection, see Appendix § 7 .
Universal portfolios [3 , 4 ] achieve logarithmic regret against the best constant-rebalanced portfolio without tuning, and coin betting connects portfolio selection with parameter-free online learning [23 , 21 ] . To compete with comparators that change over time, one can mix over sequences of experts [15 , 41 , 17 , 11 , 6 , 16 ] . The use of a universal portfolio as a testing-by-betting algorithm appeared for the first time in Orabona and Jun [ [22 ] , for the specific case of confidence sequences.
Penalized Betting as Portfolio Selection
This section sets up the testing problem, reviews the conditional CTM (CCTM) of Shaer et al. [ [36 ] , and recasts choosing the bets for the CCTM’s penalized betting function as portfolio selection in a three-asset market. Detailed proofs are given in Appendix § 8 .
Problem Setup
Let D 0 = { X 1 0 , … , X n 0 } \mathcal{D}_0 = \{X_1^0,\ldots,X_n^0\} D 0 = { X 1 0 , … , X n 0 } be a reference dataset drawn i.i.d. from an unknown distribution P P P on R \mathbb{R} R with a continuous cumulative distribution function (CDF) F F F , and let X 1 , X 2 , … X_1,X_2,\ldots X 1 , X 2 , … be test observations, independent of D 0 \mathcal{D}_0 D 0 , that arrive one at a time. In applications, each observation is a score computed from a possibly high-dimensional input by a fixed function (e.g., entropy of a pretrained classifier), so a change in the score distribution signals a shift in the inputs. Given D 0 \mathcal{D}_0 D 0 , we test the null hypothesis
H 0 : X t ∼ i . i . d . P for all t ≥ 1. (1) H_0 : X_t \mathrel{\overset{\mathrm{i.i.d.}}{\sim}} P \text{ for all } t \ge1 . \tag*{(1)} H 0 : X t ∼ i.i.d. P for all t ≥ 1. (1)
The alternative hypothesis of interest is a shift to a distribution Q ≠ P Q \ne P Q = P at an unknown time t 0 ≥ 0 t_0 \ge0 t 0 ≥ 0 , i.e., the scores are independent with
H 1 : X t ∼ P for t ≤ t 0 and X t ∼ Q for t > t 0 , (2) H_1 : X_t \sim P \text{ for } t \le t_0 \text{ and } X_t \sim Q \text{ for } t > t_0, \tag*{(2)} H 1 : X t ∼ P for t ≤ t 0 and X t ∼ Q for t > t 0 , (2)
so that t 0 t_0 t 0 is the last round in which H 0 H_0 H 0 holds. We write P H 0 \mathbb{P}_{H_0} P H 0 for the probability law under H 0 H_0 H 0 , and P H 1 \mathbb{P}_{H_1} P H 1 for the law under H 1 H_1 H 1 with a given Q Q Q and t 0 t_0 t 0 . Let F t : = σ ( D 0 , X 1 , … , X t ) \mathcal{F}_t := \sigma(\mathcal{D}_0, X_1,\ldots,X_t) F t := σ ( D 0 , X 1 , … , X t ) denote the natural filtration, with F 0 : = σ ( D 0 ) \mathcal{F}_0 := \sigma(\mathcal{D}_0) F 0 := σ ( D 0 ) . A sequence ( η t ) t ≥ 1 (\eta_t)_{t\ge1} ( η t ) t ≥ 1 is predictable if each η t \eta_t η t is F t − 1 \mathcal{F}_{t-1} F t − 1 -measurable. A sequential test is a stopping time τ \tau τ with respect to ( F t ) t ≥ 0 (\mathcal{F}_t)_{t\ge0} ( F t ) t ≥ 0 : it raises a false alarm under H 0 H_0 H 0 if τ < ∞ \tau< \infty τ < ∞ , and τ = ∞ \tau= \infty τ = ∞ means that no alarm is raised. Our goals are (a) anytime false-alarm control , i.e., P H 0 { τ < ∞ ∣ D 0 } ≤ α \mathbb{P}_{H_0}\{\tau< \infty\mid\mathcal{D}_0\} \le\alpha P H 0 { τ < ∞ ∣ D 0 } ≤ α for a given level α ∈ ( 0 , 1 ) \alpha\in(0,1) α ∈ ( 0 , 1 ) , and (b) under (2) , a short detection delay ( τ − t 0 ) + (\tau-t_0)_+ ( τ − t 0 ) + .
Testing By Betting. Testing by betting [37 , 33 ] measures evidence against H 0 H_0 H 0 by the wealth of a gambler who bets against it. The gambler starts with the wealth M 0 = 1 M_0=1 M 0 = 1 and, before seeing X t X_t X t , chooses an F t − 1 \mathcal{F}_{t-1} F t − 1 -measurable betting function b t : R → [ 0 , ∞ ) b_t:\mathbb{R}\to[0,\infty) b t : R → [ 0 , ∞ ) , so that
M t = M t − 1 b t ( X t ) and E H 0 [ b t ( X t ) ∣ F t − 1 ] ≤ 1. M_t=M_{t-1}b_t(X_t) \quad\text{and}\quad\mathbb{E}_{H_0}[b_t(X_t)\mid\mathcal{F}_{t-1}]\le1. M t = M t − 1 b t ( X t ) and E H 0 [ b t ( X t ) ∣ F t − 1 ] ≤ 1.
The constraint says that no bet is favorable under the null, and it makes the wealth ( M t ) t ≥ 0 (M_t)_{t\ge0} ( M t ) t ≥ 0 a nonnegative supermartingale under H 0 H_0 H 0 :
E H 0 [ M t ∣ F t − 1 ] = M t − 1 E H 0 [ b t ( X t ) ∣ F t − 1 ] ≤ M t − 1 . \mathbb{E}_{H_0}[M_t \mid\mathcal{F}_{t-1}] = M_{t-1}\mathbb{E}_{H_0}[b_t(X_t) \mid\mathcal{F}_{t-1}] \le M_{t-1}. E H 0 [ M t ∣ F t − 1 ] = M t − 1 E H 0 [ b t ( X t ) ∣ F t − 1 ] ≤ M t − 1 .
Ville’s inequality [44 ] then bounds the probability that the wealth ever reaches the level 1 / α 1/\alpha 1/ α :
P H 0 { ∃ t ≥ 1 : M t ≥ 1 / α } ≤ α . \mathbb{P}_{H_0}\{\exists t \ge1 : M_t \ge1/\alpha\} \le\alpha. P H 0 { ∃ t ≥ 1 : M t ≥ 1/ α } ≤ α .
Hence the test τ : = inf { t ≥ 1 : M t ≥ 1 / α } \tau:= \inf\{t \ge1 : M_t \ge1/\alpha\} τ := inf { t ≥ 1 : M t ≥ 1/ α } meets goal (a), and goal (b) asks the gambler to grow the wealth quickly once the shift has happened.
If the true CDF F F F were known, the values F ( X t ) F(X_t) F ( X t ) would be i.i.d. uniform on [ 0 , 1 ] [0,1] [ 0 , 1 ] under H 0 H_0 H 0 , and the factor 1 + η t ( p t − 1 / 2 ) 1+\eta_t(p_t-1/2) 1 + η t ( p t − 1/2 ) with p t : = F ( X t ) p_t := F(X_t) p t := F ( X t ) and a predictable η t ∈ [ − 2 , 2 ] \eta_t \in[-2,2] η t ∈ [ − 2 , 2 ] would be a fair bet on whether, and by how much, F ( X t ) F(X_t) F ( X t ) deviates from its mean 1 / 2 1/2 1/2 under the null. In practice, we replace F F F by the accessible empirical CDF F ^ 0 ( x ) : = n − 1 ∑ i = 1 n 1 { X i 0 ≤ x } \widehat{F}_0(x) := n^{-1}\sum_{i=1}^n \mathbf{1}\{X_i^0 \le x\} F 0 ( x ) := n − 1 ∑ i = 1 n 1 { X i 0 ≤ x } of the reference sample. Given D 0 D_0 D 0 , the resulting p-values p ^ t : = F ^ 0 ( X t ) \widehat{p}_t := \widehat{F}_0(X_t) p t := F 0 ( X t ) may no longer be i.i.d. uniformly distributed under H 0 H_0 H 0 ; their mean can differ from 1 / 2 1/2 1/2 [1 ] . Betting on the sign of this bias grows the wealth even under the null and inflates false alarms [36 ] .
The Conditional CTM. Shaer et al. [ [36 ] compensate for this error by bounding the finite-sample approximation error of F ^ 0 \widehat{F}_0 F 0 to F F F with a confidence band, and penalizing the bet by a term proportional to the bet size as well as the band width. Specifically, fix a confidence level δ ∈ ( 0 , 1 ) \delta\in(0,1) δ ∈ ( 0 , 1 ) and let ϵ : [ 0 , 1 ] → [ 0 , 1 ] \epsilon: [0,1] \to[0,1] ϵ : [ 0 , 1 ] → [ 0 , 1 ] be a band width, computed from D 0 D_0 D 0 , such that the event
∣ F ^ 0 ( x ) − F ( x ) ∣ ≤ ϵ ( F ^ 0 ( x ) ) for all x ∈ R (3) \left|\widehat{F}_0(x)-F(x)\right| \le\epsilon\left(\widehat{F}_0(x)\right)\quad\text{for all }x\in\mathbb{R} \tag*{(3)} F 0 ( x ) − F ( x ) ≤ ϵ ( F 0 ( x ) ) for all x ∈ R (3)
has probability at least 1 − δ 1-\delta 1 − δ over the draw of D 0 D_0 D 0 . We write G \mathcal{G} G for the set of reference datasets on which (3) holds. For example, the Dvoretzky–Kiefer–Wolfowitz (DKW) inequality [9 ] gives the constant band ϵ ≡ min { 1 , ln ( 2 / δ ) / ( 2 n ) } \epsilon\equiv\min\{1,\sqrt{\ln(2/\delta)/(2n)}\} ϵ ≡ min { 1 , ln ( 2/ δ ) / ( 2 n ) } , and likelihood-based bands give widths that vary with F ^ 0 ( x ) \widehat{F}_0(x) F 0 ( x ) [24 ] . With the scale κ : = 1 / ( 1 / 2 + max p ∈ [ 0 , 1 ] ϵ ( p ) ) ∈ [ 2 / 3 , 2 ] \kappa:= 1/(1/2+\max_{p\in[0,1]}\epsilon(p)) \in[2/3,2] κ := 1/ ( 1/2 + max p ∈ [ 0 , 1 ] ϵ ( p )) ∈ [ 2/3 , 2 ] , the penalized betting function of Shaer et al. [ [36 ] is
b ( η , p ) : = 1 + κ ( η ( p − 1 / 2 ) − ∣ η ∣ ϵ ( p ) ) , (4) b(\eta,p) := 1+\kappa\left(\eta(p-1/2)-|\eta|\epsilon(p)\right), \tag*{(4)} b ( η , p ) := 1 + κ ( η ( p − 1/2 ) − ∣ η ∣ ϵ ( p ) ) , (4)
for a bet η ∈ [ − 1 , 1 ] \eta\in[-1,1] η ∈ [ − 1 , 1 ] and p ∈ [ 0 , 1 ] p \in[0,1] p ∈ [ 0 , 1 ] . The first part is the ideal bet, with p ^ t \widehat{p}_t p t in place of p t p_t p t . The second part works like a tax : a bet of size ∣ η ∣ |\eta| ∣ η ∣ pays κ ∣ η ∣ ϵ ( p ^ t ) \kappa|\eta|\epsilon(\widehat{p}_t) κ ∣ η ∣ ϵ ( p t ) , regardless of the outcome. A bet therefore increases the gambler’s wealth only when p ^ t \widehat{p}_t p t deviates from 1 / 2 1/2 1/2 by more than the band width, in the direction of the bet. Since ∣ η ( p − 1 / 2 ) − ∣ η ∣ ϵ ( p ) ∣ ≤ 1 / 2 + max p ∈ [ 0 , 1 ] ϵ ( p ) |\eta(p-1/2)-|\eta|\epsilon(p)| \le1/2+\max_{p\in[0,1]}\epsilon(p) ∣ η ( p − 1/2 ) − ∣ η ∣ ϵ ( p ) ∣ ≤ 1/2 + max p ∈ [ 0 , 1 ] ϵ ( p ) , the normalization by κ \kappa κ ensures b ( η , p ) ∈ [ 0 , 2 ] b(\eta,p) \in[0,2] b ( η , p ) ∈ [ 0 , 2 ] . For a predictable sequence of bets, the resulting wealth is a valid test supermartingale given any D 0 ∈ G D_0 \in\mathcal{G} D 0 ∈ G ; the level α \alpha α then controls false alarms given such a D 0 D_0 D 0 , while δ \delta δ bounds the probability that D 0 ∉ G D_0 \notin\mathcal{G} D 0 ∈ / G .
Proposition 2.1 (Shaer et al. [ [36 ] ). Let ( η t ) t ≥ 1 (\eta_t)_{t\ge1} ( η t ) t ≥ 1 be predictable with values in [ − 1 , 1 ] [-1,1] [ − 1 , 1 ] , and let M t : = ∏ i = 1 t b ( η i , p ^ i ) M_t := \prod_{i=1}^t b(\eta_i,\widehat{p}_i) M t := ∏ i = 1 t b ( η i , p i ) with M 0 : = 1 M_0 := 1 M 0 := 1 . If D 0 ∈ G D_0 \in\mathcal{G} D 0 ∈ G , then under H 0 H_0 H 0 , ( M t ) t ≥ 0 (M_t)_{t\ge0} ( M t ) t ≥ 0 is a nonnegative ( F t ) t ≥ 0 (\mathcal{F}_t)_{t\ge0} ( F t ) t ≥ 0 -supermartingale, and
P H 0 { ∃ t ≥ 1 : M t ≥ 1 / α ∣ D 0 } ≤ α . \mathbb{P}_{H_0}\{\exists t \ge1 : M_t \ge1/\alpha\mid D_0\} \le\alpha. P H 0 { ∃ t ≥ 1 : M t ≥ 1/ α ∣ D 0 } ≤ α . Consequently, P H 0 { ∃ t ≥ 1 : M t ≥ 1 / α } ≤ α + ( 1 − α ) δ \mathbb{P}_{H_0}\{\exists t \ge1 : M_t \ge1/\alpha\} \le\alpha+(1-\alpha)\delta P H 0 { ∃ t ≥ 1 : M t ≥ 1/ α } ≤ α + ( 1 − α ) δ .
Learning The Bets Online. Proposition 2.1 holds for every predictable sequence of bets ( η t ) t ≥ 1 (\eta_t)_{t\ge1} ( η t ) t ≥ 1 , and statistical power demands choosing one that grows the wealth quickly after a shift. Maximizing ln M T = ∑ t = 1 T ln b ( η t , p ^ t ) \ln M_T=\sum_{t=1}^T \ln b(\eta_t,\widehat{p}_t) ln M T = ∑ t = 1 T ln b ( η t , p t ) over T T T rounds is an online learning problem with losses − ln b ( η , p ^ t ) -\ln b(\eta,\widehat{p}_t) − ln b ( η , p t ) . These losses are convex in η \eta η , but not differentiable at η = 0 \eta=0 η = 0 when ϵ ( p ^ t ) > 0 \epsilon(\widehat{p}_t)>0 ϵ ( p t ) > 0 .
Issues With ONS. Following Cutkosky and Orabona [ [5 ] , Shaer et al. [ [36 ] use ONS to learn the bets, using a surrogate in which ∣ η ∣ |\eta| ∣ η ∣ is replaced by the smooth approximation η 2 + k 2 \sqrt{\eta^2+k^2} η 2 + k 2 for a small k > 0 k>0 k > 0 , and restrict the bets to [ − 1 / 2 , 1 / 2 ] [-1/2,1/2] [ − 1/2 , 1/2 ] . Before the shift, the bets fluctuate around zero; every nonzero bet pays tax, so the wealth decays and must be won back after the shift, a problem already observed for CTMs [45 ] . To prevent this, Shaer et al. [ [36 ] set η \eta η to zero whenever its magnitude falls below a threshold C C C , and no bets are placed during an initial warm-up period (after smoothing, even a zero bet pays a tax proportional to k ϵ ( p ^ t ) k\epsilon(\hat{p}_t) k ϵ ( p ^ t ) ). Notably, the threshold trades off wealth loss before the shift against a slower reaction after it. The smoothing constant k k k , the range of bets, the threshold C C C , and the warm-up length must all be set by the user.
A Three-Asset Market
Here, we show how to remove the non-differentiability by an equivalent reparameterization of Shaer et al. [ [36 ] 's original construction. The reframing turns the choice of bets into portfolio selection, a problem for which parameter-free algorithms are available.
Intuition. Split a bet into its positive and negative parts, η = η + − η − \eta=\eta^{+}-\eta^{-} η = η + − η − with η + : = max { η , 0 } \eta^{+}:=\max\{\eta,0\} η + := max { η , 0 } and η − : = max { − η , 0 } \eta^{-}:=\max\{-\eta,0\} η − := max { − η , 0 } , so that ∣ η ∣ = η + + η − |\eta|=\eta^{+}+\eta^{-} ∣ η ∣ = η + + η − . Substituting both identities into (4) gives
b ( η , p ) = ( 1 − ∣ η ∣ ) + η + b ( 1 , p ) + η − b ( − 1 , p ) . b(\eta,p)=(1-|\eta|)+\eta^{+}b(1,p)+\eta^{-}b(-1,p). b ( η , p ) = ( 1 − ∣ η ∣ ) + η + b ( 1 , p ) + η − b ( − 1 , p ) .
The penalized bet is thus the return of a portfolio that keeps a fraction 1 − ∣ η ∣ 1-|\eta| 1 − ∣ η ∣ of the wealth in cash and invests the fractions η + \eta^{+} η + and η − \eta^{-} η − in two assets whose returns are the two most aggressive bets, b ( 1 , p ) b(1,p) b ( 1 , p ) and b ( − 1 , p ) b(-1,p) b ( − 1 , p ) . The three fractions are all nonnegative and sum to one. This suggests treating the three fixed bets as assets.
Definition 2.2 (The three-asset market). In round t t t , the price relatives of the three assets are
x t : = ( x t 0 , x t + , x t − ) : = ( 1 , b ( 1 , p ^ t ) , b ( − 1 , p ^ t ) ) ∈ [ 0 , 2 ] 3 . \boldsymbol{x}_t:=\left(x_t^0,x_t^+,x_t^-\right):=\left(1,b(1,\hat{p}_t),b(-1,\hat{p}_t)\right)\in[0,2]^3. x t := ( x t 0 , x t + , x t − ) := ( 1 , b ( 1 , p ^ t ) , b ( − 1 , p ^ t ) ) ∈ [ 0 , 2 ] 3 . A portfolio is a vector w = ( w 0 , w + , w − ) \boldsymbol{w}=(w^0,w^+,w^-) w = ( w 0 , w + , w − ) in the simplex W : = { w ∈ [ 0 , 1 ] 3 : w 0 + w + + w − = 1 } \mathcal{W}:=\{\boldsymbol{w}\in[0,1]^3:w^0+w^++w^-=1\} W := { w ∈ [ 0 , 1 ] 3 : w 0 + w + + w − = 1 } . Investing with w \boldsymbol{w} w in round t t t multiplies the wealth by ⟨ w , x t ⟩ \langle\boldsymbol{w},\boldsymbol{x}_t\rangle ⟨ w , x t ⟩ .
We call the three assets cash , the up asset , and the down asset . The up asset pays x t + = 1 + κ ( p ^ t − 1 / 2 − ϵ ( p ^ t ) ) x_t^+=1+\kappa(\hat{p}_t-1/2-\epsilon(\hat{p}_t)) x t + = 1 + κ ( p ^ t − 1/2 − ϵ ( p ^ t )) , so the wealth invested in it grows when p ^ t \hat{p}_t p ^ t exceeds 1 / 2 1/2 1/2 by more than the band width, which happens systematically when the scores shift upwards. The down asset behaves similarly when scores shift downwards. Applying Proposition 2.1 to the constant bets ± 1 \pm1 ± 1 shows that neither risky asset can grow in expectation under H 0 H_0 H 0 when D 0 ∈ G D_0\in\mathcal{G} D 0 ∈ G , so cash is the only safe asset. Without estimation error, that is, with ϵ ≡ 0 \epsilon\equiv0 ϵ ≡ 0 , the market reduces to the standard two-asset form of betting on a coin [23 , 21 ] . Expanding the inner product shows how a portfolio bets:
⟨ w , x t ⟩ = 1 + κ ( w + − w − ) ( p ^ t − 1 / 2 ) − κ ( w + + w − ) ϵ ( p ^ t ) , (5) \langle\boldsymbol{w},\boldsymbol{x}_t\rangle=1+\kappa(w^+-w^-)(\hat{p}_t-1/2)-\kappa(w^++w^-)\epsilon(\hat{p}_t), \tag*{(5)} ⟨ w , x t ⟩ = 1 + κ ( w + − w − ) ( p ^ t − 1/2 ) − κ ( w + + w − ) ϵ ( p ^ t ) , (5)
so a portfolio bets the difference w + − w − w^+-w^- w + − w − but pays the tax on the sum (or hedging) w + + w − ≥ ∣ w + − w − ∣ w^++w^-\geq|w^+-w^-| w + + w − ≥ ∣ w + − w − ∣ . The two coincide exactly when the portfolio holds at most one risky asset, which gives the following lemma.
Lemma 2.3. For every w ∈ W \boldsymbol{w}\in\mathcal{W} w ∈ W and every round t t t ,
⟨ w , x t ⟩ = b ( w + − w − , p ^ t ) − 2 κ min { w + , w − } ϵ ( p ^ t ) . (6) \langle\boldsymbol{w},\boldsymbol{x}_t\rangle=b(w^+-w^-,\hat{p}_t)-2\kappa\min\{w^+,w^-\}\epsilon(\hat{p}_t). \tag*{(6)} ⟨ w , x t ⟩ = b ( w + − w − , p ^ t ) − 2 κ min { w + , w − } ϵ ( p ^ t ) . (6) Conversely, for every η ∈ [ − 1 , 1 ] \eta\in[-1,1] η ∈ [ − 1 , 1 ] , the portfolio w ( η ) : = ( 1 − ∣ η ∣ , η + , η − ) ∈ W \boldsymbol{w}(\eta):=(1-|\eta|,\eta^+,\eta^-)\in\mathcal{W} w ( η ) := ( 1 − ∣ η ∣ , η + , η − ) ∈ W satisfies ⟨ w ( η ) , x t ⟩ = b ( η , p ^ t ) \langle\boldsymbol{w}(\eta),\boldsymbol{x}_t\rangle=b(\eta,\hat{p}_t) ⟨ w ( η ) , x t ⟩ = b ( η , p ^ t ) for every round t t t . Consequently, for all rounds 1 ≤ s ≤ t 1\leq s\leq t 1 ≤ s ≤ t and every realization of p ^ s , … , p ^ t ∈ [ 0 , 1 ] \hat{p}_s,\ldots,\hat{p}_t\in[0,1] p ^ s , … , p ^ t ∈ [ 0 , 1 ] ,
max w ∈ W ∏ i = s t ⟨ w , x i ⟩ = max η ∈ [ − 1 , 1 ] ∏ i = s t b ( η , p ^ i ) . \max_{\boldsymbol{w}\in\mathcal{W}}\prod_{i=s}^{t}\langle\boldsymbol{w},\boldsymbol{x}_i\rangle=\max_{\eta\in[-1,1]}\prod_{i=s}^{t}b(\eta,\hat{p}_i). w ∈ W max i = s ∏ t ⟨ w , x i ⟩ = η ∈ [ − 1 , 1 ] max i = s ∏ t b ( η , p ^ i ) .
In portfolio selection, the standard comparator is the best constant-rebalanced portfolio (CRP) in hindsight, which keeps the same fraction w w w of wealth in each asset at every round [3 ] . Lemma 2.3 shows that, in the three-asset market, the best CRP earns exactly as much as the best constant bet, the comparator of ONS in Shaer et al. [ [36 ] . More importantly, the market construction turns the choice of betting strategies into online portfolio selection while keeping the comparator: any portfolio algorithm with a regret guarantee against CRPs thus competes with the best constant bet automatically . Since the return ⟨ w , x t ⟩ \langle w,x_t\rangle ⟨ w , x t ⟩ is linear in the allocation w w w , the portfolio view also allows mixes over strategies with different start times, which will be crucial for adapting to an unknown shift time in § 3 . Finally, in contrast to the ONS solution, the full range of bets [ − 1 , 1 ] [-1,1] [ − 1 , 1 ] is available.
From Portfolio Wealth To Test Martingale. A portfolio algorithm chooses a predictable sequence of portfolios ( w t ) t ≥ 1 (w_t)_{t\ge1} ( w t ) t ≥ 1 in W \mathcal{W} W . We will use it only to select the bet η \eta η and keep the penalized betting function for the test (4) . With η t : = w t + − w t − \eta_t := w_t^+ - w_t^- η t := w t + − w t − , this involves two wealth processes,
M t : = ∏ i = 1 t b ( η i , p ^ i ) and Wealth t : = ∏ i = 1 t ⟨ w i , x i ⟩ , (7) M_t := \prod_{i=1}^{t} b(\eta_i,\hat{p}_i) \quad\text{and}\quad\operatorname{Wealth}_t := \prod_{i=1}^{t} \langle w_i,x_i\rangle, \tag*{(7)} M t := i = 1 ∏ t b ( η i , p ^ i ) and Wealth t := i = 1 ∏ t ⟨ w i , x i ⟩ , (7)
with Wealth 0 = M 0 = 1 \operatorname{Wealth}_0=M_0=1 Wealth 0 = M 0 = 1 . The two processes play different roles. The portfolio algorithm sees only the market and controls Wealth t \operatorname{Wealth}_t Wealth t , while the alarm is raised by M t M_t M t . Since M t ≥ Wealth t M_t \ge\operatorname{Wealth}_t M t ≥ Wealth t (Proposition 2.4 below), any lower bound on ln Wealth t \ln\operatorname{Wealth}_t ln Wealth t , such as a regret bound against some comparator, also holds for ln M t \ln M_t ln M t . All our guarantees on the detection delay are proved for Wealth t \operatorname{Wealth}_t Wealth t and therefore apply to the test based on M t M_t M t . In short, we choose the bets in the market and measure the evidence with the original betting function.
Proposition 2.4 (Validity). Let ( w t ) t ≥ 1 ∈ W (w_t)_{t\ge1}\in\mathcal{W} ( w t ) t ≥ 1 ∈ W be predictable with respect to ( F t ) (\mathcal{F}_t) ( F t ) , define ( η t ) t ≥ 1 (\eta_t)_{t\ge1} ( η t ) t ≥ 1 , ( M t ) t ≥ 0 (M_t)_{t\ge0} ( M t ) t ≥ 0 , and ( Wealth t ) t ≥ 0 (\operatorname{Wealth}_t)_{t\ge0} ( Wealth t ) t ≥ 0 by (7) , and let τ : = inf { t ≥ 1 : M t ≥ 1 / α } \tau:= \inf\{t\ge1:M_t\ge1/\alpha\} τ := inf { t ≥ 1 : M t ≥ 1/ α } . Then M t ≥ Wealth t M_t\ge\operatorname{Wealth}_t M t ≥ Wealth t for all t ≥ 0 t\ge0 t ≥ 0 . If D 0 ∈ G D_0\in\mathcal{G} D 0 ∈ G , then ( M t ) t ≥ 0 (M_t)_{t\ge0} ( M t ) t ≥ 0 is a nonnegative supermartingale under P H 0 \mathbb{P}_{H_0} P H 0 and P H 0 { τ < ∞ ∣ D 0 } ≤ α \mathbb{P}_{H_0}\{\tau<\infty\mid D_0\}\le\alpha P H 0 { τ < ∞ ∣ D 0 } ≤ α . Without conditioning, P H 0 { τ < ∞ } ≤ α + ( 1 − α ) δ \mathbb{P}_{H_0}\{\tau<\infty\}\le\alpha+(1-\alpha)\delta P H 0 { τ < ∞ } ≤ α + ( 1 − α ) δ .
Restarting Universal Portfolios
Lemma 2.3 holds for any sub-interval of all the rounds { 1 , 2 , … , T } \{1,2,\ldots,T\} { 1 , 2 , … , T } , and any sequence of scalar bets ( η t ) t ≥ 1 (\eta_t)_{t\ge1} ( η t ) t ≥ 1 is realized exactly by the portfolios ( w ( η t ) ) t ≥ 1 (w(\eta_t))_{t\ge1} ( w ( η t ) ) t ≥ 1 . The correspondence is therefore not limited to constant strategies, and a comparator may change over time. For monitoring purposes, after a long null phase, however, the best constant bet could be a weak comparator. Intuitively, the right comparator should place no bets until the shift and then bet in the right direction, i.e., it holds w t = ( 1 , 0 , 0 ) w_t=(1,0,0) w t = ( 1 , 0 , 0 ) for t ≤ t 0 t\le t_0 t ≤ t 0 and w t = w ( η ) w_t=w(\eta) w t = w ( η ) for t > t 0 t>t_0 t > t 0 with a fixed η ∈ [ − 1 , 1 ] \eta\in[-1,1] η ∈ [ − 1 , 1 ] . Its log-wealth at a round t > t 0 t>t_0 t > t 0 is ∑ i = t 0 + 1 t ln b ( η , p ^ i ) \sum_{i=t_0+1}^{t}\ln b(\eta,\hat{p}_i) ∑ i = t 0 + 1 t ln b ( η , p ^ i ) , which, unlike the log-wealth of a constant bet, suffers no decay during the null period. In this section, we construct a parameter-free portfolio algorithm that competes with all such comparators at once, without knowing t 0 t_0 t 0 . We first explain why a single constant bet is a weak comparator for late shifts, then recall Cover’s universal portfolio, and finally design a variant that restarts at every round with a heavy-tailed allocation of the initial wealth. Detailed proofs are given in Appendix § 9 .
Why Constant Bets Adapt Slowly. Under the null, no bet can grow the wealth in expectation by the supermartingale property, yet every nonzero constant bet keeps paying the tax, so its wealth decays throughout the null period and the best constant bet becomes a weak comparator for late shifts. We formalize this argument in Appendix § 9 .§ 1 : tests with constant bets must first recover the wealth lost before the shift, so their expected detection delay grows linearly in t 0 t_0 t 0 .
Universal Portfolios. Let μ \mu μ be the Jeffreys prior Dirichlet( 1 / 2 , 1 / 2 , 1 / 2 ) (1/2,1/2,1/2) ( 1/2 , 1/2 , 1/2 ) on W \mathcal{W} W . The universal portfolio [3 , 4 ] invests at round t t t in the average of all constant portfolios, weighted by the wealth they would have earned so far,
w t : = ∫ W w ∏ i = 1 t − 1 ⟨ w , x i ⟩ μ ( d w ) ∫ W ∏ i = 1 t − 1 ⟨ w , x i ⟩ μ ( d w ) . w_t := \frac{\int_{\mathcal{W}} w \prod_{i=1}^{t-1}\langle w,x_i\rangle\mu(dw)}{\int_{\mathcal{W}} \prod_{i=1}^{t-1}\langle w,x_i\rangle\mu(dw)}. w t := ∫ W ∏ i = 1 t − 1 ⟨ w , x i ⟩ μ ( d w ) ∫ W w ∏ i = 1 t − 1 ⟨ w , x i ⟩ μ ( d w ) .
By telescoping the wealth updates, the universal portfolio started at round s s s has wealth
∫ ∏ i = s t ⟨ w , x i ⟩ μ ( d w ) \int\prod_{i=s}^{t}\langle w,x_i\rangle\mu(dw) ∫ i = s ∏ t ⟨ w , x i ⟩ μ ( d w )
by round t t t . This is the mixture of all CRPs’ wealths with respect to μ \mu μ . Cover and Ordentlich [ [4 ] showed that this mixture loses at most a logarithmic factor against the best CRP on every sequence of price relatives; for three assets and all x s , … , x t ∈ [ 0 , ∞ ) 3 x_s,\ldots,x_t \in[0,\infty)^3 x s , … , x t ∈ [ 0 , ∞ ) 3 with 1 ≤ s ≤ t 1 \le s \le t 1 ≤ s ≤ t ,
ln ∫ ∏ i = s t ⟨ w , x i ⟩ μ ( d w ) ≥ max w ∈ W ln ∏ i = s t ⟨ w , x i ⟩ − ln ( 2 ( t − s ) + 3 ) . (8) \ln\int\prod_{i=s}^{t}\langle w,x_i\rangle\mu(dw) \ge\max_{w\in\mathcal{W}} \ln\prod_{i=s}^{t}\langle w,x_i\rangle- \ln(2(t-s)+3). \tag*{(8)} ln ∫ i = s ∏ t ⟨ w , x i ⟩ μ ( d w ) ≥ w ∈ W max ln i = s ∏ t ⟨ w , x i ⟩ − ln ( 2 ( t − s ) + 3 ) . (8)
By Lemma 2.3, the universal portfolio started at round t 0 + 1 t_0+1 t 0 + 1 would thus compete with the ideal comparator described at the beginning of this section, at a regret of ln ( 2 ( t − t 0 ) + 1 ) \ln(2(t-t_0)+1) ln ( 2 ( t − t 0 ) + 1 ) in log-wealth. Unlike ONS, however, the universal portfolio has no step size, smoothing, restricted range of bets, or any other hyperparameter. Since t 0 t_0 t 0 is unknown, we start one at every round.
Restarting at Every Round
Fix positive weights ( π s ) s ≥ 1 (\pi_s)_{s\ge1} ( π s ) s ≥ 1 with ∑ i = 1 ∞ π i = 1 \sum_{i=1}^{\infty}\pi_i=1 ∑ i = 1 ∞ π i = 1 , to be chosen later. The restarting portfolio assigns the initial wealth π s \pi_s π s to a portfolio sequence that starts at round s s s . The sequence holds cash during the rounds 1 , … , s − 1 1,\ldots,s-1 1 , … , s − 1 , and from round s s s on it is invested in a fresh universal portfolio that has not seen the earlier data. Its wealth component is
W e a l t h t s : = { π s ∫ ∏ i = s t ⟨ w , x i ⟩ μ ( d w ) , t ≥ s , π s , t < s . \mathrm{Wealth}_t^s :=
\begin{cases}
\pi_s \int\prod_{i=s}^{t}\langle w,x_i\rangle\mu(dw), & t\ge s,\\
\pi_s, & t<s.
\end{cases} Wealth t s := { π s ∫ ∏ i = s t ⟨ w , x i ⟩ μ ( d w ) , π s , t ≥ s , t < s .
After time t t t , the restarting portfolio holds the mixture
W e a l t h t : = ∑ i = 1 ∞ W e a l t h t i = ∑ i = 1 t W e a l t h t i + r t , (9) \mathrm{Wealth}_t := \sum_{i=1}^{\infty}\mathrm{Wealth}_t^i
= \sum_{i=1}^{t}\mathrm{Wealth}_t^i+r_t, \tag*{(9)} Wealth t := i = 1 ∑ ∞ Wealth t i = i = 1 ∑ t Wealth t i + r t , (9)
where the residual r t : = ∑ i = t + 1 ∞ π i r_t:=\sum_{i=t+1}^{\infty}\pi_i r t := ∑ i = t + 1 ∞ π i is the part of the unit initial wealth of the portfolios that have not started yet. Starting a new component does not add new wealth since all portfolios share the initial unit of wealth, and a new start only moves wealth out of the residual. This is what keeps the detector valid as a supermartingale, in contrast to procedures that add a new unit of wealth at every round and therefore control only the ARL to false alarm [38 ] . The next proposition writes (9) as the wealth of a predictable portfolio with the recursion for Algorithm 1.
Proposition 3.1. Let B 1 : = π 1 B_1:=\pi_1 B 1 := π 1 and B t + 1 ( w ) : = ⟨ w , x t ⟩ B t ( w ) + π t + 1 B_{t+1}(w):=\langle w,x_t\rangle B_t(w)+\pi_{t+1} B t + 1 ( w ) := ⟨ w , x t ⟩ B t ( w ) + π t + 1 for t ≥ 1 t\ge1 t ≥ 1 , and let
w t : = ∫ W w B t ( w ) μ ( d w ) + r t ( 1 , 0 , 0 ) ∫ W B t ( w ) μ ( d w ) + r t . (10) w_t := \frac{\int_{\mathcal{W}} wB_t(w)\mu(dw)+r_t(1,0,0)}{\int_{\mathcal{W}} B_t(w)\mu(dw)+r_t}. \tag*{(10)} w t := ∫ W B t ( w ) μ ( d w ) + r t ∫ W w B t ( w ) μ ( d w ) + r t ( 1 , 0 , 0 ) . (10) Then w t ∈ W w_t\in\mathcal{W} w t ∈ W is F t − 1 \mathcal{F}_{t-1} F t − 1 -measurable and ∏ i = 1 t ⟨ w i , x i ⟩ \prod_{i=1}^{t}\langle w_i,x_i\rangle ∏ i = 1 t ⟨ w i , x i ⟩ equals (9) for all t ≥ 0 t\ge0 t ≥ 0 .
Note that B t ( w ) = ∑ i = 1 t π i ∏ j = i t − 1 ⟨ w , x j ⟩ B_t(w)=\sum_{i=1}^{t}\pi_i\prod_{j=i}^{t-1}\langle w,x_j\rangle B t ( w ) = ∑ i = 1 t π i ∏ j = i t − 1 ⟨ w , x j ⟩ by unrolling the recursion, so w t w_t w t is the weighted (by wealth) average of the allocations of all active universal portfolios, together with the cash residual (proof in Appendix C). Algorithm 1 summarizes the resulting test. We emphasize that Algorithm 1 has no tuning parameters: its only inputs are the levels α \alpha α and δ \delta δ . Combining (8) with Lemma 2.3 yields an adaptive guarantee.
Lemma 3.2 (Restarting regret). For every sequence p ^ 1 , p ^ 2 , … ∈ [ 0 , 1 ] \hat p_1,\hat p_2,\ldots\in[0,1] p ^ 1 , p ^ 2 , … ∈ [ 0 , 1 ] and all 1 ≤ s ≤ t 1\le s\le t 1 ≤ s ≤ t ,
ln M t ≥ ln W e a l t h t ≥ max η ∈ [ − 1 , 1 ] ∑ i = s t ln b ( η , p ^ i ) − ln 1 π s − ln ( 2 ( t − s ) + 3 ) . \ln M_t \ge\ln\mathrm{Wealth}_t \ge\max_{\eta\in[-1,1]} \sum_{i=s}^{t}\ln b(\eta,\hat p_i)-\ln\frac{1}{\pi_s}-\ln(2(t-s)+3). ln M t ≥ ln Wealth t ≥ η ∈ [ − 1 , 1 ] max i = s ∑ t ln b ( η , p ^ i ) − ln π s 1 − ln ( 2 ( t − s ) + 3 ) .
Algorithm 1 Restarting universal portfolio test
Require: reference dataset D 0 D_0 D 0 , test level α \alpha α , confidence level δ \delta δ
Compute F ^ 0 \widehat{F}_0 F 0 , the band width ϵ \epsilon ϵ , and κ \kappa κ from D 0 D_0 D 0 and δ \delta δ
Set M 0 ← 1 M_0 \leftarrow1 M 0 ← 1 and B 1 ← π 1 B_1 \leftarrow\pi_1 B 1 ← π 1
for t = 1 , 2 , … t = 1, 2, \ldots t = 1 , 2 , … do
Compute w t w_t w t by (10)
Observe X t X_t X t and set p ^ t ← F ^ 0 ( X t ) \widehat{p}_t \leftarrow\widehat{F}_0(X_t) p t ← F 0 ( X t )
Set η t ← w t + − w t − \eta_t \leftarrow w_t^+ - w_t^- η t ← w t + − w t − and M t ← M t − 1 b ( η t , p ^ t ) M_t \leftarrow M_{t-1}b(\eta_t,\widehat{p}_t) M t ← M t − 1 b ( η t , p t )
if M t ≥ 1 / α M_t \ge1/\alpha M t ≥ 1/ α then
Reject H 0 H_0 H 0 and stop
Set B t + 1 ( w ) ← ⟨ w , x t ⟩ B t ( w ) + π t + 1 B_{t+1}(\mathbf{w}) \leftarrow\langle\mathbf{w},\mathbf{x}_t\rangle B_t(\mathbf{w}) + \pi_{t+1} B t + 1 ( w ) ← ⟨ w , x t ⟩ B t ( w ) + π t + 1
A Heavy-Tailed Allocation. Lemma 3.2 shows that the portfolio started at round s s s pays a restart cost of ln ( 1 / π s ) \ln(1/\pi_s) ln ( 1/ π s ) in log-wealth, on top of the regret in (8) . The delay after a shift at t 0 t_0 t 0 therefore grows with ln ( 1 / π t 0 + 1 ) \ln(1/\pi_{t_0+1}) ln ( 1/ π t 0 + 1 ) , and the allocation should decay as slowly as possible, while being summable to one. We choose the following heavy-tailed allocation
π s : = ln 2 ( 1 ln ( s + 1 ) − 1 ln ( s + 2 ) ) for s ≥ 1 , (11) \pi_s := \ln2\left(\frac{1}{\ln(s+1)}-\frac{1}{\ln(s+2)}\right)\quad\text{for }s\ge1, \tag*{(11)} π s := ln 2 ( ln ( s + 1 ) 1 − ln ( s + 2 ) 1 ) for s ≥ 1 , (11)
which behaves like O ( 1 / ( s ln 2 s ) ) O(1/(s\ln^2 s)) O ( 1/ ( s ln 2 s )) . Obviously, the sum telescopes, so ∑ i = 1 ∞ π i = 1 \sum_{i=1}^{\infty}\pi_i=1 ∑ i = 1 ∞ π i = 1 , and the residual also has the closed form r t = ln 2 / ln ( t + 2 ) r_t=\ln2/\ln(t+2) r t = ln 2/ ln ( t + 2 ) .
Corollary 3.3. With the allocation (11) , for every sequence p ^ 1 , p ^ 2 , … ∈ [ 0 , 1 ] \widehat{p}_1,\widehat{p}_2,\ldots\in[0,1] p 1 , p 2 , … ∈ [ 0 , 1 ] and all 1 ≤ s ≤ t 1\le s\le t 1 ≤ s ≤ t ,
ln M t ≥ ln Wealth t ≥ max η ∈ [ − 1 , 1 ] ∑ i = s t ln b ( η , p ^ i ) − ln ( 2 ( t − s ) + 3 ) + ln ln 2 − ln ( s + 2 ) − 2 ln ln ( s + 2 ) . \ln M_t \ge\ln\operatorname{Wealth}_t \ge\max_{\eta\in[-1,1]} \sum_{i=s}^{t}\ln b(\eta,\widehat{p}_i)-\ln(2(t-s)+3)+\ln\ln2-\ln(s+2)-2\ln\ln(s+2). ln M t ≥ ln Wealth t ≥ η ∈ [ − 1 , 1 ] max i = s ∑ t ln b ( η , p i ) − ln ( 2 ( t − s ) + 3 ) + ln ln 2 − ln ( s + 2 ) − 2 ln ln ( s + 2 ) .
For a shift after round t 0 t_0 t 0 , taking s = t 0 + 1 s=t_0+1 s = t 0 + 1 shows that the restarting portfolio competes with the ideal comparator that places no bets until t 0 t_0 t 0 and then makes the best constant bet on the shifted data (described at the beginning of this section). Unlike for constant bets, the null period enters only through the prior cost of ln t 0 + O ( ln ln t 0 ) \ln t_0+O(\ln\ln t_0) ln t 0 + O ( ln ln t 0 ) . Wealth decay under H 0 H_0 H 0 , which Shaer et al. [ [36 ] manually handled by clipping, is thus automatically controlled by our construction.
Efficient Implementation
The allocation (10) needs the integrals of B t B_t B t and of w i B t w^iB_t w i B t , i ∈ { 0 , + , − } i\in\{0,+,-\} i ∈ { 0 , + , − } , under the Dirichlet prior in every round. Since B t B_t B t is a polynomial of degree t − 1 t-1 t − 1 with t ( t + 1 ) / 2 t(t+1)/2 t ( t + 1 ) /2 coefficients, and the moments of the prior have closed forms, a direct computation costs O ( t 2 ) O(t^2) O ( t 2 ) operations in round t t t and O ( T 3 ) O(T^3) O ( T 3 ) over T T T rounds. Our key observation is that all portfolios started in a block of rounds grow by the same factor after the block, so their contributions to many later rounds can be handled at once. We bisect the horizon recursively, store the polynomials by their values on Chebyshev grids, after a change of variables that maps the simplex to the unit square, and evaluate the contributions of each block with fast cosine transforms. This computes the same allocations, exactly in exact arithmetic without knowing the horizon, in O ( T 2 ln T ) O(T^2\ln T) O ( T 2 ln T ) time and O ( T 2 ) O(T^2) O ( T 2 ) memory (Appendix § 12 ). On one CPU core, it is faster than the direct computation from about T = 2000 T=2000 T = 2000 rounds onwards, and 5.7 times faster at T = 12,000 T=12{,}000 T = 12 , 000 .
Statistical Guarantees
We now show that the detector of § 3 controls false alarms at any time. Let τ : = inf { t ≥ 1 : M t ≥ 1 / α } \tau:=\inf\{t\ge1:M_t\ge1/\alpha\} τ := inf { t ≥ 1 : M t ≥ 1/ α } be the detection time (or alarm time) of Algorithm 1. We provide a bound on τ \tau τ under a change after an arbitrary round t 0 t_0 t 0 . A lower bound then shows that the logarithmic dependence cannot be improved by any detector. Detailed proofs are given in Appendix § 10 .
False-Alarm Control. Type-I error control is guaranteed by the supermartingale property of the detector. By Proposition 3.1 , the restarting portfolio is predictable, so Proposition 2.4 applies directly.
Detection Delay. To turn Corollary 3.3 into a bound on the delay, the shift must be detectable by some constant bet. We measure the signal strength by
Δ : = ∣ E Q [ p ^ t − 1 / 2 ∣ D 0 ] ∣ − E Q [ ϵ ( p ^ t ) ∣ D 0 ] , (12) \Delta:= \left|\mathbb{E}_{Q}[\hat{p}_{t}-1/2 \mid\mathcal{D}_{0}]\right|-\mathbb{E}_{Q}[\epsilon(\hat{p}_{t}) \mid\mathcal{D}_{0}], \tag*{(12)} Δ := ∣ E Q [ p ^ t − 1/2 ∣ D 0 ] ∣ − E Q [ ϵ ( p ^ t ) ∣ D 0 ] , (12)
the expected gain of the best unit bet after the change. It is the effective signal strength of Shaer et al. [ [36 ] without smoothing, and Δ ≤ 1 / 2 \Delta\le1/2 Δ ≤ 1/2 . If Δ ≤ 0 \Delta\le0 Δ ≤ 0 , no constant bet has positive expected log-return after the change, so we call a shift detectable if Δ > 0 \Delta> 0 Δ > 0 . The following theorem holds for any valid allocation ( π s ) s ≥ 1 (\pi_s)_{s\ge1} ( π s ) s ≥ 1 .
Theorem 4.1. Under (2) with a shift after round t 0 ≥ 0 t_0 \ge0 t 0 ≥ 0 , let D 0 \mathcal{D}_0 D 0 satisfy Δ > 0 \Delta> 0 Δ > 0 , let τ \tau τ be the rejection time of Algorithm 1, and let n ( t 0 ) : = ⌈ 20 Δ 2 ln 2 α π t 0 + 1 + 40 Δ 2 ln 40 Δ 2 ⌉ n(t_0) := \left\lceil\frac{20}{\Delta^2}\ln\frac{2}{\alpha\pi_{t_0+1}}+\frac{40}{\Delta^2}\ln\frac{40}{\Delta^2}\right\rceil n ( t 0 ) := ⌈ Δ 2 20 ln α π t 0 + 1 2 + Δ 2 40 ln Δ 2 40 ⌉ . Then,
E H 1 [ ( τ − t 0 ) + ∣ D 0 ] ≤ n ( t 0 ) + 170 Δ 2 . \mathbb{E}_{H_1}[(\tau-t_0)_+ \mid\mathcal{D}_0] \le n(t_0)+\frac{170}{\Delta^2}. E H 1 [( τ − t 0 ) + ∣ D 0 ] ≤ n ( t 0 ) + Δ 2 170 .
Theorem D.3 in Appendix § 10 .§ 3 adds an exponential tail bound on the delay and a bound given no false alarm before the shift. With the heavy-tailed allocation (11), Theorem 4.1 gives the following corollary.
Corollary 4.2. Under the conditions of Theorem 4.1 ,
E H 1 [ ( τ − t 0 ) + ∣ D 0 ] ≤ 20 Δ 2 ln 1 α + 40 Δ 2 ln 40 Δ 2 + 192 Δ 2 + 20 Δ 2 ( ln ( t 0 + 3 ) + 2 ln ln ( t 0 + 3 ) ) . \mathbb{E}_{H_1}[(\tau-t_0)_+ \mid\mathcal{D}_0] \le\frac{20}{\Delta^2}\ln\frac{1}{\alpha}+\frac{40}{\Delta^2}\ln\frac{40}{\Delta^2}+\frac{192}{\Delta^2}
+\frac{20}{\Delta^2}\bigl(\ln(t_0+3)+2\ln\ln(t_0+3)\bigr). E H 1 [( τ − t 0 ) + ∣ D 0 ] ≤ Δ 2 20 ln α 1 + Δ 2 40 ln Δ 2 40 + Δ 2 192 + Δ 2 20 ( ln ( t 0 + 3 ) + 2 ln ln ( t 0 + 3 ) ) .
The bound separates three sources of delay: the evidence ln ( 1 / α ) \ln(1/\alpha) ln ( 1/ α ) required by the test, a statistical cost of order Δ − 2 ln ( 1 / Δ ) \Delta^{-2}\ln(1/\Delta) Δ − 2 ln ( 1/Δ ) , and the restarting cost of not knowing the shift time t 0 t_0 t 0 . At t 0 = 0 t_0=0 t 0 = 0 it recovers the order Δ − 2 ln ( 1 / ( α Δ ) ) \Delta^{-2}\ln(1/(\alpha\Delta)) Δ − 2 ln ( 1/ ( α Δ )) that Shaer et al. [ [36 ] prove for a shift at the first observation. For t 0 > 0 t_0>0 t 0 > 0 , additional null observations enter only through the restart cost ln t 0 + 2 ln ln t 0 + O ( 1 ) \ln t_0+2\ln\ln t_0+O(1) ln t 0 + 2 ln ln t 0 + O ( 1 ) , in contrast with the linear growth that constant bets incur (Appendix § 9 .§ 1 ).
Unavoidable Logarithmic Cost. The logarithmic growth cannot be avoided. Classical change detectors control the ARL to a false alarm, and their worst-case delay does not depend on t 0 t_0 t 0 Lorden, [19 ] . When a false alarm may ever occur with probability at most α \alpha α , however, every detector must become more conservative as time passes, even one that knows P P P and Q Q Q a priori: for every large t t t , some shift time t 0 t_0 t 0 between t t t and 2 t 2t 2 t costs it an expected delay of order at least ln ( t / α ) / KL ( Q ∥ P ) \ln(t/\alpha)/\operatorname{KL}(Q\mathbin{\|}P) ln ( t / α ) / KL ( Q ∥ P ) (Appendix § 10 .§ 5 ). The dependence of Corollary 4.2 on t 0 t_0 t 0 is therefore optimal in order, and since Pinsker’s inequality gives Δ 2 ≤ KL ( Q ∥ P ) / 2 \Delta^2 \le\operatorname{KL}(Q\mathbin{\|}P)/2 Δ 2 ≤ KL ( Q ∥ P ) /2 for detectable shifts on G \mathcal{G} G , the two bounds differ only in how they measure the size of the shift.
Experiments
We test empirically how the detection delay depends on the unknown shift time. We extend the synthetic and ImageNet-C benchmarks of Shaer et al. [ [36 ] with a null phase of varying length t 0 t_0 t 0 before the shift. Appendix § 13 gives the full setup and all results.
Setup. In the synthetic benchmark, P = N ( 0 , 1 ) P=\mathcal{N}(0,1) P = N ( 0 , 1 ) , and after round t 0 ∈ { 0 , 200 , … , 4000 } t_0 \in\{0,200,\ldots,4000\} t 0 ∈ { 0 , 200 , … , 4000 } , the scores follow either a sharp change to N ( d , 1 ) \mathcal{N}(d,1) N ( d , 1 ) with d ∈ { 1 , 1.5 , 2 } d \in\{1,1.5,2\} d ∈ { 1 , 1.5 , 2 } and n = 1000 n=1000 n = 1000 , or a gradual drift with mean λ ( t − t 0 ) / 100 \lambda(t-t_0)/100 λ ( t − t 0 ) /100 with λ ∈ { 1.5 , 3 , 5 } \lambda\in\{1.5,3,5\} λ ∈ { 1.5 , 3 , 5 } and n = 2000 n=2000 n = 2000 , with 100 runs per configuration. In the ImageNet-C benchmark, the scores are the predictive entropies of a pretrained ViT-B/16 classifier [8 ] , and t 0 ∈ { 0 , 125 , … , 8000 } t_0 \in\{0,125,\ldots,8000\} t 0 ∈ { 0 , 125 , … , 8000 } clean ImageNet images [7 ] precede their severity-5 corruptions [13 ] , for 15 corruptions, 10 seeds, and n ∈ { 100 , 250 , 500 , 1000 , 4000 } n \in\{100,250,500,1000,4000\} n ∈ { 100 , 250 , 500 , 1000 , 4000 } reference images. All tests use α = 0.05 \alpha=0.05 α = 0.05 and the DKW band. Our detector is Algorithm 1 with the heavy-tailed allocation (11) ; it bets from the first round and has no hyperparameters. We compare it with the conditional and the standard CTM, which use ONS with the hyperparameters and the warm-up of [36 ] , and place no bets during the warm-up. As a reference, the oracle holds cash until t 0 t_0 t 0 and then makes the best constant bet in hindsight, the comparator of Corollary 3.3 . We report the median delay τ − t 0 \tau-t_0 τ − t 0 and the power P ( τ ≤ t ∣ τ > t 0 ) P(\tau\leq t\mid\tau>t_0) P ( τ ≤ t ∣ τ > t 0 ) over the runs without a false alarm, counting misses as infinite delays. On both benchmarks, every method keeps its false-alarm rate below α = 0.05 \alpha=0.05 α = 0.05 , except that of the standard CTM on ImageNet-C with n = 4000 n=4000 n = 4000 , which is 0.10 for t 0 ≥ 500 t_0\geq500 t 0 ≥ 500 .
Figure 2. Power given no false alarm , versus the number of rounds t − t 0 t-t_0 t − t 0 after the shift.
Detection Delay. Figure 1 shows the median delay against t 0 t_0 t 0 for one configuration of each benchmark; Appendix § 13 gives all configurations. For an immediate shift (t 0 = 0 t_0=0 t 0 = 0 ), all methods are close on synthetic data, the case for which the CCTM was designed and tuned, while on ImageNet-C, most of the larger delay of the CTMs is their warm-up on corrupted images. As t 0 t_0 t 0 grows, the delays of both CTMs grow roughly linearly, e.g., for the CCTM with d = 1 d=1 d = 1 , from 24 rounds at t 0 = 0 t_0=0 t 0 = 0 to 216 at t 0 = 4000 t_0=4000 t 0 = 4000 . In contrast, the delay of our detector grows logarithmically, as Theorem 4.1 predicts, by only 2.2 to 3.8 rounds each time t 0 t_0 t 0 grows by a factor of e e e on synthetic data. At the largest shift time, our detector is 2.0 to 4.2 times faster than the CCTM on synthetic data, and 3.4 to 5.3 times faster on ImageNet-C, e.g., 51 against 245 rounds for n = 1000 n=1000 n = 1000 . On ImageNet-C with n = 1000 n=1000 n = 1000 , the CTMs are ahead only at t 0 = 125 t_0=125 t 0 = 125 , where their warm-up manually avoids wealth loss early in the null phase.
Figure 1. Median detection delay vs. shift time on logarithmic y y y axes: (a) sharp change to N ( 1 , 1 ) \mathcal{N}(1,1) N ( 1 , 1 ) and (b) gradual drift, with 100 runs per t 0 t_0 t 0 , and (c) ImageNet-C with n = 1000 n=1000 n = 1000 , with 150 runs per t 0 t_0 t 0 .
Power. Figure 2 shows that the power curve of our detector hardly changes with t 0 t_0 t 0 , while those of the CTMs move to the right as t 0 t_0 t 0 grows. For d = 1 d=1 d = 1 at t 0 = 4000 t_0=4000 t 0 = 4000 , our detector detects 90% of the shifts within 72 rounds, against 245 for the CCTM, and after 8000 clean images, it detects 82% of the shifts within 100 rounds, while both CTMs detect none that quickly.
Corruption Groups. Figure 3 compares the CCTM with our detector by corruption group and reference size. The advantage of our detector grows with t 0 t_0 t 0 and n n n : the delay ratio is 1.0 to 2.2 at t 0 = 1000 t_0 = 1000 t 0 = 1000 , where the warm-up of the CCTM falls into the clean images, and 1.4 to 5.7 at t 0 = 8000 t_0 = 8000 t 0 = 8000 ; at t 0 = 0 t_0 = 0 t 0 = 0 , it mostly reflects this warm-up. The Digital corruptions are the hardest for all methods and show the smallest gains. For n = 1000 n = 1000 n = 1000 , our detector is the fastest method in every group and at every shift time (Table 10 in Appendix § 13 .§ 2 ).
Figure 3. ImageNet-C by corruption group. For each seed, we take the median ratio over the corruptions of the group; lines show the mean over 10 seeds and bands one standard error. Values above 1 indicate faster detection by our detector.
Table 10. Median detection delay τ − t 0 \tau- t_0 τ − t 0 on ImageNet-C with n = 1000 n = 1000 n = 1000 , by corruption group, over 10 seeds and the corruptions of each group. The delays of the CTMs include their warm-up of 50 rounds. Bold: the fastest implementable method. Table 14 gives the false-alarm rates, the power, and the mean delays, and Table 11 –Table 15 give the other reference sizes.
Table 14. ImageNet-C, n = 1000 n = 1000 n = 1000 . 15 severity-5 corruptions × \times × 10 seeds after t 0 t_0 t 0 clean images; every method runs H = 2000 H = 2000 H = 2000 rounds past the change. False al. : rejection at or before t 0 t_0 t 0 ; power : P ( τ ≤ t 0 + H ∣ τ > t 0 ) \mathbb{P}(\tau\le t_0 + H \mid\tau> t_0) P ( τ ≤ t 0 + H ∣ τ > t 0 ) . Delays τ − t 0 \tau- t_0 τ − t 0 (warm-up rounds included), medians over the trials without a false alarm, misses counted as ∞ \infty ∞ ; the mean counts misses as H + 1 H + 1 H + 1 . The restarting portfolio rejects on M t M_t M t . Groups as in Shaer et al. [ [36 ] , Figure 4 . Bold : best implementable strategy.
Discussion
We introduced a parameter-free conditional conformal martingale for detecting distribution shifts at unknown times. The main idea is to recast the penalized betting problem as portfolio selection in a three-asset market and to restart a universal portfolio at every round. This eliminates the need for hyperparameter tuning in existing CCTMs while retaining anytime false-alarm control. It adapts to an unknown shift time at a logarithmic cost that our lower bound shows is unavoidable. We also developed an exact FFT-based implementation that runs in O ( T 2 ln T ) O(T^2 \ln T) O ( T 2 ln T ) time. Experiments on synthetic data and ImageNet-C agree with the theory: our detection delay depends only weakly on the length of the null period, unlike that of existing CTMs.
Limitations And Future Work. The detection-delay theory applies to shifts that are detectable by a constant post-shift bet, quantified by Δ > 0 \Delta> 0 Δ > 0 , and assumes a fixed alternative distribution Q Q Q . It thus does not directly cover nonstationary alternatives, such as recurring or gradual changes, although our experiments include the latter. One future direction is to replace the constant post-shift comparator by richer portfolio classes that can track time-varying alternatives while preserving anytime validity. Our method also uses a fixed score and a fixed reference dataset, so its power depends on whether the score reveals the shift. Designing the score and the betting strategy jointly may improve sensitivity to weak shifts.
Additional Related Work
Classical sequential hypothesis testing and change-point detection: Classical approaches to sequential hypothesis testing and change-point detection assumed simple, parametric settings where the null and alternative hypotheses are each specified by a single parametric distribution, and they generally focused on finite monitoring horizons. This literature dates as far back as Wald’s sequential probability ratio test (SPRT) [50 ] , designed for testing the null that all data in a sequence are sampled from a given distribution P P P against the alternative of all the data being sampled from a different distribution Q Q Q . Change-point detection, in contrast, refers to sequential tests where the alternative hypothesis allows for a change to a different distribution Q Q Q at an unknown time t 0 ≥ 0 t_0 \ge0 t 0 ≥ 0 . Page [ [25 ] introduced the CUSUM procedure for a simple, parametric change-point detection setting, where the procedure can be viewed as starting a Wald SPRT at every time step and rejecting the null as soon as the maximum over sequentially started SPRTs exceeds a threshold. The Shiryaev-Roberts procedure [39 , 40 , 35 ] is another classical approach to the same setting, which can be viewed as the sum of SPRTs started at every timestep. Validity guarantees for these classical procedures, however, have generally concerned the average run length (ARL) to a false alarm under the null hypothesis, rather than the anytime-valid setting of this paper. Lorden [ [19 ] and Moustakides [ [20 ] proved asymptotic and exact optimality results respectively for CUSUM with respect to minimizing the worst-case detection delay, for i.i.d. data from known distributions P P P and Q Q Q . Various optimality results exist for the Shiryaev-Roberts procedure as well, including those due to Shiryaev [ [40 ] , Pollak [ [27 ] , Pollak and Tartakovsky [ [28 ] .
Sequential anytime-valid testing of composite and nonparametric hypotheses: Recent work has substantially advanced sequential testing of composite and nonparametric hypotheses with anytime-valid guarantees over unbounded monitoring horizons. A null or alternative hypothesis is composite if it specifies a non-singleton set of distributions, and it is nonparametric if such a set is not parametrically specified. We refer to Ramdas et al. [ [33 ] for a more comprehensive review of this literature sometimes referred to as sequential anytime-valid inference (SAVI), to Shafer [ [37 ] for an overview of the closely related framework of testing-by-betting, and to Ramdas and Wang [ [30 ] for a recent textbook on the closely related topic of hypothesis testing with e-values. Anytime-valid guarantees fundamentally build on properties of test supermartingales [31 ] , especially Ville’s inequality [44 ] , which yields anytime-valid false-alarm control for nonnegative supermartingales. Conformal test martingales (CTMs) [Vovk, 2021] are a type of test supermartingale with anytime-valid guarantees for testing the null of exchangeability/i.i.d., and thus for testing for distribution shifts. E-processes are an important generalization of test supermartingales (see [33 ] , Section 2.4); for the purpose of change-point detection (with ARL control rather than anytime guarantees), e-detectors [38 ] can be constructed by running CUSUM or Shiryaev-Roberts procedures on top of an e-process.
Standard and conditional conformal test martingales: Monitoring the null hypothesis of exchangeable or i.i.d. data from an unknown distribution is a highly composite and nonparametric setting, and it is especially difficult when the time of a potential shift is also unknown. Standard conformal test martingales (CTMs), originally developed by Vovk et al. [ [48 ] and reviewed by Vovk [2021], provided the first framework for nontrivial anytime-valid testing of this null hypothesis. CTMs construct a betting process adapted to the filtration generated by conformal p p p -values. This filtration is coarser than the canonical data filtration, which may help explain their power for change-point detection [32 , 47 , 45 , 49 ] . Nonetheless, standard CTMs’ detection speed can suffer due to test-time contamination [36 ] or when the shift occurs after a long null period due to difficulty recovering wealth lost or difficulty adapting to the shift [10 ] .
Shaer et al. [ [36 ] inspired the present work with their introduction of conditional conformal test martingales (CCTMs), which accommodated a fixed reference dataset to avoid contamination from test-time samples by penalizing the betting function to account for finite-sample bias. The fixed reference dataset additionally allowed Shaer et al. [ [36 ] to prove guarantees on the detection power and detection delay of CCTMs, which had previously been elusive for standard CTMs, but only for an immediate change point occurring at the first round of testing. However, Shaer et al. [ [36 ] used the online Newton step of Cutkosky and Orabona [ [5 ] to fit the penalized betting function, which involves several hyperparameters that require tuning and can adapt slowly when a shift occurs after a long null period. The present paper addresses these limitations of CCTMs by introducing a parameter-free approach that is provably fast to adapt to an unknown shift time and empirically beats standard CTMs and the original CCTM when shifts occur after many null samples. Our approach combines a three-asset reformulation of CCTM bet selection, universal portfolios restarted every round and mixed using a heavy-tailed wealth allocation, and a fast FFT-based implementation. These mixture weights are distinct from the weights in weighted CTMs [29 ] , which weight nonconformity scores to extend standard CTMs to the null of covariate shift and an invariant conditional label distribution.
Proofs for Section 2
Proof of Proposition 2.1
The argument follows Shaer et al. [ [36 ] ; we include it for completeness. Fix D 0 ∈ G D_0 \in\mathcal{G} D 0 ∈ G and a round t ≥ 1 t \ge1 t ≥ 1 . Under the null, X t X_t X t has law P P P and is independent of F t − 1 \mathcal{F}_{t-1} F t − 1 . Since F F F is continuous, F ( X t ) F(X_t) F ( X t ) is uniform on [ 0 , 1 ] [0,1] [ 0 , 1 ] and independent of F t − 1 \mathcal{F}_{t-1} F t − 1 , so E H 0 [ F ( X t ) ∣ F t − 1 ] = 1 / 2 \mathbb{E}_{H_0}[F(X_t) \mid\mathcal{F}_{t-1}] = 1/2 E H 0 [ F ( X t ) ∣ F t − 1 ] = 1/2 . Because D 0 ∈ G D_0 \in\mathcal{G} D 0 ∈ G , the band (3) at x = X t x = X_t x = X t gives ∣ p ^ t − F ( X t ) ∣ ≤ ϵ ( p ^ t ) |\hat{p}_t - F(X_t)| \le\epsilon(\hat{p}_t) ∣ p ^ t − F ( X t ) ∣ ≤ ϵ ( p ^ t ) . Hence
∣ E H 0 [ p ^ t ∣ F t − 1 ] − 1 2 ∣ = ∣ E H 0 [ p ^ t − F ( X t ) ∣ F t − 1 ] ∣ ≤ E H 0 [ ϵ ( p ^ t ) ∣ F t − 1 ] . \left|\mathbb{E}_{H_0}[\hat{p}_t \mid\mathcal{F}_{t-1}] - \frac{1}{2}\right| = \left|\mathbb{E}_{H_0}[\hat{p}_t - F(X_t) \mid\mathcal{F}_{t-1}]\right| \le\mathbb{E}_{H_0}[\epsilon(\hat{p}_t) \mid\mathcal{F}_{t-1}] . E H 0 [ p ^ t ∣ F t − 1 ] − 2 1 = ∣ E H 0 [ p ^ t − F ( X t ) ∣ F t − 1 ] ∣ ≤ E H 0 [ ϵ ( p ^ t ) ∣ F t − 1 ] .
The bet η t \eta_t η t is F t − 1 \mathcal{F}_{t-1} F t − 1 -measurable, and b ( η t , ⋅ ) b(\eta_t,\cdot) b ( η t , ⋅ ) is the sum of an affine function of p ^ t \hat{p}_t p ^ t and the term − κ ∣ η t ∣ ϵ ( p ^ t ) -\kappa|\eta_t|\epsilon(\hat{p}_t) − κ ∣ η t ∣ ϵ ( p ^ t ) . Therefore
E H 0 [ b ( η t , p ^ t ) ∣ F t − 1 ] = 1 + κ ( η t ( E H 0 [ p ^ t ∣ F t − 1 ] − 1 2 ) − ∣ η t ∣ E H 0 [ ϵ ( p ^ t ) ∣ F t − 1 ] ) \mathbb{E}_{H_0}[b(\eta_t,\hat{p}_t) \mid\mathcal{F}_{t-1}] = 1 + \kappa\left(\eta_t\left(\mathbb{E}_{H_0}[\hat{p}_t \mid\mathcal{F}_{t-1}] - \frac{1}{2}\right) - |\eta_t|\mathbb{E}_{H_0}[\epsilon(\hat{p}_t) \mid\mathcal{F}_{t-1}]\right) E H 0 [ b ( η t , p ^ t ) ∣ F t − 1 ] = 1 + κ ( η t ( E H 0 [ p ^ t ∣ F t − 1 ] − 2 1 ) − ∣ η t ∣ E H 0 [ ϵ ( p ^ t ) ∣ F t − 1 ] )
≤ 1 + κ ∣ η t ∣ ( ∣ E H 0 [ p ^ t ∣ F t − 1 ] − 1 2 ∣ − E H 0 [ ϵ ( p ^ t ) ∣ F t − 1 ] ) ≤ 1. \le1 + \kappa|\eta_t|\left(\left|\mathbb{E}_{H_0}[\hat{p}_t \mid\mathcal{F}_{t-1}] - \frac{1}{2}\right| - \mathbb{E}_{H_0}[\epsilon(\hat{p}_t) \mid\mathcal{F}_{t-1}]\right) \le1 . ≤ 1 + κ ∣ η t ∣ ( E H 0 [ p ^ t ∣ F t − 1 ] − 2 1 − E H 0 [ ϵ ( p ^ t ) ∣ F t − 1 ] ) ≤ 1.
Since M t − 1 M_{t-1} M t − 1 is F t − 1 \mathcal{F}_{t-1} F t − 1 -measurable and nonnegative, E H 0 [ M t ∣ F t − 1 ] = M t − 1 E H 0 [ b ( η t , p ^ t ) ∣ F t − 1 ] ≤ M t − 1 \mathbb{E}_{H_0}[M_t \mid\mathcal{F}_{t-1}] = M_{t-1}\mathbb{E}_{H_0}[b(\eta_t,\hat{p}_t) \mid\mathcal{F}_{t-1}] \le M_{t-1} E H 0 [ M t ∣ F t − 1 ] = M t − 1 E H 0 [ b ( η t , p ^ t ) ∣ F t − 1 ] ≤ M t − 1 . Together with b ( η , p ) ≥ 0 b(\eta,p) \ge0 b ( η , p ) ≥ 0 for all η ∈ [ − 1 , 1 ] \eta\in[-1,1] η ∈ [ − 1 , 1 ] and p ∈ [ 0 , 1 ] p \in[0,1] p ∈ [ 0 , 1 ] (§ 2.1 ), this shows that ( M t ) t ≥ 0 (M_t)_{t\ge0} ( M t ) t ≥ 0 is a nonnegative supermartingale with M 0 = 1 M_0 = 1 M 0 = 1 . Ville’s inequality [44 ] gives the conditional bound. For the unconditional bound, average over D 0 D_0 D 0 , and use the conditional bound on G \mathcal{G} G and the trivial bound 1 1 1 outside it:
P H 0 { ∃ t ≥ 1 : M t ≥ 1 α } ≤ α P { D 0 ∈ G } + P { D 0 ∉ G } = α + ( 1 − α ) P { D 0 ∉ G } . \mathbb{P}_{H_0}\left\{\exists t \ge1 : M_t \ge\frac{1}{\alpha}\right\} \le\alpha\mathbb{P}\{D_0 \in\mathcal{G}\} + \mathbb{P}\{D_0 \notin\mathcal{G}\} = \alpha+ (1-\alpha)\mathbb{P}\{D_0 \notin\mathcal{G}\}. P H 0 { ∃ t ≥ 1 : M t ≥ α 1 } ≤ α P { D 0 ∈ G } + P { D 0 ∈ / G } = α + ( 1 − α ) P { D 0 ∈ / G } .
The right-hand side is at most α + ( 1 − α ) δ \alpha+ (1-\alpha)\delta α + ( 1 − α ) δ , since P { D 0 ∉ G } ≤ δ \mathbb{P}\{D_0 \notin\mathcal{G}\} \le\delta P { D 0 ∈ / G } ≤ δ by the choice of the band. □
Proof of Lemma 2.3
Fix w ∈ W w \in\mathcal{W} w ∈ W and let η : = w + − w − ∈ [ − 1 , 1 ] \eta:= w^+ - w^- \in[-1,1] η := w + − w − ∈ [ − 1 , 1 ] . Since w + + w − = ∣ w + − w − ∣ + 2 min { w + , w − } w^+ + w^- = |w^+ - w^-| + 2\min\{w^+,w^-\} w + + w − = ∣ w + − w − ∣ + 2 min { w + , w − } , substituting into (5) gives
⟨ w , x t ⟩ = 1 + κ ( η ( p ^ t − 1 2 ) − ∣ η ∣ ϵ ( p ^ t ) ) − 2 κ min { w + , w − } ϵ ( p ^ t ) , \langle w,x_t\rangle= 1 + \kappa\left(\eta\left(\hat{p}_t-\frac{1}{2}\right)-|\eta|\epsilon(\hat{p}_t)\right)-2\kappa\min\{w^+,w^-\}\epsilon(\hat{p}_t), ⟨ w , x t ⟩ = 1 + κ ( η ( p ^ t − 2 1 ) − ∣ η ∣ ϵ ( p ^ t ) ) − 2 κ min { w + , w − } ϵ ( p ^ t ) ,
which is (6) by the definition (4) .
For η ∈ [ − 1 , 1 ] \eta\in[-1,1] η ∈ [ − 1 , 1 ] , the coordinates of w ( η ) = ( 1 − ∣ η ∣ , η + , η − ) w(\eta)=(1-|\eta|,\eta^+,\eta^-) w ( η ) = ( 1 − ∣ η ∣ , η + , η − ) are nonnegative and sum to 1 − ∣ η ∣ + η + + η − = 1 1-|\eta|+\eta^++\eta^-=1 1 − ∣ η ∣ + η + + η − = 1 , so w ( η ) ∈ W w(\eta)\in\mathcal{W} w ( η ) ∈ W . Its risky weights satisfy η + − η − = η \eta^+-\eta^-=\eta η + − η − = η and min { η + , η − } = 0 \min\{\eta^+,\eta^-\}=0 min { η + , η − } = 0 , so (6) gives ⟨ w ( η ) , x t ⟩ = b ( η , p ^ t ) \langle w(\eta),x_t\rangle=b(\eta,\hat{p}_t) ⟨ w ( η ) , x t ⟩ = b ( η , p ^ t ) .
Fix rounds 1 ≤ s ≤ t 1 \le s \le t 1 ≤ s ≤ t . Both maxima in the last claim exist, since they maximize continuous functions over compact sets. For every w ∈ W w \in\mathcal{W} w ∈ W , (6) and x i ∈ [ 0 , 2 ] 3 x_i \in[0,2]^3 x i ∈ [ 0 , 2 ] 3 give 0 ≤ ⟨ w , x i ⟩ ≤ b ( w + − w − , p ^ i ) 0 \le\langle w,x_i\rangle\le b(w^+ - w^-,\hat{p}_i) 0 ≤ ⟨ w , x i ⟩ ≤ b ( w + − w − , p ^ i ) in every round i i i . Multiplying these nonnegative factors over i = s , … , t i=s,\ldots,t i = s , … , t gives
∏ i = s t ⟨ w , x i ⟩ ≤ ∏ i = s t b ( w + − w − , p ^ i ) ≤ max η ∈ [ − 1 , 1 ] ∏ i = s t b ( η , p ^ i ) . \prod_{i=s}^{t}\langle w,x_i\rangle\le\prod_{i=s}^{t}b(w^+-w^-,\hat{p}_i) \le\max_{\eta\in[-1,1]}\prod_{i=s}^{t}b(\eta,\hat{p}_i). i = s ∏ t ⟨ w , x i ⟩ ≤ i = s ∏ t b ( w + − w − , p ^ i ) ≤ η ∈ [ − 1 , 1 ] max i = s ∏ t b ( η , p ^ i ) .
and maximizing over w w w proves the inequality “≤ \le ≤ ”. Conversely, for every η ∈ [ − 1 , 1 ] \eta\in[-1,1] η ∈ [ − 1 , 1 ] , the second claim gives ∏ i = s t b ( η , p ^ i ) = ∏ i = s t ⟨ w ( η ) , x i ⟩ \prod_{i=s}^{t}b(\eta,\hat{p}_i)=\prod_{i=s}^{t}\langle w(\eta),x_i\rangle ∏ i = s t b ( η , p ^ i ) = ∏ i = s t ⟨ w ( η ) , x i ⟩ , which is at most the maximum over W \mathcal{W} W . Maximizing over η \eta η proves the inequality “≥ \ge ≥ ”.
Proof of Proposition 2.4
Since w t ∈ W w_t \in\mathcal{W} w t ∈ W is F t − 1 \mathcal{F}_{t-1} F t − 1 -measurable, so is η t = w t + − w t − ∈ [ − 1 , 1 ] \eta_t=w_t^+-w_t^- \in[-1,1] η t = w t + − w t − ∈ [ − 1 , 1 ] . By (6) , b ( η t , p ^ t ) = ⟨ w t , x t ⟩ + 2 κ min { w t + , w t − } ϵ ( p ^ t ) ≥ ⟨ w t , x t ⟩ ≥ 0 b(\eta_t,\hat{p}_t)=\langle w_t,x_t\rangle+2\kappa\min\{w_t^+,w_t^-\}\epsilon(\hat{p}_t)\ge\langle w_t,x_t\rangle\ge0 b ( η t , p ^ t ) = ⟨ w t , x t ⟩ + 2 κ min { w t + , w t − } ϵ ( p ^ t ) ≥ ⟨ w t , x t ⟩ ≥ 0 in every round. Multiplying these nonnegative factors gives M t ≥ Wealth t M_t\ge\operatorname{Wealth}_t M t ≥ Wealth t for every t ≥ 0 t\ge0 t ≥ 0 . Since { τ < ∞ } = { ∃ t ≥ 1 : M t ≥ 1 / α } \{\tau<\infty\}=\{\exists t\ge1:M_t\ge1/\alpha\} { τ < ∞ } = { ∃ t ≥ 1 : M t ≥ 1/ α } , the remaining claims are Proposition 2.1 applied to ( η t ) t ≥ 1 (\eta_t)_{t\ge1} ( η t ) t ≥ 1 .
Proofs for Section 3
Constant Bets After a Long Null Phase
This appendix makes precise the claim of Section 3 that constant bets adapt slowly to late shifts. The loss of a constant bet before the shift and its gain after the shift are governed by
Δ P : = E P [ ϵ ( p ^ t ) ∣ D 0 ] − ∣ E P [ p ^ t − 1 2 | D 0 ] ∣ and Δ Q : = ∣ E Q [ p ^ t − 1 2 | D 0 ] ∣ − E Q [ ϵ ( p ^ t ) ∣ D 0 ] , \Delta_P:=\mathbb{E}_P[\epsilon(\hat{p}_t)\mid D_0]-\left|\mathbb{E}_P\left[\hat{p}_t-\frac{1}{2}\,\middle|\,D_0\right]\right|
\quad\text{and}\quad
\Delta_Q:=\left|\mathbb{E}_Q\left[\hat{p}_t-\frac{1}{2}\,\middle|\,D_0\right]\right|-\mathbb{E}_Q[\epsilon(\hat{p}_t)\mid D_0], Δ P := E P [ ϵ ( p ^ t ) ∣ D 0 ] − E P [ p ^ t − 2 1 D 0 ] and Δ Q := E Q [ p ^ t − 2 1 D 0 ] − E Q [ ϵ ( p ^ t ) ∣ D 0 ] ,
where the subscript gives the law of X t X_t X t , so that Δ Q \Delta_Q Δ Q is the signal strength (12) . For a bet η ∈ [ − 1 , 1 ] \eta\in[-1,1] η ∈ [ − 1 , 1 ] , let τ η : = inf { t ≥ 1 : ∏ i = 1 t b ( η , p ^ i ) ≥ 1 / α } \tau_\eta:=\inf\{t\ge1:\prod_{i=1}^{t}b(\eta,\hat{p}_i)\ge1/\alpha\} τ η := inf { t ≥ 1 : ∏ i = 1 t b ( η , p ^ i ) ≥ 1/ α } be the rejection time of the test that bets η \eta η in every round.
Proposition C.1. Under (2) with a shift after round t 0 ≥ 0 t_0\ge0 t 0 ≥ 0 , let D 0 ∈ G D_0\in\mathcal{G} D 0 ∈ G . Then Δ P ≥ 0 \Delta_P\ge0 Δ P ≥ 0 , and the following hold.
(a) For every η ∈ [ − 1 , 1 ] \eta\in[-1,1] η ∈ [ − 1 , 1 ] and every t ≥ t 0 t\ge t_0 t ≥ t 0 ,
E H 1 [ ∑ i = 1 t ln b ( η , p ^ i ) ∣ D 0 ] ≤ κ ∣ η ∣ ( ( t − t 0 ) Δ Q − t 0 Δ P ) . \mathbb{E}_{H_1}\left[\left.\sum_{i=1}^{t}\ln b(\eta,\hat{p}_i)\,\right|\,D_0\right]\le\kappa|\eta|\bigl((t-t_0)\Delta_Q-t_0\Delta_P\bigr). E H 1 [ i = 1 ∑ t ln b ( η , p ^ i ) D 0 ] ≤ κ ∣ η ∣ ( ( t − t 0 ) Δ Q − t 0 Δ P ) . (b) For every η \eta η with 0 < ∣ η ∣ < 1 0<|\eta|<1 0 < ∣ η ∣ < 1 , if Δ Q > 0 \Delta_Q>0 Δ Q > 0 , then
E H 1 [ ( τ η − t 0 ) + ∣ D 0 ] ≥ ( 1 − α ) ( Δ P Δ Q t 0 + ln ( 1 / α ) κ ∣ η ∣ Δ Q ) , \mathbb{E}_{H_1}\left[\left.(\tau_\eta-t_0)_+\,\right|\,D_0\right]\ge(1-\alpha)\left(\frac{\Delta_P}{\Delta_Q}t_0+\frac{\ln(1/\alpha)}{\kappa|\eta|\Delta_Q}\right), E H 1 [ ( τ η − t 0 ) + ∣ D 0 ] ≥ ( 1 − α ) ( Δ Q Δ P t 0 + κ ∣ η ∣ Δ Q ln ( 1/ α ) ) , and if Δ Q ≤ 0 \Delta_Q\le0 Δ Q ≤ 0 , the left-hand side is infinite.
By (a), if Δ Q > 0 \Delta_Q>0 Δ Q > 0 , the expected log-wealth of every constant bet is nonpositive until t ≥ t 0 + t 0 Δ P / Δ Q t\ge t_0+t_0\Delta_P/\Delta_Q t ≥ t 0 + t 0 Δ P / Δ Q , a number of post-shift rounds linear in t 0 t_0 t 0 . By (b), the same holds for the expected detection delay whenever Δ P > 0 \Delta_P>0 Δ P > 0 : the wealth lost before the shift must be recovered before the test can reject. In contrast, Corollary 4.2 bounds the expected delay of the restarting portfolio by a function of t 0 t_0 t 0 that grows only logarithmically. Part (b) does not apply to learners that change their bets, such as ONS, but by (a), a regret bound against constant bets guarantees them little over the same number of post-shift rounds. We exclude ∣ η ∣ = 1 |\eta|=1 ∣ η ∣ = 1 from (b) only to keep the log-returns bounded.
Proof of Proposition C.1. Throughout, we condition on D 0 ∈ G D_0 \in\mathcal{G} D 0 ∈ G and omit it from the notation. Given D 0 D_0 D 0 , the p p p -values p ^ 1 , p ^ 2 , … \hat{p}_1,\hat{p}_2,\ldots p ^ 1 , p ^ 2 , … are independent, and p ^ i \hat{p}_i p ^ i has the law of F ^ 0 ( X ) \hat{F}_0(X) F ^ 0 ( X ) with X ∼ P X \sim P X ∼ P for i ≤ t 0 i \leq t_0 i ≤ t 0 and with X ∼ Q X \sim Q X ∼ Q for i > t 0 i > t_0 i > t 0 . We first show Δ P ≥ 0 \Delta_P \geq0 Δ P ≥ 0 . Under H 0 H_0 H 0 , the conditional law of p ^ t \hat{p}_t p ^ t given F t − 1 \mathcal{F}_{t-1} F t − 1 is the law of F ^ 0 ( X ) \hat{F}_0(X) F ^ 0 ( X ) with X ∼ P X \sim P X ∼ P , so the first display in the proof of Proposition 2.1 reads
∣ E P [ p ^ t − 1 / 2 ] ∣ ≤ E P [ ϵ ( p ^ t ) ] . \left|\mathbb{E}_P[\hat{p}_t-1/2]\right| \leq\mathbb{E}_P[\epsilon(\hat{p}_t)]. ∣ E P [ p ^ t − 1/2 ] ∣ ≤ E P [ ϵ ( p ^ t )] .
(a) Fix η ∈ [ − 1 , 1 ] \eta\in[-1,1] η ∈ [ − 1 , 1 ] . For i ≤ t 0 i \leq t_0 i ≤ t 0 , Jensen’s inequality, the inequality ln ( 1 + z ) ≤ z \ln(1+z) \leq z ln ( 1 + z ) ≤ z , and η y ≤ ∣ η ∣ ∣ y ∣ \eta y \leq|\eta||y| η y ≤ ∣ η ∣∣ y ∣ give
E H 1 [ ln b ( η , p ^ i ) ] ≤ ln E H 1 [ b ( η , p ^ i ) ] ≤ κ ∣ η ∣ ( ∣ E P [ p ^ i − 1 2 ] ∣ − E P [ ϵ ( p ^ i ) ] ) = − κ ∣ η ∣ Δ P . \mathbb{E}_{H_1}[\ln b(\eta,\hat{p}_i)] \leq\ln\mathbb{E}_{H_1}[b(\eta,\hat{p}_i)] \leq\kappa|\eta|\left(\left|\mathbb{E}_P\left[\hat{p}_i-\frac{1}{2}\right]\right|-\mathbb{E}_P[\epsilon(\hat{p}_i)]\right)=-\kappa|\eta|\Delta_P. E H 1 [ ln b ( η , p ^ i )] ≤ ln E H 1 [ b ( η , p ^ i )] ≤ κ ∣ η ∣ ( E P [ p ^ i − 2 1 ] − E P [ ϵ ( p ^ i )] ) = − κ ∣ η ∣ Δ P .
For i > t 0 i>t_0 i > t 0 , the same steps under Q Q Q give the upper bound κ ∣ η ∣ Δ Q \kappa|\eta|\Delta_Q κ ∣ η ∣ Δ Q . Summing over i = 1 , … , t i=1,\ldots,t i = 1 , … , t proves (a).
(b) Fix η \eta η with 0 < ∣ η ∣ < 1 0<|\eta|<1 0 < ∣ η ∣ < 1 , and write τ : = τ η \tau:=\tau_\eta τ := τ η , N : = ( τ − t 0 ) + N:=(\tau-t_0)_+ N := ( τ − t 0 ) + , Y i : = ln b ( η , p ^ i ) Y_i:=\ln b(\eta,\hat{p}_i) Y i := ln b ( η , p ^ i ) , and S t : = ∑ i = 1 t Y i S_t:=\sum_{i=1}^tY_i S t := ∑ i = 1 t Y i , so that τ = inf { t ≥ 1 : S t ≥ ln ( 1 / α ) } \tau=\inf\{t\geq1:S_t\geq\ln(1/\alpha)\} τ = inf { t ≥ 1 : S t ≥ ln ( 1/ α )} . Since 1 − ∣ η ∣ ≤ b ( η , p ) ≤ 2 1-|\eta|\leq b(\eta,p)\leq2 1 − ∣ η ∣ ≤ b ( η , p ) ≤ 2 for all p ∈ [ 0 , 1 ] p\in[0,1] p ∈ [ 0 , 1 ] by the definition of κ \kappa κ , the variables Y i Y_i Y i are bounded. They are independent, Y i Y_i Y i is independent of F i − 1 \mathcal{F}_{i-1} F i − 1 , and their means μ P : = E H 1 [ Y i ] \mu_P:=\mathbb{E}_{H_1}[Y_i] μ P := E H 1 [ Y i ] for i ≤ t 0 i\leq t_0 i ≤ t 0 and μ Q : = E H 1 [ Y i ] \mu_Q:=\mathbb{E}_{H_1}[Y_i] μ Q := E H 1 [ Y i ] for i > t 0 i>t_0 i > t 0 satisfy μ P ≤ − κ ∣ η ∣ Δ P ≤ 0 \mu_P\leq-\kappa|\eta|\Delta_P\leq0 μ P ≤ − κ ∣ η ∣ Δ P ≤ 0 and μ Q ≤ κ ∣ η ∣ Δ Q \mu_Q\leq\kappa|\eta|\Delta_Q μ Q ≤ κ ∣ η ∣ Δ Q by the proof of (a).
We first bound the log-wealth at the shift on the event of no false alarm. The event { τ ≤ t 0 } \{\tau\leq t_0\} { τ ≤ t 0 } depends only on D 0 , X 1 , … , X t 0 D_0,X_1,\ldots,X_{t_0} D 0 , X 1 , … , X t 0 , whose law is the same under H 0 H_0 H 0 and H 1 H_1 H 1 , so Proposition 2.1 gives P H 1 { τ ≤ t 0 } ≤ α \mathbb{P}_{H_1}\{\tau\leq t_0\}\leq\alpha P H 1 { τ ≤ t 0 } ≤ α . Since ∑ i = 1 t 0 Y i 1 { τ < i } \sum_{i=1}^{t_0}Y_i\mathbf{1}\{\tau<i\} ∑ i = 1 t 0 Y i 1 { τ < i } equals S t 0 − S τ S_{t_0}-S_\tau S t 0 − S τ on { τ ≤ t 0 } \{\tau\leq t_0\} { τ ≤ t 0 } and vanishes on { τ > t 0 } \{\tau>t_0\} { τ > t 0 } , we have S t 0 1 { τ ≤ t 0 } = S τ 1 { τ ≤ t 0 } + ∑ i = 1 t 0 Y i 1 { τ < i } S_{t_0}\mathbf{1}\{\tau\leq t_0\}=S_\tau\mathbf{1}\{\tau\leq t_0\}+\sum_{i=1}^{t_0}Y_i\mathbf{1}\{\tau<i\} S t 0 1 { τ ≤ t 0 } = S τ 1 { τ ≤ t 0 } + ∑ i = 1 t 0 Y i 1 { τ < i } , where S τ ≥ ln ( 1 / α ) > 0 S_\tau\geq\ln(1/\alpha)>0 S τ ≥ ln ( 1/ α ) > 0 on { τ ≤ t 0 } \{\tau\leq t_0\} { τ ≤ t 0 } . Since { τ < i } ∈ F i − 1 \{\tau<i\}\in\mathcal{F}_{i-1} { τ < i } ∈ F i − 1 , each term satisfies E H 1 [ Y i 1 { τ < i } ] = μ P P H 1 { τ < i } ≥ α μ P \mathbb{E}_{H_1}[Y_i\mathbf{1}\{\tau<i\}]=\mu_P\mathbb{P}_{H_1}\{\tau<i\}\geq\alpha\mu_P E H 1 [ Y i 1 { τ < i }] = μ P P H 1 { τ < i } ≥ α μ P , and therefore
E H 1 [ − S t 0 1 { τ > t 0 } ] = − t 0 μ P + E H 1 [ S t 0 1 { τ ≤ t 0 } ] ≥ − t 0 μ P + α t 0 μ P = ( 1 − α ) t 0 ∣ μ P ∣ . \mathbb{E}_{H_1}[-S_{t_0}\mathbf{1}\{\tau>t_0\}]=-t_0\mu_P+\mathbb{E}_{H_1}[S_{t_0}\mathbf{1}\{\tau\leq t_0\}]\geq-t_0\mu_P+\alpha t_0\mu_P=(1-\alpha)t_0|\mu_P|. E H 1 [ − S t 0 1 { τ > t 0 }] = − t 0 μ P + E H 1 [ S t 0 1 { τ ≤ t 0 }] ≥ − t 0 μ P + α t 0 μ P = ( 1 − α ) t 0 ∣ μ P ∣.
We now turn to the rounds after the shift. If E H 1 [ N ] = ∞ \mathbb{E}_{H_1}[N]=\infty E H 1 [ N ] = ∞ , there is nothing to prove, so assume E H 1 [ N ] < ∞ \mathbb{E}_{H_1}[N]<\infty E H 1 [ N ] < ∞ . The delay N N N is a stopping time with respect to ( F t 0 + k ) k ≥ 0 (\mathcal{F}_{t_0+k})_{k\geq0} ( F t 0 + k ) k ≥ 0 , and Y t 0 + k Y_{t_0+k} Y t 0 + k is independent of F t 0 + k − 1 \mathcal{F}_{t_0+k-1} F t 0 + k − 1 with mean μ Q \mu_Q μ Q for every k ≥ 1 k\geq1 k ≥ 1 , so Wald’s identity gives E H 1 [ ∑ k = 1 N Y t 0 + k ] = μ Q E H 1 [ N ] \mathbb{E}_{H_1}\left[\sum_{k=1}^N Y_{t_0+k}\right]=\mu_Q\mathbb{E}_{H_1}[N] E H 1 [ ∑ k = 1 N Y t 0 + k ] = μ Q E H 1 [ N ] . On { τ > t 0 } \{\tau>t_0\} { τ > t 0 } , the delay N = τ − t 0 N=\tau-t_0 N = τ − t 0 is finite almost surely, and S t 0 + ∑ k = 1 N Y t 0 + k = S τ ≥ ln ( 1 / α ) S_{t_0}+\sum_{k=1}^NY_{t_0+k}=S_\tau\geq\ln(1/\alpha) S t 0 + ∑ k = 1 N Y t 0 + k = S τ ≥ ln ( 1/ α ) ; on { τ ≤ t 0 } \{\tau\leq t_0\} { τ ≤ t 0 } , the sum is empty. Together with P H 1 { τ > t 0 } ≥ 1 − α \mathbb{P}_{H_1}\{\tau>t_0\}\geq1-\alpha P H 1 { τ > t 0 } ≥ 1 − α and the previous display,
μ Q E H 1 [ N ] ≥ E H 1 [ ( ln 1 α − S t 0 ) 1 { τ > t 0 } ] ≥ ( 1 − α ) ( ln 1 α + t 0 ∣ μ P ∣ ) > 0. \mu_Q\mathbb{E}_{H_1}[N]\geq\mathbb{E}_{H_1}\left[\left(\ln\frac{1}{\alpha}-S_{t_0}\right)\mathbf{1}\{\tau>t_0\}\right]\geq(1-\alpha)\left(\ln\frac{1}{\alpha}+t_0|\mu_P|\right)>0. μ Q E H 1 [ N ] ≥ E H 1 [ ( ln α 1 − S t 0 ) 1 { τ > t 0 } ] ≥ ( 1 − α ) ( ln α 1 + t 0 ∣ μ P ∣ ) > 0.
Hence μ Q > 0 \mu_Q>0 μ Q > 0 , and thus Δ Q > 0 \Delta_Q>0 Δ Q > 0 , since μ Q ≤ κ ∣ η ∣ Δ Q \mu_Q\leq\kappa|\eta|\Delta_Q μ Q ≤ κ ∣ η ∣ Δ Q . This shows that E H 1 [ N ] = ∞ \mathbb{E}_{H_1}[N]=\infty E H 1 [ N ] = ∞ if Δ Q ≤ 0 \Delta_Q\leq0 Δ Q ≤ 0 . If Δ Q > 0 \Delta_Q>0 Δ Q > 0 , dividing by μ Q ≤ κ ∣ η ∣ Δ Q \mu_Q\leq\kappa|\eta|\Delta_Q μ Q ≤ κ ∣ η ∣ Δ Q and using ∣ μ P ∣ ≥ κ ∣ η ∣ Δ P |\mu_P|\geq\kappa|\eta|\Delta_P ∣ μ P ∣ ≥ κ ∣ η ∣ Δ P proves (b). □
Proof of Proposition 3.1
Throughout, W e a l t h t \mathrm{Wealth}_t Wealth t denotes the mixture (9), so that W e a l t h 0 = r 0 = 1 \mathrm{Wealth}_0=r_0=1 Wealth 0 = r 0 = 1 , and Z t : = ∫ W B t ( w ) μ ( d w ) + r t Z_t:=\int_{\mathcal{W}}B_t(w)\mu(dw)+r_t Z t := ∫ W B t ( w ) μ ( d w ) + r t denotes the denominator in (10). Unrolling the recursion gives B t ( w ) = ∑ i = 1 t π i ∏ j = i t − 1 ⟨ w , x j ⟩ B_t(w)=\sum_{i=1}^t\pi_i\prod_{j=i}^{t-1}\langle w,x_j\rangle B t ( w ) = ∑ i = 1 t π i ∏ j = i t − 1 ⟨ w , x j ⟩ for every t ≥ 1 t\geq1 t ≥ 1 , where the empty product is one. Since x t ∈ [ 0 , 2 ] 3 x_t\in[0,2]^3 x t ∈ [ 0 , 2 ] 3 , the polynomial B t B_t B t is nonnegative on W \mathcal{W} W , and the definition of W e a l t h t g \mathrm{Wealth}_t^g Wealth t g gives, for every t ≥ 1 t\geq1 t ≥ 1 ,
∫ W ⟨ w , x t ⟩ B t ( w ) μ ( d w ) = ∑ i = 1 t π i ∫ W ∏ j = i t ⟨ w , x j ⟩ μ ( d w ) = ∑ i = 1 t W e a l t h t i . \int_{\mathcal{W}}\langle w,x_t\rangle B_t(w)\mu(dw)=\sum_{i=1}^t\pi_i\int_{\mathcal{W}}\prod_{j=i}^t\langle w,x_j\rangle\mu(dw)=\sum_{i=1}^t\mathrm{Wealth}_t^i. ∫ W ⟨ w , x t ⟩ B t ( w ) μ ( d w ) = i = 1 ∑ t π i ∫ W j = i ∏ t ⟨ w , x j ⟩ μ ( d w ) = i = 1 ∑ t Wealth t i .
We first show that Z t = W e a l t h t − 1 Z_t=\mathrm{Wealth}_{t-1} Z t = Wealth t − 1 . Splitting off the term i = t i=t i = t , whose product is empty, gives ∫ W B t ( w ) μ ( d w ) = ∑ i = 1 t − 1 W e a l t h t − 1 i + π t \int_{\mathcal{W}}B_t(w)\mu(dw)=\sum_{i=1}^{t-1}\mathrm{Wealth}_{t-1}^i+\pi_t ∫ W B t ( w ) μ ( d w ) = ∑ i = 1 t − 1 Wealth t − 1 i + π t , and π t + r t = r t − 1 \pi_t+r_t=r_{t-1} π t + r t = r t − 1 , so Z t = ∑ i = 1 t − 1 W e a l t h t − 1 i + r t − 1 = W e a l t h t − 1 Z_t=\sum_{i=1}^{t-1}\mathrm{Wealth}_{t-1}^i+r_{t-1}=\mathrm{Wealth}_{t-1} Z t = ∑ i = 1 t − 1 Wealth t − 1 i + r t − 1 = Wealth t − 1 . In particular, Z t ≥ r t > 0 Z_t\geq r_t>0 Z t ≥ r t > 0 , because all weights π s \pi_s π s are positive, so w t w_t w t is well defined. The numerator of (10) has nonnegative coordinates, which sum to Z t Z_t Z t because w 0 + w + + w − = 1 w^0+w^++w^-=1 w 0 + w + + w − = 1 on W \mathcal{W} W , so w t ∈ W w_t\in\mathcal{W} w t ∈ W . Moreover, w t w_t w t depends only on x 1 , … , x t − 1 x_1,\ldots,x_{t-1} x 1 , … , x t − 1 , which are functions of D 0 , X 1 , … , X t − 1 D_0,X_1,\ldots,X_{t-1} D 0 , X 1 , … , X t − 1 , so it is F t − 1 \mathcal{F}_{t-1} F t − 1 -measurable. Finally, since ⟨ ( 1 , 0 , 0 ) , x t ⟩ = x t 0 = 1 \langle(1,0,0),x_t\rangle=x_t^0=1 ⟨( 1 , 0 , 0 ) , x t ⟩ = x t 0 = 1 ,
W e a l t h t − 1 ⟨ w t , x t ⟩ = ∫ W ⟨ w , x t ⟩ B t ( w ) μ ( d w ) + r t = ∑ i = 1 t W e a l t h t i + r t = W e a l t h t . \mathrm{Wealth}_{t-1}\langle w_t,x_t\rangle=\int_{\mathcal{W}}\langle w,x_t\rangle B_t(w)\mu(dw)+r_t=\sum_{i=1}^t\mathrm{Wealth}_t^i+r_t=\mathrm{Wealth}_t. Wealth t − 1 ⟨ w t , x t ⟩ = ∫ W ⟨ w , x t ⟩ B t ( w ) μ ( d w ) + r t = i = 1 ∑ t Wealth t i + r t = Wealth t .
By induction from W e a l t h 0 = 1 \mathrm{Wealth}_0=1 Wealth 0 = 1 , the wealth ∏ i = 1 t ⟨ w i , x i ⟩ \prod_{i=1}^t\langle w_i,x_i\rangle ∏ i = 1 t ⟨ w i , x i ⟩ of ( w t ) t ≥ 1 (w_t)_{t\geq1} ( w t ) t ≥ 1 equals (9) for every $t\geq0. □
The Regret Bound
Cover and Ordentlich [ [4 ] show that, in a market with three assets and arbitrary nonnegative price relatives, the universal portfolio with the prior μ = Dirichlet ( 1 / 2 , 1 / 2 , 1 / 2 ) \mu= \operatorname{Dirichlet}(1/2, 1/2, 1/2) μ = Dirichlet ( 1/2 , 1/2 , 1/2 ) started at round s s s earns by round t t t at least the fraction
Γ ( 3 / 2 ) Γ ( t − s + 3 / 2 ) Γ ( 1 / 2 ) Γ ( t − s + 5 / 2 ) \frac{\Gamma(3/2)\Gamma(t-s+3/2)}{\Gamma(1/2)\Gamma(t-s+5/2)} Γ ( 1/2 ) Γ ( t − s + 5/2 ) Γ ( 3/2 ) Γ ( t − s + 3/2 )
of the wealth of the best CRP in hindsight over the rounds s , … , t s,\ldots,t s , … , t . Since Γ ( 3 / 2 ) = Γ ( 1 / 2 ) / 2 \Gamma(3/2) = \Gamma(1/2)/2 Γ ( 3/2 ) = Γ ( 1/2 ) /2 and Γ ( t − s + 5 / 2 ) = ( t − s + 3 / 2 ) Γ ( t − s + 3 / 2 ) \Gamma(t-s+5/2) = (t-s+3/2)\Gamma(t-s+3/2) Γ ( t − s + 5/2 ) = ( t − s + 3/2 ) Γ ( t − s + 3/2 ) , this fraction equals 1 / ( 2 ( t − s ) + 3 ) 1/(2(t-s)+3) 1/ ( 2 ( t − s ) + 3 ) . The wealth of this universal portfolio is the mixture on the left-hand side of (8) , so taking logarithms gives (8) .
Proof of Lemma 3.2
By Proposition 3.1, the wealth Wealth t \operatorname{Wealth}_t Wealth t of the restarting portfolio equals (9) , whose terms are all nonnegative, so Wealth t ≥ Wealth t s \operatorname{Wealth}_t \ge\operatorname{Wealth}_t^s Wealth t ≥ Wealth t s for every s ≤ t s \le t s ≤ t . By the regret bound (8) and Lemma 2.3,
ln Wealth t s − ln π s ≥ max w ∈ W ∑ i = s t ln ⟨ w , x i ⟩ − ln ( 2 ( t − s ) + 3 ) = max η ∈ [ − 1 , 1 ] ∑ i = s t ln b ( η , p ^ i ) − ln ( 2 ( t − s ) + 3 ) . \ln\operatorname{Wealth}_t^s-\ln\pi_s \ge\max_{w\in\mathcal{W}}\sum_{i=s}^{t}\ln\langle w,x_i\rangle-\ln(2(t-s)+3)=\max_{\eta\in[-1,1]}\sum_{i=s}^{t}\ln b(\eta,\hat{p}_i)-\ln(2(t-s)+3). ln Wealth t s − ln π s ≥ w ∈ W max i = s ∑ t ln ⟨ w , x i ⟩ − ln ( 2 ( t − s ) + 3 ) = η ∈ [ − 1 , 1 ] max i = s ∑ t ln b ( η , p ^ i ) − ln ( 2 ( t − s ) + 3 ) .
This proves the second inequality, and Proposition 2.4 gives M t ≥ Wealth t M_t \ge\operatorname{Wealth}_t M t ≥ Wealth t .
The Restart Cost of the Heavy-Tailed Allocation
We show that the allocation (11) satisfies, for every s ≥ 1 s \ge1 s ≥ 1 ,
ln 1 π s ≤ ln ( s + 2 ) + 2 ln ln ( s + 2 ) + ln 1 ln 2 , (13) \ln\frac{1}{\pi_s}\le\ln(s+2)+2\ln\ln(s+2)+\ln\frac{1}{\ln2}, \tag*{(13)} ln π s 1 ≤ ln ( s + 2 ) + 2 ln ln ( s + 2 ) + ln ln 2 1 , (13)
which, plugged into Lemma 3.2, gives Corollary 3.3. Since x ↦ 1 / ( x ln 2 x ) x\mapsto1/(x\ln^2x) x ↦ 1/ ( x ln 2 x ) monotonically decreases for x > 1 x>1 x > 1 ,
π s = ln 2 ∫ s + 1 s + 2 d x x ln 2 x ≥ ln 2 ( s + 2 ) ln 2 ( s + 2 ) , \pi_s=\ln2\int_{s+1}^{s+2}\frac{dx}{x\ln^2x}\ge\frac{\ln2}{(s+2)\ln^2(s+2)}, π s = ln 2 ∫ s + 1 s + 2 x ln 2 x d x ≥ ( s + 2 ) ln 2 ( s + 2 ) ln 2 ,
and taking logarithms gives (13) .
Proofs for Section 4
Throughout this appendix, X X X denotes a random variable with law Q Q Q that is independent of D 0 \mathcal{D}_0 D 0 , and p ^ : = F ^ 0 ( X ) \hat{p}:=\hat{F}_0(X) p ^ := F ^ 0 ( X ) . Under (2) and given D 0 \mathcal{D}_0 D 0 , the p p p -values p ^ t \hat{p}_t p ^ t with t > t 0 t>t_0 t > t 0 are i.i.d. copies of p ^ \hat{p} p ^ , so that Δ = ∣ E Q [ p ^ − 1 / 2 ∣ D 0 ] ∣ − E Q [ ϵ ( p ^ ) ∣ D 0 ] \Delta=\lvert\mathbb{E}_Q[\hat{p}-1/2\mid\mathcal{D}_0]\rvert-\mathbb{E}_Q[\epsilon(\hat{p})\mid\mathcal{D}_0] Δ = ∣ E Q [ p ^ − 1/2 ∣ D 0 ]∣ − E Q [ ϵ ( p ^ ) ∣ D 0 ] .
False-Alarm Control
Corollary D.1. Let ( w t ) t ≥ 1 (w_t)_{t\ge1} ( w t ) t ≥ 1 be the restarting portfolio (10) , define ( M t ) t ≥ 0 (M_t)_{t\ge0} ( M t ) t ≥ 0 by (7) , and let τ : = inf { t ≥ 1 : M t ≥ 1 / α } \tau:=\inf\{t\ge1:M_t\ge1/\alpha\} τ := inf { t ≥ 1 : M t ≥ 1/ α } . If D 0 ∈ G \mathcal{D}_0\in\mathcal{G} D 0 ∈ G , then P H 0 { τ < ∞ ∣ D 0 } ≤ α \mathbb{P}_{H_0}\{\tau<\infty\mid\mathcal{D}_0\}\le\alpha P H 0 { τ < ∞ ∣ D 0 } ≤ α . Without conditioning, P H 0 { τ < ∞ } ≤ α + ( 1 − α ) δ \mathbb{P}_{H_0}\{\tau<\infty\}\le\alpha+(1-\alpha)\delta P H 0 { τ < ∞ } ≤ α + ( 1 − α ) δ .
Proof. By Proposition 3.1, the restarting portfolio is predictable, so the claims follow from Proposition 2.4.
A Constant Bet With Positive Growth
The proof of Theorem D.3 compares the detector with a single constant bet, which is chosen with the knowledge of Q Q Q and D 0 D_0 D 0 but not of the test observations.
Lemma D.2. Fix D 0 D_0 D 0 with Δ > 0 \Delta> 0 Δ > 0 , let h : = sign ( E Q [ p ^ − 1 / 2 ∣ D 0 ] ) h := \operatorname{sign}(\mathbb{E}_Q[\hat{p}-1/2 \mid D_0]) h := sign ( E Q [ p ^ − 1/2 ∣ D 0 ]) , and let η ^ : = h Δ / ( 2 κ ( 1 + Δ 2 ) ) \hat{\eta} := h\Delta/(2\kappa(1+\Delta^2)) η ^ := h Δ/ ( 2 κ ( 1 + Δ 2 )) . Then ∣ η ^ ∣ ≤ 3 / 10 |\hat{\eta}| \le3/10 ∣ η ^ ∣ ≤ 3/10 , and Y : = ln b ( η ^ , p ^ ) Y := \ln b(\hat{\eta},\hat{p}) Y := ln b ( η ^ , p ^ ) satisfies
Y ∈ [ ln 7 10 , ln 13 10 ] , Y ˉ : = E Q [ Y ∣ D 0 ] ≥ Δ 2 4 ( 1 + Δ 2 ) ≥ Δ 2 5 , Var Q ( Y ∣ D 0 ) ≤ 4 Y ˉ . Y \in\left[\ln\frac{7}{10}, \ln\frac{13}{10}\right], \qquad\bar{Y} := \mathbb{E}_Q[Y \mid D_0] \ge\frac{\Delta^2}{4(1+\Delta^2)} \ge\frac{\Delta^2}{5}, \qquad\operatorname{Var}_Q(Y \mid D_0) \le4\bar{Y}. Y ∈ [ ln 10 7 , ln 10 13 ] , Y ˉ := E Q [ Y ∣ D 0 ] ≥ 4 ( 1 + Δ 2 ) Δ 2 ≥ 5 Δ 2 , Var Q ( Y ∣ D 0 ) ≤ 4 Y ˉ .
Proof. All expectations and variances below are conditional on D 0 D_0 D 0 , and we omit the conditioning. The sign h h h is nonzero because Δ > 0 \Delta> 0 Δ > 0 . Let Z : = h ( p ^ − 1 / 2 ) − ϵ ( p ^ ) Z := h(\hat{p}-1/2)-\epsilon(\hat{p}) Z := h ( p ^ − 1/2 ) − ϵ ( p ^ ) , so that E Q [ Z ] = Δ \mathbb{E}_Q[Z] = \Delta E Q [ Z ] = Δ by the choice of h h h . Since ϵ \epsilon ϵ takes values in [ 0 , 1 ] [0,1] [ 0 , 1 ] , the variable Z Z Z lies in [ − 1 / 2 − max p ∈ [ 0 , 1 ] ϵ ( p ) , 1 / 2 ] ⊆ [ − 3 / 2 , 1 / 2 ] [-1/2-\max_{p\in[0,1]}\epsilon(p),1/2] \subseteq[-3/2,1/2] [ − 1/2 − max p ∈ [ 0 , 1 ] ϵ ( p ) , 1/2 ] ⊆ [ − 3/2 , 1/2 ] , an interval of length at most 2 2 2 , so Var Q ( Z ) ≤ 1 \operatorname{Var}_Q(Z) \le1 Var Q ( Z ) ≤ 1 and E Q [ Z 2 ] ≤ 1 + Δ 2 \mathbb{E}_Q[Z^2] \le1+\Delta^2 E Q [ Z 2 ] ≤ 1 + Δ 2 . Let c : = κ ∣ η ^ ∣ = Δ / ( 2 ( 1 + Δ 2 ) ) c := \kappa|\hat{\eta}| = \Delta/(2(1+\Delta^2)) c := κ ∣ η ^ ∣ = Δ/ ( 2 ( 1 + Δ 2 )) . Since Δ ≤ 1 / 2 \Delta\le1/2 Δ ≤ 1/2 and z ↦ z / ( 1 + z 2 ) z \mapsto z/(1+z^2) z ↦ z / ( 1 + z 2 ) increases on [ 0 , 1 ] [0,1] [ 0 , 1 ] , we have c ≤ 1 / 5 c \le1/5 c ≤ 1/5 , and κ ≥ 2 / 3 \kappa\ge2/3 κ ≥ 2/3 gives ∣ η ^ ∣ ≤ 3 / 10 |\hat{\eta}| \le3/10 ∣ η ^ ∣ ≤ 3/10 . Because η ^ = h ∣ η ^ ∣ \hat{\eta} = h|\hat{\eta}| η ^ = h ∣ η ^ ∣ , the definition (4) gives b ( η ^ , p ^ ) = 1 + c Z b(\hat{\eta},\hat{p}) = 1+cZ b ( η ^ , p ^ ) = 1 + c Z with ∣ c Z ∣ ≤ 3 / 10 |cZ| \le3/10 ∣ c Z ∣ ≤ 3/10 , which proves the range of Y Y Y . The inequality ln ( 1 + z ) ≥ z − z 2 \ln(1+z) \ge z-z^2 ln ( 1 + z ) ≥ z − z 2 for z ≥ − 1 / 2 z \ge-1/2 z ≥ − 1/2 gives
Y ˉ ≥ c Δ − c 2 ( 1 + Δ 2 ) = Δ 2 4 ( 1 + Δ 2 ) ≥ Δ 2 5 . \bar{Y} \ge c\Delta-c^2(1+\Delta^2)=\frac{\Delta^2}{4(1+\Delta^2)}\ge\frac{\Delta^2}{5}. Y ˉ ≥ c Δ − c 2 ( 1 + Δ 2 ) = 4 ( 1 + Δ 2 ) Δ 2 ≥ 5 Δ 2 .
where the last step uses Δ ≤ 1 / 2 \Delta\le1/2 Δ ≤ 1/2 . Finally, z ↦ ln ( 1 + z ) z\mapsto\ln(1+z) z ↦ ln ( 1 + z ) is 2-Lipschitz on [ − 1 / 2 , ∞ ) [-1/2,\infty) [ − 1/2 , ∞ ) , and a 2-Lipschitz function of a random variable has at most four times its variance, so
Var Q ( Y ) ≤ 4 c 2 Var Q ( Z ) ≤ Δ 2 ( 1 + Δ 2 ) 2 ≤ Δ 2 1 + Δ 2 ≤ 4 Y ˉ . \operatorname{Var}_Q(Y)\le4c^2\operatorname{Var}_Q(Z)\le\frac{\Delta^2}{(1+\Delta^2)^2}\le\frac{\Delta^2}{1+\Delta^2}\le4\bar{Y}. Var Q ( Y ) ≤ 4 c 2 Var Q ( Z ) ≤ ( 1 + Δ 2 ) 2 Δ 2 ≤ 1 + Δ 2 Δ 2 ≤ 4 Y ˉ .
Full Statement and Proof of Theorem 4.1
Theorem 4.1 states the bound on the expected delay. We prove the following full version, which also bounds the tail of the delay and the delay given no false alarm before the shift.
Theorem D.3 (Detection delay, full statement). Under (2) with a shift after round t 0 ≥ 0 t_0 \ge0 t 0 ≥ 0 , let D 0 D_0 D 0 satisfy Δ > 0 \Delta> 0 Δ > 0 , let τ \tau τ be the rejection time of Algorithm 1 , and let n ( t 0 ) n(t_0) n ( t 0 ) be as in Theorem 4.1 . Then for every integer t 1 ≥ n ( t 0 ) t_1 \ge n(t_0) t 1 ≥ n ( t 0 ) ,
P H 1 { τ > t 0 + t 1 ∣ D 0 } ≤ exp ( − Δ 2 t 1 170 ) . \mathbb{P}_{H_1}\{\tau>t_0+t_1\mid D_0\}\le\exp\left(-\frac{\Delta^2t_1}{170}\right). P H 1 { τ > t 0 + t 1 ∣ D 0 } ≤ exp ( − 170 Δ 2 t 1 ) . Consequently,
E H 1 [ ( τ − t 0 ) + ∣ D 0 ] ≤ n ( t 0 ) + 170 Δ 2 . \mathbb{E}_{H_1}[(\tau-t_0)_+\mid D_0]\le n(t_0)+\frac{170}{\Delta^2}. E H 1 [( τ − t 0 ) + ∣ D 0 ] ≤ n ( t 0 ) + Δ 2 170 . If moreover D 0 ∈ G D_0\in\mathcal{G} D 0 ∈ G , then P H 1 { τ > t 0 + t 1 ∣ τ > t 0 , D 0 } ≤ exp ( − Δ 2 t 1 / 170 ) / ( 1 − α ) \mathbb{P}_{H_1}\{\tau>t_0+t_1\mid\tau>t_0,D_0\}\le\exp(-\Delta^2t_1/170)/(1-\alpha) P H 1 { τ > t 0 + t 1 ∣ τ > t 0 , D 0 } ≤ exp ( − Δ 2 t 1 /170 ) / ( 1 − α ) for all t 1 ≥ n ( t 0 ) t_1\ge n(t_0) t 1 ≥ n ( t 0 ) .
The first two bounds hold for every reference dataset with Δ > 0 \Delta> 0 Δ > 0 , and the second is Theorem 4.1 . The conditional bound uses D 0 ∈ G D_0\in\mathcal{G} D 0 ∈ G only to ensure that a false alarm before the shift is unlikely, so that conditioning on τ > t 0 \tau>t_0 τ > t 0 costs at most a factor 1 / ( 1 − α ) 1/(1-\alpha) 1/ ( 1 − α ) .
Proof of Theorem D.3 . Fix D 0 D_0 D 0 with Δ > 0 \Delta> 0 Δ > 0 and an integer t 1 ≥ n ( t 0 ) t_1\ge n(t_0) t 1 ≥ n ( t 0 ) , and write s : = t 0 + 1 s:=t_0+1 s := t 0 + 1 and t : = t 0 + t 1 t:=t_0+t_1 t := t 0 + t 1 . Let η ^ \hat{\eta} η ^ , Y Y Y , and Y ˉ \bar{Y} Y ˉ be as in Lemma D.2, and let Λ : = ∑ i = s t ln b ( η ^ , p ^ i ) \Lambda:=\sum_{i=s}^{t}\ln b(\hat{\eta},\hat{p}_i) Λ := ∑ i = s t ln b ( η ^ , p ^ i ) be the log-wealth that the constant bet η ^ \hat{\eta} η ^ earns after the shift. Since τ \tau τ is the first round with M t ≥ 1 / α M_t\ge1/\alpha M t ≥ 1/ α , Lemma 3.2 and 2 t 1 + 1 ≤ 2 ( t 1 + 1 ) 2t_1+1\le2(t_1+1) 2 t 1 + 1 ≤ 2 ( t 1 + 1 ) give
{ τ > t } ⊆ { ln M t < ln 1 α } ⊆ { Λ < ln 2 α π s + ln ( t 1 + 1 ) } . \{\tau>t\}\subseteq\left\{\ln M_t<\ln\frac{1}{\alpha}\right\}\subseteq\left\{\Lambda<\ln\frac{2}{\alpha\pi_s}+\ln(t_1+1)\right\}. { τ > t } ⊆ { ln M t < ln α 1 } ⊆ { Λ < ln α π s 2 + ln ( t 1 + 1 ) } .
We bound both terms of the threshold by t 1 Y ˉ / 4 t_1\bar{Y}/4 t 1 Y ˉ /4 . Both terms in the definition of n ( t 0 ) n(t_0) n ( t 0 ) are nonnegative, so t 1 ≥ n ( t 0 ) t_1\ge n(t_0) t 1 ≥ n ( t 0 ) implies ln ( 2 / ( α π s ) ) ≤ t 1 Δ 2 / 20 ≤ t 1 Y ˉ / 4 \ln(2/(\alpha\pi_s))\le t_1\Delta^2/20\le t_1\bar{Y}/4 ln ( 2/ ( α π s )) ≤ t 1 Δ 2 /20 ≤ t 1 Y ˉ /4 by Lemma D.2. For the second term, let c : = 40 / Δ 2 ≥ 160 c := 40/\Delta^2 \ge160 c := 40/ Δ 2 ≥ 160 , so that t 1 ≥ c ln c t_1 \ge c \ln c t 1 ≥ c ln c and Δ 2 / 20 = 2 / c \Delta^2/20 = 2/c Δ 2 /20 = 2/ c . Since z ↦ ln ( z + 1 ) / z z \mapsto\ln(z+1)/z z ↦ ln ( z + 1 ) / z decreases on ( 0 , ∞ ) (0,\infty) ( 0 , ∞ ) , and since c ln c + 1 ≤ c 2 c\ln c+1\le c^2 c ln c + 1 ≤ c 2 by ln c ≤ c − 1 \ln c\le c-1 ln c ≤ c − 1 ,
ln ( t 1 + 1 ) t 1 ≤ ln ( c ln c + 1 ) c ln c ≤ 2 ln c c ln c = Δ 2 20 ≤ Y ˉ 4 . \frac{\ln(t_1+1)}{t_1}\le\frac{\ln(c\ln c+1)}{c\ln c}\le\frac{2\ln c}{c\ln c}=\frac{\Delta^2}{20}\le\frac{\bar{Y}}{4}. t 1 ln ( t 1 + 1 ) ≤ c ln c ln ( c ln c + 1 ) ≤ c ln c 2 ln c = 20 Δ 2 ≤ 4 Y ˉ .
The threshold is therefore at most t 1 Y ˉ / 2 t_1\bar{Y}/2 t 1 Y ˉ /2 , and { τ > t } ⊆ { t 1 Y ˉ − Λ > t 1 Y ˉ / 2 } \{\tau>t\}\subseteq\{t_1\bar{Y}-\Lambda>t_1\bar{Y}/2\} { τ > t } ⊆ { t 1 Y ˉ − Λ > t 1 Y ˉ /2 } . Given D 0 D_0 D 0 , the terms of Λ \Lambda Λ are i.i.d. copies of Y Y Y , so t 1 Y ˉ − Λ t_1\bar{Y}-\Lambda t 1 Y ˉ − Λ is a sum of t 1 t_1 t 1 independent centered variables, each with variance at most 4 Y ˉ 4\bar{Y} 4 Y ˉ by Lemma D.2, and each bounded above by ln ( 13 / 10 ) − ln ( 7 / 10 ) ≤ ln 3 \ln(13/10)-\ln(7/10)\le\ln3 ln ( 13/10 ) − ln ( 7/10 ) ≤ ln 3 . Bernstein’s inequality [2 Corollary 2.11] gives
P H 1 { τ > t 0 + t 1 ∣ D 0 } ≤ exp ( − ( t 1 Y ˉ / 2 ) 2 2 ( 4 t 1 Y ˉ + ( ln 3 ) t 1 Y ˉ / 6 ) ) = exp ( − t 1 Y ˉ 32 + ( 4 / 3 ) ln 3 ) ≤ exp ( − Δ 2 t 1 170 ) . \mathbb{P}_{H_1}\{\tau>t_0+t_1\mid D_0\}\le\exp\left(-\frac{(t_1\bar{Y}/2)^2}{2(4t_1\bar{Y}+(\ln3)t_1\bar{Y}/6)}\right)=\exp\left(-\frac{t_1\bar{Y}}{32+(4/3)\ln3}\right)\le\exp\left(-\frac{\Delta^2t_1}{170}\right). P H 1 { τ > t 0 + t 1 ∣ D 0 } ≤ exp ( − 2 ( 4 t 1 Y ˉ + ( ln 3 ) t 1 Y ˉ /6 ) ( t 1 Y ˉ /2 ) 2 ) = exp ( − 32 + ( 4/3 ) ln 3 t 1 Y ˉ ) ≤ exp ( − 170 Δ 2 t 1 ) .
where the last step uses Y ˉ ≥ Δ 2 / 5 \bar{Y}\ge\Delta^2/5 Y ˉ ≥ Δ 2 /5 and 5 ( 32 + ( 4 / 3 ) ln 3 ) < 170 5(32+(4/3)\ln3)<170 5 ( 32 + ( 4/3 ) ln 3 ) < 170 . This proves the tail bound.
For the expectation, let ρ : = Δ 2 / 170 \rho:=\Delta^2/170 ρ := Δ 2 /170 . Since n ( t 0 ) ≥ 1 n(t_0)\ge1 n ( t 0 ) ≥ 1 , the tail bound gives
E H 1 [ ( τ − t 0 ) + ∣ D 0 ] = ∑ i = 0 ∞ P H 1 { τ > t 0 + i ∣ D 0 } ≤ n ( t 0 ) + ∑ i = n ( t 0 ) ∞ e − ρ i ≤ n ( t 0 ) + 1 e ρ − 1 ≤ n ( t 0 ) + 1 ρ . \mathbb{E}_{H_1}\left[(\tau-t_0)_+\mid D_0\right]=\sum_{i=0}^{\infty}\mathbb{P}_{H_1}\{\tau>t_0+i\mid D_0\}\le n(t_0)+\sum_{i=n(t_0)}^{\infty}e^{-\rho i}\le n(t_0)+\frac{1}{e^\rho-1}\le n(t_0)+\frac{1}{\rho}. E H 1 [ ( τ − t 0 ) + ∣ D 0 ] = i = 0 ∑ ∞ P H 1 { τ > t 0 + i ∣ D 0 } ≤ n ( t 0 ) + i = n ( t 0 ) ∑ ∞ e − ρ i ≤ n ( t 0 ) + e ρ − 1 1 ≤ n ( t 0 ) + ρ 1 .
Finally, let D 0 ∈ G D_0\in\mathcal{G} D 0 ∈ G . The event { τ > t 0 } \{\tau>t_0\} { τ > t 0 } depends only on D 0 , X 1 , … , X t 0 D_0,X_1,\ldots,X_{t_0} D 0 , X 1 , … , X t 0 , whose law is the same under H 0 H_0 H 0 and H 1 H_1 H 1 , so Corollary D.1 gives P H 1 { τ > t 0 ∣ D 0 } = P H 0 { τ > t 0 ∣ D 0 } ≥ 1 − α \mathbb{P}_{H_1}\{\tau>t_0\mid D_0\}=\mathbb{P}_{H_0}\{\tau>t_0\mid D_0\}\ge1-\alpha P H 1 { τ > t 0 ∣ D 0 } = P H 0 { τ > t 0 ∣ D 0 } ≥ 1 − α . Dividing the tail bound by this probability proves the last claim.
Proof of Corollary 4.2
By (13) with s = t 0 + 1 s=t_0+1 s = t 0 + 1 ,
ln 2 α π t 0 + 1 ≤ ln 1 α + ln ( t 0 + 3 ) + 2 ln ln ( t 0 + 3 ) + ln 2 + ln 1 ln 2 . \ln\frac{2}{\alpha\pi_{t_0+1}}\le\ln\frac{1}{\alpha}+\ln(t_0+3)+2\ln\ln(t_0+3)+\ln2+\ln\frac{1}{\ln2}. ln α π t 0 + 1 2 ≤ ln α 1 + ln ( t 0 + 3 ) + 2 ln ln ( t 0 + 3 ) + ln 2 + ln ln 2 1 .
We substitute this bound into n ( t 0 ) ≤ ( 20 / Δ 2 ) ln ( 2 / ( α π t 0 + 1 ) ) + ( 40 / Δ 2 ) ln ( 40 / Δ 2 ) + 1 n(t_0)\le(20/\Delta^2)\ln(2/(\alpha\pi_{t_0+1}))+(40/\Delta^2)\ln(40/\Delta^2)+1 n ( t 0 ) ≤ ( 20/ Δ 2 ) ln ( 2/ ( α π t 0 + 1 )) + ( 40/ Δ 2 ) ln ( 40/ Δ 2 ) + 1 and use 20 ( ln 2 + ln ( 1 / ln 2 ) ) < 21.2 20(\ln2+\ln(1/\ln2))<21.2 20 ( ln 2 + ln ( 1/ ln 2 )) < 21.2 and 1 ≤ 1 / ( 4 Δ 2 ) 1\le1/(4\Delta^2) 1 ≤ 1/ ( 4 Δ 2 ) , which holds since Δ ≤ 1 / 2 \Delta\le1/2 Δ ≤ 1/2 . The expectation bound of Theorem D.3 then gives the claim with the constant 21.2 + 0.25 + 170 < 192 21.2+0.25+170<192 21.2 + 0.25 + 170 < 192 .
A Lower Bound on the Expected Delay
Classical change detectors control the average run length to a false alarm, and their worst-case delay does not depend on t 0 t_0 t 0 [19 ] . Under the stronger requirement that a false alarm ever occurs with probability at most α \alpha α , the detector must become more conservative as time passes. The next theorem shows that every such detector, even one that knows P P P and Q Q Q a priori, has an expected delay that grows at least logarithmically with the shift time.
Theorem D.4 (Lower bound on the expected delay). Suppose that Q Q Q is absolutely continuous with respect to P P P and that the Kullback–Leibler divergence KL ( Q ∥ P ) \operatorname{KL}(Q\mathbin\Vert P) KL ( Q ∥ P ) is finite and positive. Let τ \tau τ be any stopping time with P H 0 { τ < ∞ } ≤ α \mathbb{P}_{H_0}\{\tau<\infty\}\le\alpha P H 0 { τ < ∞ } ≤ α . Then, as t → ∞ t\to\infty t → ∞ ,
max t 0 ∈ { t , … , 2 t } E H 1 [ ( τ − t 0 ) + ] ≥ ( 1 − α ) 2 4 KL ( Q ∥ P ) ln t α − O ( ln ln t ) . \max_{t_0\in\{t,\ldots,2t\}}\mathbb{E}_{H_1}\left[(\tau-t_0)_+\right]\ge\frac{(1-\alpha)^2}{4\operatorname{KL}(Q\mathbin\Vert P)}\ln\frac{t}{\alpha}-O(\ln\ln t). t 0 ∈ { t , … , 2 t } max E H 1 [ ( τ − t 0 ) + ] ≥ 4 KL ( Q ∥ P ) ( 1 − α ) 2 ln α t − O ( ln ln t ) . where the constant in O ( ⋅ ) O(\cdot) O ( ⋅ ) depends only on α \alpha α and KL ( Q ∥ P ) \operatorname{KL}(Q\mathbin\Vert P) KL ( Q ∥ P ) .
In words, for any choice of a detector, there are shift times t 0 t_0 t 0 between t t t and 2 t 2t 2 t at which its expected delay is at least of order ln ( t 0 / α ) / KL ( Q ∥ P ) \ln(t_0/\alpha)/\operatorname{KL}(Q\mathbin\Vert P) ln ( t 0 / α ) / KL ( Q ∥ P ) . The theorem applies to our setting conditionally on D 0 D_0 D 0 , and a detector that knows neither P P P nor Q Q Q can only do worse.
Proof of Theorem D.4 . Write I : = KL ( Q ∥ P ) I := \operatorname{KL}(Q\|P) I := KL ( Q ∥ P ) . The proof first shows that a detector cannot raise alarms in short windows after many different shift times without paying in false alarms, and then converts a bound on the expected delay into such windows with Markov’s inequality. Throughout, P H 1 \mathbb{P}_{H_1} P H 1 and E H 1 \mathbb{E}_{H_1} E H 1 refer to the shift time t 0 t_0 t 0 indicated in the event, and τ \tau τ is a stopping time with respect to ( F t ) t ≥ 0 (\mathcal{F}_t)_{t\geq0} ( F t ) t ≥ 0 . Since D 0 D_0 D 0 is independent of the test observations and has the same law under H 0 H_0 H 0 and H 1 H_1 H 1 , the same argument applies conditionally on D 0 D_0 D 0 .
Lemma D.5. Let τ \tau τ be a stopping time with P H 0 { τ < ∞ } ≤ α \mathbb{P}_{H_0}\{\tau< \infty\} \leq\alpha P H 0 { τ < ∞ } ≤ α , and fix integers t ≥ d ≥ 1 t \geq d \geq1 t ≥ d ≥ 1 and a number q ∈ ( 0 , 1 ] q \in(0,1] q ∈ ( 0 , 1 ] . If P H 1 { t 0 < τ ≤ t 0 + d } ≥ q \mathbb{P}_{H_1}\{t_0 < \tau\leq t_0+d\} \geq q P H 1 { t 0 < τ ≤ t 0 + d } ≥ q for every shift time t 0 ∈ { t , t + 1 , … , 2 t − d } t_0 \in\{t,t+1,\ldots,2t-d\} t 0 ∈ { t , t + 1 , … , 2 t − d } , then
d I ≥ q ln ⌊ t / d ⌋ α − ln 2. dI \geq q\ln\frac{\lfloor t/d\rfloor}{\alpha}-\ln2 . d I ≥ q ln α ⌊ t / d ⌋ − ln 2. Proof. Let m : = ⌊ t / d ⌋ ≥ 1 m := \lfloor t/d\rfloor\geq1 m := ⌊ t / d ⌋ ≥ 1 and consider the shift times t ( j ) : = t + ( j − 1 ) d t^{(j)} := t+(j-1)d t ( j ) := t + ( j − 1 ) d for j = 1 , … , m j=1,\ldots,m j = 1 , … , m , which lie in { t , … , 2 t − d } \{t,\ldots,2t-d\} { t , … , 2 t − d } . The events A j : = { t ( j ) < τ ≤ t ( j ) + d } A_j := \{t^{(j)} < \tau\leq t^{(j)}+d\} A j := { t ( j ) < τ ≤ t ( j ) + d } are disjoint, so their probabilities under H 0 H_0 H 0 sum to at most P H 0 { τ < ∞ } ≤ α \mathbb{P}_{H_0}\{\tau< \infty\} \leq\alpha P H 0 { τ < ∞ } ≤ α , and some j j j satisfies p : = P H 0 A j ≤ α / m p := \mathbb{P}_{H_0}A_j \leq\alpha/m p := P H 0 A j ≤ α / m . Write P j P_j P j for the law under H 1 H_1 H 1 with the shift time t ( j ) t^{(j)} t ( j ) , so that q j : = P j A j ≥ q q_j := P_jA_j \geq q q j := P j A j ≥ q . Since τ \tau τ is a stopping time, the event A j A_j A j is determined by D 0 , X 1 , … , X t ( j ) + d D_0,X_1,\ldots,X_{t^{(j)}+d} D 0 , X 1 , … , X t ( j ) + d . Under P j P_j P j and under H 0 H_0 H 0 , these variables have the same law except for the last d d d observations, which are i.i.d. from Q Q Q and from P P P , respectively, and independent of the others. By the chain rule, the Kullback–Leibler divergence between the two laws is d I dI d I . Moreover, since Q Q Q is absolutely continuous with respect to P P P , so is the first law with respect to the second, and q j > 0 q_j>0 q j > 0 forces p > 0 p>0 p > 0 . The data-processing inequality applied to the indicator of A j A_j A j , and the bound − q j ln q j − ( 1 − q j ) ln ( 1 − q j ) ≤ ln 2 -q_j\ln q_j-(1-q_j)\ln(1-q_j)\leq\ln2 − q j ln q j − ( 1 − q j ) ln ( 1 − q j ) ≤ ln 2 on the binary entropy, give
d I ≥ q j ln q j p + ( 1 − q j ) ln 1 − q j 1 − p ≥ q j ln 1 p − ln 2 ≥ q ln m α − ln 2 , dI \geq q_j\ln\frac{q_j}{p}+(1-q_j)\ln\frac{1-q_j}{1-p}\geq q_j\ln\frac{1}{p}-\ln2\geq q\ln\frac{m}{\alpha}-\ln2, d I ≥ q j ln p q j + ( 1 − q j ) ln 1 − p 1 − q j ≥ q j ln p 1 − ln 2 ≥ q ln α m − ln 2 , where the second inequality drops the nonnegative term ( 1 − q j ) ln ( 1 / ( 1 − p ) ) (1-q_j)\ln(1/(1-p)) ( 1 − q j ) ln ( 1/ ( 1 − p )) , and the third uses q j ≥ q q_j\geq q q j ≥ q and 1 / p ≥ m / α ≥ 1 1/p\geq m/\alpha\geq1 1/ p ≥ m / α ≥ 1 .
We now prove the theorem. Let c : = ( 1 − α ) 2 / ( 4 I ) c := (1-\alpha)^2/(4I) c := ( 1 − α ) 2 / ( 4 I ) and D : = max t 0 ∈ { t , … , 2 t } E H 1 [ ( τ − t 0 ) + ] D := \max_{t_0\in\{t,\ldots,2t\}}\mathbb{E}_{H_1}[(\tau-t_0)_+] D := max t 0 ∈ { t , … , 2 t } E H 1 [( τ − t 0 ) + ] . If D ≥ c ln ( t / α ) D\geq c\ln(t/\alpha) D ≥ c ln ( t / α ) , there is nothing to prove, so assume D < c ln ( t / α ) D<c\ln(t/\alpha) D < c ln ( t / α ) . For every shift time t 0 t_0 t 0 , the event { τ > t 0 } \{\tau>t_0\} { τ > t 0 } depends only on D 0 , X 1 , … , X t 0 D_0,X_1,\ldots,X_{t_0} D 0 , X 1 , … , X t 0 , whose law is the same under H 0 H_0 H 0 and H 1 H_1 H 1 , so P H 1 { τ > t 0 } ≥ 1 − α \mathbb{P}_{H_1}\{\tau>t_0\}\geq1-\alpha P H 1 { τ > t 0 } ≥ 1 − α . Since ( τ − t 0 ) + ≥ 1 (\tau-t_0)_+\geq1 ( τ − t 0 ) + ≥ 1 on this event, D ≥ 1 − α > 0 D\geq1-\alpha>0 D ≥ 1 − α > 0 . Let d : = ⌈ 2 D / ( 1 − α ) ⌉ ≥ 2 d:=\lceil2D/(1-\alpha)\rceil\geq2 d := ⌈ 2 D / ( 1 − α )⌉ ≥ 2 , so that D ≥ ( 1 − α ) ( d − 1 ) / 2 D\geq(1-\alpha)(d-1)/2 D ≥ ( 1 − α ) ( d − 1 ) /2 and
d < d ˉ ( t ) : = 1 − α 2 I ln t α + 1. d<\bar d(t):=\frac{1-\alpha}{2I}\ln\frac{t}{\alpha}+1. d < d ˉ ( t ) := 2 I 1 − α ln α t + 1.
Since d ˉ ( t ) \bar d(t) d ˉ ( t ) grows logarithmically, d ˉ ( t ) ≤ t \bar d(t)\leq t d ˉ ( t ) ≤ t for all t t t beyond a threshold that depends only on α \alpha α and I I I , and we consider such t t t . For every t 0 ∈ { t , … , 2 t − d } t_0\in\{t,\ldots,2t-d\} t 0 ∈ { t , … , 2 t − d } , Markov’s inequality gives P H 1 { τ > t 0 + d } ≤ D / d ≤ ( 1 − α ) / 2 \mathbb{P}_{H_1}\{\tau>t_0+d\}\leq D/d\leq(1-\alpha)/2 P H 1 { τ > t 0 + d } ≤ D / d ≤ ( 1 − α ) /2 , hence
P H 1 { t 0 < τ ≤ t 0 + d } = P H 1 { τ > t 0 } − P H 1 { τ > t 0 + d } ≥ 1 − α 2 . \mathbb{P}_{H_1}\{t_0<\tau\leq t_0+d\}=\mathbb{P}_{H_1}\{\tau>t_0\}-\mathbb{P}_{H_1}\{\tau>t_0+d\}\geq\frac{1-\alpha}{2}. P H 1 { t 0 < τ ≤ t 0 + d } = P H 1 { τ > t 0 } − P H 1 { τ > t 0 + d } ≥ 2 1 − α .
Lemma D.5 with q = ( 1 − α ) / 2 q=(1-\alpha)/2 q = ( 1 − α ) /2 , together with ⌊ t / d ⌋ ≥ t / ( 2 d ) ≥ t / ( 2 d ˉ ( t ) ) \lfloor t/d\rfloor\geq t/(2d)\geq t/(2\bar d(t)) ⌊ t / d ⌋ ≥ t / ( 2 d ) ≥ t / ( 2 d ˉ ( t )) , gives d I ≥ ( ( 1 − α ) / 2 ) ln ( t / ( 2 α d ˉ ( t ) ) ) − ln 2 dI\geq((1-\alpha)/2)\ln(t/(2\alpha\bar d(t)))-\ln2 d I ≥ (( 1 − α ) /2 ) ln ( t / ( 2 α d ˉ ( t ))) − ln 2 . Substituting into D ≥ ( 1 − α ) ( d − 1 ) / 2 D\geq(1-\alpha)(d-1)/2 D ≥ ( 1 − α ) ( d − 1 ) /2 yields
D ≥ ( 1 − α ) 2 4 I ln t α − ( 1 − α ) 2 4 I ln ( 2 d ˉ ( t ) ) − ( 1 − α ) ln 2 2 I − 1 − α 2 . D\geq\frac{(1-\alpha)^2}{4I}\ln\frac{t}{\alpha}-\frac{(1-\alpha)^2}{4I}\ln(2\bar d(t))-\frac{(1-\alpha)\ln2}{2I}-\frac{1-\alpha}{2}. D ≥ 4 I ( 1 − α ) 2 ln α t − 4 I ( 1 − α ) 2 ln ( 2 d ˉ ( t )) − 2 I ( 1 − α ) ln 2 − 2 1 − α .
Since d ˉ ( t ) = O ( ln t ) \bar d(t)=O(\ln t) d ˉ ( t ) = O ( ln t ) with constants that depend only on α \alpha α and I I I , the last three terms are O ( ln ln t ) O(\ln\ln t) O ( ln ln t ) , which proves the theorem.
Comparison With the Signal Strength.
We verify the bound Δ 2 ≤ KL ( Q ∥ P ) / 2 \Delta^2\leq\operatorname{KL}(Q\|P)/2 Δ 2 ≤ KL ( Q ∥ P ) /2 used in § 4 for detectable shifts on G \mathcal{G} G . Let D 0 ∈ G D_0\in\mathcal{G} D 0 ∈ G with Δ > 0 \Delta>0 Δ > 0 . By the band (3) , ∣ E Q [ p ^ − F ( X ) ∣ D 0 ] ∣ ≤ E Q [ ℓ ( p ^ ) ∣ D 0 ] \left|\mathbb{E}_Q[\hat p-F(X)\mid D_0]\right|\leq\mathbb{E}_Q[\ell(\hat p)\mid D_0] ∣ E Q [ p ^ − F ( X ) ∣ D 0 ] ∣ ≤ E Q [ ℓ ( p ^ ) ∣ D 0 ] , and E P [ F ( X ) ] = 1 / 2 \mathbb{E}_P[F(X)]=1/2 E P [ F ( X )] = 1/2 since F F F is continuous. Hence
Δ ≤ ∣ E Q [ F ( X ) ] − 1 2 ∣ = ∣ E Q [ F ( X ) ] − E P [ F ( X ) ] ∣ ≤ sup A ∣ Q ( A ) − P ( A ) ∣ ≤ KL ( Q ∥ P ) 2 , \Delta\leq\left|\mathbb{E}_Q[F(X)]-\frac{1}{2}\right|=\left|\mathbb{E}_Q[F(X)]-\mathbb{E}_P[F(X)]\right|\leq\sup_A|Q(A)-P(A)|\leq\sqrt{\frac{\operatorname{KL}(Q\|P)}{2}}, Δ ≤ E Q [ F ( X )] − 2 1 = ∣ E Q [ F ( X )] − E P [ F ( X )] ∣ ≤ A sup ∣ Q ( A ) − P ( A ) ∣ ≤ 2 KL ( Q ∥ P ) ,
where the supremum is over measurable sets, the second inequality uses that F F F takes values in [ 0 , 1 ] [0,1] [ 0 , 1 ] , and the last one is Pinsker’s inequality. Since Δ > 0 \Delta>0 Δ > 0 , squaring gives the bound.
Efficient Implementation
This appendix details the computation summarized in § 3.2 . Appendix § 12 .§ 1 explains the main idea and states its guarantee, Appendices § 12 .§ 2 –§ 12 .§ 4 give the direct and the divide-and-conquer methods in full, and the remaining subsections prove the guarantee, discuss floating-point accuracy, and compare the two methods empirically.
Overview
We show that the allocations of Algorithm 1 can be computed exactly in O ( T 2 ln T ) O(T^2\ln T) O ( T 2 ln T ) time over T T T rounds, instead of the O ( T 3 ) O(T^3) O ( T 3 ) time of a direct computation. For a function f f f on W \mathcal{W} W , write
Φ ( f ) : = ( ∫ W w i f ( w ) μ ( d w ) ) i ∈ { 0 , + , − } ∈ R 3 . \Phi(f):=\left(\int_{\mathcal{W}} w^i f(w)\mu(\mathrm{d}w)\right)_{i\in\{0,+,-\}}\in\mathbb{R}^3. Φ ( f ) := ( ∫ W w i f ( w ) μ ( d w ) ) i ∈ { 0 , + , − } ∈ R 3 .
Since w ∈ W w\in\mathcal{W} w ∈ W , the components of Φ ( B t ) \Phi(B_t) Φ ( B t ) sum to ∫ W B t ( w ) μ ( d w ) \int_{\mathcal{W}} B_t(w)\mu(\mathrm{d}w) ∫ W B t ( w ) μ ( d w ) , so the allocation (10) depends on the data only through Φ ( B t ) \Phi(B_t) Φ ( B t ) .
Direct Computation. The polynomial B t B_t B t has degree t − 1 t-1 t − 1 in w w w and thus t ( t + 1 ) / 2 t(t+1)/2 t ( t + 1 ) /2 monomial coefficients. Since the moments of the Dirichlet prior have closed forms, both the update B t + 1 = ⟨ w , x t ⟩ B t + π t + 1 B_{t+1}=\langle w,x_t\rangle B_t+\pi_{t+1} B t + 1 = ⟨ w , x t ⟩ B t + π t + 1 and the vector Φ ( B t ) \Phi(B_t) Φ ( B t ) take O ( t 2 ) O(t^2) O ( t 2 ) operations on these coefficients (Appendix § 12 .§ 2 ), which adds up to O ( T 3 ) O(T^3) O ( T 3 ) time and O ( T 2 ) O(T^2) O ( T 2 ) memory. The bottleneck is that the full polynomial B t B_t B t is updated and integrated at every round t t t . We instead group the total horizon T T T into blocks and handle the contributions of many start times s s s to many rounds t t t at once, which requires a different way of storing polynomials than by their monomial coefficients. By reusing shared computations within blocks, we avoid integrating B t B_t B t separately at every round.
Grid Representation. We first change variables. Write σ : = w + + w − \sigma:=w^++w^- σ := w + + w − and θ : = w + / σ \theta:=w^+/\sigma θ := w + / σ , so that a CRP can be written as (Figure 4 )
Figure 4. The grid for N = 5 N=5 N = 5 .
w = ( 1 − σ , σ θ , σ ( 1 − θ ) ) with ( σ , θ ) ∈ [ 0 , 1 ] 2 . w=(1-\sigma,\sigma\theta,\sigma(1-\theta))\quad\text{with }(\sigma,\theta)\in[0,1]^2. w = ( 1 − σ , σ θ , σ ( 1 − θ )) with ( σ , θ ) ∈ [ 0 , 1 ] 2 .
Every pair ( σ , θ ) (\sigma,\theta) ( σ , θ ) gives a valid CRP, and the simplex W \mathcal{W} W is now mapped to the unit square [ 0 , 1 ] 2 [0,1]^2 [ 0 , 1 ] 2 , facilitating tensor representation. Write F s , t : = ∏ i = s t − 1 ⟨ w , x i ⟩ F_{s,t}:=\prod_{i=s}^{t-1}\langle w,x_i\rangle F s , t := ∏ i = s t − 1 ⟨ w , x i ⟩ , so that B t = ∑ i = 1 t π i F i , t B_t=\sum_{i=1}^{t}\pi_iF_{i,t} B t = ∑ i = 1 t π i F i , t . Note that F s , t F_{s,t} F s , t is a bivariate polynomial of degree at most t − s t-s t − s in each of σ \sigma σ and θ \theta θ . We store such a polynomial by its values on the tensor grid of N × N N\times N N × N Chebyshev points, with N ≥ t − s + 1 N\ge t-s+1 N ≥ t − s + 1 larger than its degree [43 ] . In the transformed coordinates, the integral ∫ W w i B t ( w ) μ ( d w ) \int_{\mathcal{W}}w^iB_t(w)\mu(\mathrm{d}w) ∫ W w i B t ( w ) μ ( d w ) becomes a weighted sum of B t B_t B t values on the grid, using Gauss–Chebyshev quadrature in θ \theta θ and an interpolatory rule in σ \sigma σ . On its own, the grid representation does not reduce the cost of a single integration, since B t B_t B t still has about t 2 t^2 t 2 grid values to update at every round, but as we will show, it enables faster evaluation of ∫ W w i B t ( w ) μ ( d w ) \int_{\mathcal{W}}w^iB_t(w)\mu(\mathrm{d}w) ∫ W w i B t ( w ) μ ( d w ) once many rounds t t t are processed together.
Divide And Conquer. Since B t = ∑ i = 1 t π i F i , t B_t = \sum_{i=1}^{t} \pi_i F_{i,t} B t = ∑ i = 1 t π i F i , t , we need Φ ( B t ) \Phi(B_t) Φ ( B t ) for all t ≤ T t \le T t ≤ T , with terms F s , t F_{s,t} F s , t for all $1 \le s \le t \le T$. These can be illustrated by a triangle of pairs s ≤ t s \le t s ≤ t (Figure 5 (a)). The diagonal is explicit, Φ ( π t F t , t ) = π t ( 1 / 3 , 1 / 3 , 1 / 3 ) \Phi(\pi_t F_{t,t}) = \pi_t(1/3,1/3,1/3) Φ ( π t F t , t ) = π t ( 1/3 , 1/3 , 1/3 ) , so it remains to sum π s Φ ( F s , t ) \pi_s\Phi(F_{s,t}) π s Φ ( F s , t ) over the pairs s < t s < t s < t . We recursively bisect the time horizon, forming a binary partition of the time indices. For simplicity, we assume that T T T is known in advance and is a power of two:
Figure 5. (a) The pairs of start rounds s s s and rounds t ≥ s t \ge s t ≥ s . The split at K K K handles the dark block at once, later splits handle the lighter blocks, and the gray cells are computed directly. (b) The portfolios started in [ L , K ) [L,K) [ L , K ) are merged at round K K K into one polynomial, whose integrals are needed at every round in [ K , R ) [K,R) [ K , R ) (white dots). (c) Without a known horizon, doubling trick is used, and all earlier portfolios are merged at the start of each epoch.
[ 1 , T + 1 ) ⟶ [ 1 , T / 2 + 1 ) ∪ [ T / 2 + 1 , T + 1 ) ⟶ [ 1 , T / 4 + 1 ) ∪ ⋯ [1,T+1) \longrightarrow[1,T/2+1) \mathbin{\cup} [T/2+1,T+1) \longrightarrow[1,T/4+1) \mathbin{\cup} \cdots [ 1 , T + 1 ) ⟶ [ 1 , T /2 + 1 ) ∪ [ T /2 + 1 , T + 1 ) ⟶ [ 1 , T /4 + 1 ) ∪ ⋯
Consider a block of rounds [ L , R ) : = { L , … , R − 1 } [L,R) := \{L,\ldots,R-1\} [ L , R ) := { L , … , R − 1 } and its midpoint K : = ⌊ ( L + R ) / 2 ⌋ K := \lfloor(L+R)/2\rfloor K := ⌊( L + R ) /2 ⌋ . The pairs within each half are two smaller copies of the same problem, which we solve recursively, starting from the block [ 1 , T + 1 ) [1,T+1) [ 1 , T + 1 ) of all rounds. For a pair ( s , t ) (s,t) ( s , t ) that crosses the midpoint, with s ∈ [ L , K ) s \in[L,K) s ∈ [ L , K ) and t ∈ [ K , R ) t \in[K,R) t ∈ [ K , R ) , all portfolios started in the first half grow by the same factor F K , t F_{K,t} F K , t after round K K K , so
∑ i = L K − 1 π i F i , t = A L , K F K , t with A L , K : = ∑ i = L K − 1 π i F i , K . \sum_{i=L}^{K-1}\pi_iF_{i,t}=A_{L,K}F_{K,t}\quad\text{with}\quad A_{L,K}:=\sum_{i=L}^{K-1}\pi_iF_{i,K}. i = L ∑ K − 1 π i F i , t = A L , K F K , t with A L , K := i = L ∑ K − 1 π i F i , K .
Given A L , K A_{L,K} A L , K , computing the crossing contributions requires applying the single fixed linear functional f ↦ Φ ( A L , K f ) f \mapsto\Phi(A_{L,K}f) f ↦ Φ ( A L , K f ) to the products F K , t F_{K,t} F K , t for t ∈ [ K , R ) t \in[K,R) t ∈ [ K , R ) . With our earlier grid representation, this step can be performed in O ( ( R − L ) 2 ln ( R − L ) ) O((R-L)^2\ln(R-L)) O (( R − L ) 2 ln ( R − L )) with discrete cosine transforms. This step handles the darkest block in Figure 5 (a) at once. Recursing on both halves handles the remaining pairs, i.e., the two triangles, and the call on [ L , K ) [L,K) [ L , K ) also returns A L , K A_{L,K} A L , K .
Summing the computational cost over the blocks yields the following guarantee.
Proposition E.1. The divide-and-conquer method computes each allocation w t w_t w t in (10) from x 1 , … , x t − 1 x_1,\ldots,x_{t-1} x 1 , … , x t − 1 only, exactly in exact arithmetic and without knowing the horizon. Its first T T T rounds cost O ( T 2 ln T ) O(T^2\ln T) O ( T 2 ln T ) operations and O ( T 2 ) O(T^2) O ( T 2 ) memory.
Running Online. For simplicity, we have described the recursion for a known horizon T T T . Every step uses only the price relatives of earlier rounds, so the recursion can run online in a straightforward way. The horizon can be removed by intervals [ 2 J , 2 J + 1 ) [2^J,2^{J+1}) [ 2 J , 2 J + 1 ) of doubling length, at the start of which all earlier portfolios are merged into one polynomial (Figure 5 (c)) and will be reused afterwards. The rest of this appendix gives this online schedule, the proof of Proposition E.1, and a discussion of floating-point accuracy.
Notation For The Proofs. The rest of this appendix uses the notation above: the moment vector Φ = ( Φ 0 , Φ + , Φ − ) \Phi= (\Phi^{0}, \Phi^{+}, \Phi^{-}) Φ = ( Φ 0 , Φ + , Φ − ) , the growth F s , t F_{s,t} F s , t for 1 ≤ s ≤ t 1 \le s \le t 1 ≤ s ≤ t , the blocks [ L , R ) : = { L , … , R − 1 } [L, R) := \{L, \ldots, R - 1\} [ L , R ) := { L , … , R − 1 } , and the merged growth
A L , R : = ∑ i = L R − 1 π i F i , R for 1 ≤ L ≤ R , A_{L,R} := \sum_{i=L}^{R-1} \pi_i F_{i,R} \quad\text{for } 1 \le L \le R, A L , R := i = L ∑ R − 1 π i F i , R for 1 ≤ L ≤ R ,
so that A L , L = 0 A_{L,L} = 0 A L , L = 0 . Unrolling the recursion of Proposition 3.1 gives B t = ∑ i = 1 t π i F i , t B_t = \sum_{i=1}^{t} \pi_i F_{i,t} B t = ∑ i = 1 t π i F i , t , and since w 0 + w + + w − = 1 w^{0} + w^{+} + w^{-} = 1 w 0 + w + + w − = 1 on W W W , the allocation (10) is
w t = ( Φ 0 ( B t ) + r t , Φ + ( B t ) , Φ − ( B t ) ) Φ 0 ( B t ) + Φ + ( B t ) + Φ − ( B t ) + r t . w_t = \frac{\left(\Phi^{0}(B_t) + r_t, \Phi^{+}(B_t), \Phi^{-}(B_t)\right)}{\Phi^{0}(B_t) + \Phi^{+}(B_t) + \Phi^{-}(B_t) + r_t}. w t = Φ 0 ( B t ) + Φ + ( B t ) + Φ − ( B t ) + r t ( Φ 0 ( B t ) + r t , Φ + ( B t ) , Φ − ( B t ) ) .
Both methods therefore compute Φ ( B 1 ) , Φ ( B 2 ) , … \Phi(B_1), \Phi(B_2), \ldots Φ ( B 1 ) , Φ ( B 2 ) , … . For L ≤ K ≤ R L \le K \le R L ≤ K ≤ R and t ≥ K t \ge K t ≥ K , the definitions give the identities
F L , R = F L , K F K , R , A L , R = A L , K F K , R + A K , R , and ∑ i = L K − 1 π i F i , t = A L , K F K , t , (14) F_{L,R} = F_{L,K}F_{K,R}, \quad A_{L,R} = A_{L,K}F_{K,R} + A_{K,R}, \quad\text{and} \quad\sum_{i=L}^{K-1} \pi_i F_{i,t} = A_{L,K}F_{K,t}, \tag*{(14)} F L , R = F L , K F K , R , A L , R = A L , K F K , R + A K , R , and i = L ∑ K − 1 π i F i , t = A L , K F K , t , (14)
as well as A L , t + 1 = ⟨ w , x t ⟩ ( A L , t + π t ) A_{L,t+1} = \langle w, x_t\rangle(A_{L,t} + \pi_t) A L , t + 1 = ⟨ w , x t ⟩ ( A L , t + π t ) for t ≥ L t \ge L t ≥ L .
The Direct Method
For a multi-index k = ( k 0 , k + , k − ) k = (k_0, k_+, k_-) k = ( k 0 , k + , k − ) of nonnegative integers, let ∣ k ∣ : = k 0 + k + + k − |k| := k_0 + k_+ + k_- ∣ k ∣ := k 0 + k + + k − and w k : = ( w 0 ) k 0 ( w + ) k + ( w − ) k − w^k := (w^0)^{k_0}(w^+)^{k_+}(w^-)^{k_-} w k := ( w 0 ) k 0 ( w + ) k + ( w − ) k − , and let e i e_i e i be the multi-index with a one in position i ∈ { 0 , + , − } i \in\{0,+,-\} i ∈ { 0 , + , − } and zeros elsewhere. Since w 0 + w + + w − = 1 w^0+w^++w^- = 1 w 0 + w + + w − = 1 on W W W , the constant π t + 1 \pi_{t+1} π t + 1 in the recursion B t + 1 ( w ) = ⟨ w , x t ⟩ B t ( w ) + π t + 1 B_{t+1}(w) = \langle w, x_t\rangle B_t(w) + \pi_{t+1} B t + 1 ( w ) = ⟨ w , x t ⟩ B t ( w ) + π t + 1 may be replaced by π t + 1 ( w 0 + w + + w − ) t \pi_{t+1}(w^0+w^++w^-)^t π t + 1 ( w 0 + w + + w − ) t . The recursion then produces homogeneous polynomials B t ( w ) = ∑ ∣ k ∣ = t − 1 λ t , k w k B_t(w) = \sum_{|k|=t-1} \lambda_{t,k}w^k B t ( w ) = ∑ ∣ k ∣ = t − 1 λ t , k w k of degree t − 1 t-1 t − 1 that agree with B t B_t B t on W W W . We store their coefficients weighted by the moments of the prior, D t , k : = λ t , k E μ [ w k ] D_{t,k} := \lambda_{t,k}\mathbb{E}_{\mu}[w^k] D t , k := λ t , k E μ [ w k ] .
Proposition E.2. For every t ≥ 1 t \ge1 t ≥ 1 and i ∈ { 0 , + , − } i \in\{0,+,-\} i ∈ { 0 , + , − } ,
Φ i ( B t ) = ∑ ∣ k ∣ = t − 1 k i + 1 / 2 t + 1 / 2 D t , k . \Phi^{i}(B_t) = \sum_{|k|=t-1} \frac{k_i + 1/2}{t + 1/2}D_{t,k}. Φ i ( B t ) = ∣ k ∣ = t − 1 ∑ t + 1/2 k i + 1/2 D t , k . Moreover, D 1 , 0 = π 1 D_{1,0} = \pi_1 D 1 , 0 = π 1 , and for every k k k with ∣ k ∣ = t |k| = t ∣ k ∣ = t ,
D t + 1 , k = 1 t + 1 / 2 ∑ i ∈ { 0 , + , − } k i ≥ 1 x t i ( k i − 1 2 ) D t , k − e i + π t + 1 Γ ( 3 / 2 ) t ! Γ ( t + 3 / 2 ) ∏ i ∈ { 0 , + , − } ( 2 k i k i ) 4 − k i . D_{t+1,k} = \frac{1}{t+1/2}\sum_{\substack{i\in\{0,+,-\}\\k_i\ge1}} x_t^i\left(k_i-\frac{1}{2}\right)D_{t,k-e_i}+\pi_{t+1}\frac{\Gamma(3/2)t!}{\Gamma(t+3/2)}\prod_{i\in\{0,+,-\}}\binom{2k_i}{k_i}4^{-k_i}. D t + 1 , k = t + 1/2 1 i ∈ { 0 , + , − } k i ≥ 1 ∑ x t i ( k i − 2 1 ) D t , k − e i + π t + 1 Γ ( t + 3/2 ) Γ ( 3/2 ) t ! i ∈ { 0 , + , − } ∏ ( k i 2 k i ) 4 − k i .
Proof. For μ = Dirichlet ( 1 / 2 , 1 / 2 , 1 / 2 ) \mu= \operatorname{Dirichlet}(1/2,1/2,1/2) μ = Dirichlet ( 1/2 , 1/2 , 1/2 ) , the moments are
E μ [ w k ] = Γ ( 3 / 2 ) Γ ( ∣ k ∣ + 3 / 2 ) ∏ i ∈ { 0 , + , − } Γ ( k i + 1 / 2 ) Γ ( 1 / 2 ) , \mathbb{E}_{\mu}[w^k] = \frac{\Gamma(3/2)}{\Gamma(|k|+3/2)}\prod_{i\in\{0,+,-\}}\frac{\Gamma(k_i+1/2)}{\Gamma(1/2)}, E μ [ w k ] = Γ ( ∣ k ∣ + 3/2 ) Γ ( 3/2 ) i ∈ { 0 , + , − } ∏ Γ ( 1/2 ) Γ ( k i + 1/2 ) ,
so that E μ [ w k + e i ] = E μ [ w k ] ( k i + 1 / 2 ) / ( ∣ k ∣ + 3 / 2 ) \mathbb{E}_{\mu}[w^{k+e_i}] = \mathbb{E}_{\mu}[w^k](k_i+1/2)/(|k|+3/2) E μ [ w k + e i ] = E μ [ w k ] ( k i + 1/2 ) / ( ∣ k ∣ + 3/2 ) for every i i i . With ∣ k ∣ = t − 1 |k| = t - 1 ∣ k ∣ = t − 1 , this gives
Φ i ( B t ) = ∑ ∣ k ∣ = t − 1 λ t , k E μ [ w k + e i ] = ∑ ∣ k ∣ = t − 1 k i + 1 / 2 t + 1 / 2 D t , k . \Phi^{i}(B_t) = \sum_{|k|=t-1}\lambda_{t,k}\mathbb{E}_{\mu}[w^{k+e_i}] = \sum_{|k|=t-1}\frac{k_i+1/2}{t+1/2}D_{t,k}. Φ i ( B t ) = ∣ k ∣ = t − 1 ∑ λ t , k E μ [ w k + e i ] = ∣ k ∣ = t − 1 ∑ t + 1/2 k i + 1/2 D t , k .
For the recursion, the coefficient of w k w^k w k with ∣ k ∣ = t |k| = t ∣ k ∣ = t in
⟨ w , x t ⟩ B t ( w ) = ∑ ∣ k ′ ∣ = t − 1 λ t , k ′ ∑ i ∈ { 0 , + , − } x t i w k ′ + e i \langle w,x_t\rangle B_t(w) = \sum_{|k'|=t-1}\lambda_{t,k'}\sum_{i\in\{0,+,-\}}x_t^i w^{k'+e_i} ⟨ w , x t ⟩ B t ( w ) = ∣ k ′ ∣ = t − 1 ∑ λ t , k ′ i ∈ { 0 , + , − } ∑ x t i w k ′ + e i
is ∑ i : k i ≥ 1 x t i λ t , k − e i \sum_{i:k_i\ge1}x_t^i\lambda_{t,k-e_i} ∑ i : k i ≥ 1 x t i λ t , k − e i . Multiplying it by E μ [ w k ] = E μ [ w k − e i ] ( k i − 1 / 2 ) / ( t + 1 / 2 ) \mathbb{E}_{\mu}[w^k] = \mathbb{E}_{\mu}[w^{k-e_i}](k_i-1/2)/(t+1/2) E μ [ w k ] = E μ [ w k − e i ] ( k i − 1/2 ) / ( t + 1/2 ) gives the first term. The multinomial theorem gives π t + 1 ( w 0 + w + + w − ) t = π t + 1 ∑ ∣ k ∣ = t ( t ! / ( k 0 ! k + ! k − ! ) ) w k \pi_{t+1}(w^0+w^++w^-)^t = \pi_{t+1}\sum_{|k|=t}(t!/(k_0!k_+!k_-!))w^k π t + 1 ( w 0 + w + + w − ) t = π t + 1 ∑ ∣ k ∣ = t ( t ! / ( k 0 ! k + ! k − !)) w k , and multiplying each coefficient by E μ [ w k ] \mathbb{E}_{\mu}[w^k] E μ [ w k ] gives the second term, since Γ ( k + 1 / 2 ) / ( Γ ( 1 / 2 ) k ! ) = ( 2 k k ) 4 − k \Gamma(k+1/2)/(\Gamma(1/2)k!) = \binom{2k}{k}4^{-k} Γ ( k + 1/2 ) / ( Γ ( 1/2 ) k !) = ( k 2 k ) 4 − k for every integer k ≥ 0 k \ge0 k ≥ 0 . ∎
A homogeneous polynomial of degree t − 1 t-1 t − 1 in three variables has t ( t + 1 ) / 2 t(t+1)/2 t ( t + 1 ) /2 coefficients, so round t t t costs O ( t 2 ) \mathcal{O}(t^2) O ( t 2 ) operations, and T T T rounds cost O ( T 3 ) \mathcal{O}(T^3) O ( T 3 ) time and O ( T 2 ) \mathcal{O}(T^2) O ( T 2 ) memory. In floating point, we store D t , ⋅ D_{t,\cdot} D t , ⋅ divided by its sum, together with the logarithm of this sum, which avoids overflow. Since all terms are nonnegative, the computation involves no cancellation, and each round adds a relative error of the order of the machine precision to every coefficient.
The Grid Representation
Coordinates. For w ∈ W w \in\mathcal{W} w ∈ W with w + + w − > 0 w^+ + w^- > 0 w + + w − > 0 , let σ : = w + + w − \sigma:= w^+ + w^- σ := w + + w − and θ : = w + / σ \theta:= w^+/\sigma θ := w + / σ , so that w = ( 1 − σ , σ θ , σ ( 1 − θ ) ) w = (1-\sigma,\sigma\theta,\sigma(1-\theta)) w = ( 1 − σ , σ θ , σ ( 1 − θ )) with ( σ , θ ) ∈ [ 0 , 1 ] 2 (\sigma,\theta) \in[0,1]^2 ( σ , θ ) ∈ [ 0 , 1 ] 2 ; the excluded cash corner has measure zero under μ \mu μ . The density of μ \mu μ with respect to the Lebesgue measure in ( w + , w − ) (w^+,w^-) ( w + , w − ) is ( w 0 w + w − ) − 1 / 2 / ( 2 π ) (w^0w^+w^-)^{-1/2}/(2\pi) ( w 0 w + w − ) − 1/2 / ( 2 π ) , and the map ( σ , θ ) ↦ ( σ θ , σ ( 1 − θ ) ) (\sigma,\theta) \mapsto(\sigma\theta,\sigma(1-\theta)) ( σ , θ ) ↦ ( σ θ , σ ( 1 − θ )) has Jacobian σ \sigma σ , so for every μ \mu μ -integrable function f f f ,
∫ W f ( w ) μ ( d w ) = ∫ 0 1 ∫ 0 1 f ( 1 − σ , σ θ , σ ( 1 − θ ) ) d θ π θ ( 1 − θ ) d σ 2 1 − σ . \int_{\mathcal{W}} f(w)\mu(dw)=\int_0^1\int_0^1 f(1-\sigma,\sigma\theta,\sigma(1-\theta))\frac{d\theta}{\pi\sqrt{\theta(1-\theta)}}\frac{d\sigma}{2\sqrt{1-\sigma}}. ∫ W f ( w ) μ ( d w ) = ∫ 0 1 ∫ 0 1 f ( 1 − σ , σ θ , σ ( 1 − θ )) π θ ( 1 − θ ) d θ 2 1 − σ d σ .
The two factors are the densities of Beta( 1 / 2 , 1 / 2 ) (1/2,1/2) ( 1/2 , 1/2 ) and Beta( 1 , 1 / 2 ) (1,1/2) ( 1 , 1/2 ) , so θ \theta θ and σ \sigma σ are independent under μ \mu μ with these laws. Since x u 0 = 1 x_u^0=1 x u 0 = 1 , the return ⟨ w , x u ⟩ = 1 + σ ( θ ( x u + − 1 ) + ( 1 − θ ) ( x u − − 1 ) ) \langle w,x_u\rangle=1+\sigma(\theta(x_u^+-1)+(1-\theta)(x_u^--1)) ⟨ w , x u ⟩ = 1 + σ ( θ ( x u + − 1 ) + ( 1 − θ ) ( x u − − 1 )) has degree at most one in each of σ \sigma σ and θ \theta θ , and so do w 0 = 1 − σ w^0=1-\sigma w 0 = 1 − σ , w + = σ θ w^+=\sigma\theta w + = σ θ , and w − = σ ( 1 − θ ) w^-=\sigma(1-\theta) w − = σ ( 1 − θ ) . For N ≥ 1 N\geq1 N ≥ 1 , let P N \mathcal{P}_N P N denote the polynomials in ( σ , θ ) (\sigma,\theta) ( σ , θ ) of degree at most N − 1 N-1 N − 1 in each variable, so that f g ∈ P N + N ′ − 1 fg\in\mathcal{P}_{N+N'-1} f g ∈ P N + N ′ − 1 for all f ∈ P N f\in\mathcal{P}_N f ∈ P N and g ∈ P N ′ g\in\mathcal{P}_{N'} g ∈ P N ′ . In particular, F s , t ∈ P t − s + 1 F_{s,t}\in\mathcal{P}_{t-s+1} F s , t ∈ P t − s + 1 and A L , R ∈ P R − L + 1 A_{L,R}\in\mathcal{P}_{R-L+1} A L , R ∈ P R − L + 1 .
Grids and Resampling. For N ≥ 1 N\geq1 N ≥ 1 , let ξ j N : = ( 1 + cos ( π ( j + 1 / 2 ) / N ) ) / 2 \xi_j^N := (1+\cos(\pi(j+1/2)/N))/2 ξ j N := ( 1 + cos ( π ( j + 1/2 ) / N )) /2 for j = 0 , … , N − 1 j=0,\ldots,N-1 j = 0 , … , N − 1 be the Chebyshev points of the first kind on [ 0 , 1 ] [0,1] [ 0 , 1 ] , and let V N ( f ) : = ( f ( ξ j N , ξ k N ) ) j , k = 0 N − 1 ∈ R N × N V_N(f):=(f(\xi_j^N,\xi_k^N))_{j,k=0}^{N-1}\in\mathbb{R}^{N\times N} V N ( f ) := ( f ( ξ j N , ξ k N ) ) j , k = 0 N − 1 ∈ R N × N collect the values of a function f f f on the tensor grid. Since the points are distinct, V N V_N V N is a bijection from P N \mathcal{P}_N P N to R N × N \mathbb{R}^{N\times N} R N × N . Let T m T_m T m denote the Chebyshev polynomials, defined by T m ( cos ϕ ) = cos ( m ϕ ) T_m(\cos\phi)=\cos(m\phi) T m ( cos ϕ ) = cos ( m ϕ ) . In one variable, a polynomial g ( z ) = ∑ m = 0 N − 1 a m T m ( 2 z − 1 ) g(z)=\sum_{m=0}^{N-1}a_mT_m(2z-1) g ( z ) = ∑ m = 0 N − 1 a m T m ( 2 z − 1 ) satisfies g ( ξ j N ) = ∑ m = 0 N − 1 a m cos ( π m ( j + 1 / 2 ) / N ) g(\xi_j^N)=\sum_{m=0}^{N-1}a_m\cos(\pi m(j+1/2)/N) g ( ξ j N ) = ∑ m = 0 N − 1 a m cos ( π m ( j + 1/2 ) / N ) , so its values and its coefficients are related by a discrete cosine transform, which the fast Fourier transform computes in O ( N ln N ) \mathcal{O}(N\ln N) O ( N ln N ) operations [43 ] . For N , N ′ ≥ 1 N,N'\geq1 N , N ′ ≥ 1 , the resampling S N → N ′ : R N × N → R N ′ × N ′ S_{N\to N'}:\mathbb{R}^{N\times N}\to\mathbb{R}^{N'\times N'} S N → N ′ : R N × N → R N ′ × N ′ applies, along each axis, the transform that maps N N N values to N N N coefficients, keeps the first min { N , N ′ } \min\{N,N'\} min { N , N ′ } coefficients and pads them with zeros to N ′ N' N ′ coefficients, and evaluates the result at the N ′ N' N ′ points.
Quadrature. Let q k θ : = 1 / N q_k^\theta:=1/N q k θ := 1/ N for all k k k , which are the weights of the Gauss–Chebyshev rule for the arcsine law Beta( 1 / 2 , 1 / 2 ) (1/2,1/2) ( 1/2 , 1/2 ) at the points ξ k N \xi_k^N ξ k N , and let
q j σ : = 1 N ( 1 + 2 ∑ m = 1 N − 1 ( − 1 ) m + 1 4 m 2 − 1 cos ( π m ( j + 1 / 2 ) N ) ) q_j^\sigma:=\frac{1}{N}\left(1+2\sum_{m=1}^{N-1}\frac{(-1)^{m+1}}{4m^2-1}\cos\left(\frac{\pi m(j+1/2)}{N}\right)\right) q j σ := N 1 ( 1 + 2 m = 1 ∑ N − 1 4 m 2 − 1 ( − 1 ) m + 1 cos ( N π m ( j + 1/2 ) ) )
be the weights of the interpolatory rule for Beta( 1 , 1 / 2 ) (1,1/2) ( 1 , 1/2 ) at the same points. These weights follow from the discrete orthogonality of the vectors ( cos ( π m ( j + 1 / 2 ) / N ) ) j = 0 N − 1 (\cos(\pi m(j+1/2)/N))_{j=0}^{N-1} ( cos ( π m ( j + 1/2 ) / N ) ) j = 0 N − 1 for m = 0 , … , N − 1 m=0,\ldots,N-1 m = 0 , … , N − 1 , together with the moments E [ T m ( 2 σ − 1 ) ] = ( − 1 ) m + 1 / ( 4 m 2 − 1 ) \mathbb{E}[T_m(2\sigma-1)]=(-1)^{m+1}/(4m^2-1) E [ T m ( 2 σ − 1 )] = ( − 1 ) m + 1 / ( 4 m 2 − 1 ) for σ ∼ Beta ( 1 , 1 / 2 ) \sigma\sim\operatorname{Beta}(1,1/2) σ ∼ Beta ( 1 , 1/2 ) , which the substitution 2 σ − 1 = cos ϕ 2\sigma-1=\cos\phi 2 σ − 1 = cos ϕ turns into 1 2 ∫ 0 π cos ( m ϕ ) cos ( ϕ / 2 ) d ϕ \frac{1}{2}\int_0^\pi\cos(m\phi)\cos(\phi/2)d\phi 2 1 ∫ 0 π cos ( m ϕ ) cos ( ϕ /2 ) d ϕ . Since ∑ m = 1 N − 1 1 / ( 4 m 2 − 1 ) = ( 1 − 1 / ( 2 N − 1 ) ) / 2 \sum_{m=1}^{N-1}1/(4m^2-1)=(1-1/(2N-1))/2 ∑ m = 1 N − 1 1/ ( 4 m 2 − 1 ) = ( 1 − 1/ ( 2 N − 1 )) /2 , every weight satisfies q j σ ≥ 1 / ( N ( 2 N − 1 ) ) > 0 q_j^\sigma\geq1/(N(2N-1))>0 q j σ ≥ 1/ ( N ( 2 N − 1 )) > 0 . For i ∈ { 0 , + , − } i\in\{0,+,-\} i ∈ { 0 , + , − } , define the moment weights Ω N i : = ( q j σ q k θ w i ( ξ j N , ξ k N ) ) j , k = 0 N − 1 \Omega_N^i:=(q_j^\sigma q_k^\theta w^i(\xi_j^N,\xi_k^N))_{j,k=0}^{N-1} Ω N i := ( q j σ q k θ w i ( ξ j N , ξ k N ) ) j , k = 0 N − 1 , where w i w^i w i is written in the coordinates ( σ , θ ) (\sigma,\theta) ( σ , θ ) ; they are nonnegative. We also write ⟨ ⋅ , ⋅ ⟩ \langle\cdot,\cdot\rangle ⟨ ⋅ , ⋅ ⟩ for the entrywise inner product of arrays, and ⊙ \odot ⊙ for their entrywise product.
Lemma E.3 (Grid operations). Let N , N ′ ≥ 1 N,N'\geq1 N , N ′ ≥ 1 and N max : = max { N , N ′ } N_{\max}:=\max\{N,N'\} N m a x := max { N , N ′ } .
(a) The resampling S N → N ′ S_{N\to N'} S N → N ′ costs O ( N max 2 ln N max ) \mathcal{O}(N_{\max}^2\ln N_{\max}) O ( N m a x 2 ln N m a x ) operations, and S N → N ′ V N ( f ) = V N ′ ( f ) S_{N\to N'}V_N(f)=V_{N'}(f) S N → N ′ V N ( f ) = V N ′ ( f ) for every f ∈ P min { N , N ′ } f\in\mathcal{P}_{\min\{N,N'\}} f ∈ P m i n { N , N ′ } .
(b) If N ≥ 2 N\geq2 N ≥ 2 , then Φ i ( f ) = ⟨ Ω N i , V N ( f ) ⟩ \Phi^i(f)=\langle\Omega_N^i,V_N(f)\rangle Φ i ( f ) = ⟨ Ω N i , V N ( f )⟩ for every f ∈ P N − 1 f\in\mathcal{P}_{N-1} f ∈ P N − 1 and every i ∈ { 0 , + , − } i\in\{0,+,-\} i ∈ { 0 , + , − } .
(c) If N ′ ≤ N N'\leq N N ′ ≤ N , then ⟨ ω , V N ( f ) ⟩ = ⟨ ( N / N ′ ) 2 S N → N ′ ω , V N ′ ( f ) ⟩ \langle\omega,V_N(f)\rangle=\langle(N/N')^2S_{N\to N'}\omega,V_{N'}(f)\rangle ⟨ ω , V N ( f )⟩ = ⟨( N / N ′ ) 2 S N → N ′ ω , V N ′ ( f )⟩ for every ω ∈ R N × N \omega\in\mathbb{R}^{N\times N} ω ∈ R N × N and every f ∈ P N ′ f\in\mathcal{P}_{N'} f ∈ P N ′ .
Proof. (a) Each one-dimensional transform costs O ( N max ln N max ) O(N_{\max}\ln N_{\max}) O ( N m a x ln N m a x ) operations, and each axis requires at most N max N_{\max} N m a x of them. For f ∈ P min { N , N ′ } f \in\mathcal{P}_{\min\{N,N'\}} f ∈ P m i n { N , N ′ } , the Chebyshev coefficients of f f f along each axis vanish from the index min { N , N ′ } \min\{N,N'\} min { N , N ′ } on, so truncating or padding them does not change f f f , and the last step evaluates f f f itself.
(b) The product w i f w^i f w i f lies in P N \mathcal{P}_N P N . The interpolatory rule with N N N points is exact for polynomials of degree at most N − 1 N-1 N − 1 , and the Gauss–Chebyshev rule with N N N points is exact for polynomials of degree at most 2 N − 1 2N-1 2 N − 1 . Since μ \mu μ is the product of the two laws in the coordinates ( σ , θ ) (\sigma,\theta) ( σ , θ ) , the tensor rule is exact on P N \mathcal{P}_N P N , which is spanned by products of univariate polynomials, so Φ i ( f ) = ∑ j = 0 N − 1 ∑ k = 0 N − 1 q j i q k i ( w i f ) ( ξ j N , ξ k N ) \Phi^i(f)=\sum_{j=0}^{N-1}\sum_{k=0}^{N-1}q_j^i q_k^i(w^i f)(\xi_j^N,\xi_k^N) Φ i ( f ) = ∑ j = 0 N − 1 ∑ k = 0 N − 1 q j i q k i ( w i f ) ( ξ j N , ξ k N ) .
(c) By (a), V N ( f ) = S N ′ → N V N ′ ( f ) V_N(f)=S_{N'\to N}V_{N'}(f) V N ( f ) = S N ′ → N V N ′ ( f ) , so ⟨ ω , V N ( f ) ⟩ = ⟨ S N ′ → N ⊤ ω , V N ′ ( f ) ⟩ \langle\omega,V_N(f)\rangle=\langle S_{N'\to N}^{\top}\omega,V_{N'}(f)\rangle ⟨ ω , V N ( f )⟩ = ⟨ S N ′ → N ⊤ ω , V N ′ ( f )⟩ , where ⊤ \top ⊤ denotes the adjoint with respect to the entrywise inner product. Let C N C_N C N be the orthonormal type-II discrete cosine transform of size N N N , and let E N ′ → N ∈ R N × N ′ E_{N'\to N}\in\mathbb{R}^{N\times N'} E N ′ → N ∈ R N × N ′ pad a vector with zeros, so that E N ′ → N ⊤ = E N → N ′ E_{N'\to N}^{\top}=E_{N\to N'} E N ′ → N ⊤ = E N → N ′ truncates. Along one axis, S N ′ → N S_{N'\to N} S N ′ → N acts as ( N / N ′ ) 1 / 2 C N ⊤ E N ′ → N C N ′ (N/N')^{1/2}C_N^{\top}E_{N'\to N}C_{N'} ( N / N ′ ) 1/2 C N ⊤ E N ′ → N C N ′ , and S N → N ′ S_{N\to N'} S N → N ′ acts as ( N ′ / N ) 1 / 2 C N ′ ⊤ E N → N ′ C N (N'/N)^{1/2}C_{N'}^{\top}E_{N\to N'}C_N ( N ′ / N ) 1/2 C N ′ ⊤ E N → N ′ C N , where the factors account for the normalization of the orthonormal transforms. Hence the adjoint of the first map is ( N / N ′ ) 1 / 2 C N ′ ⊤ E N → N ′ C N (N/N')^{1/2}C_{N'}^{\top}E_{N\to N'}C_N ( N / N ′ ) 1/2 C N ′ ⊤ E N → N ′ C N , which is N / N ′ N/N' N / N ′ times the second map. Two axes give the factor ( N / N ′ ) 2 (N/N')^2 ( N / N ′ ) 2 , so S N ′ → N ⊤ = ( N / N ′ ) 2 S N → N ′ S_{N'\to N}^{\top}=(N/N')^2S_{N\to N'} S N ′ → N ⊤ = ( N / N ′ ) 2 S N → N ′ .
Functionals. We store a linear functional ψ \psi ψ on polynomials by weights ω ∈ R N × N \omega\in\mathbb{R}^{N\times N} ω ∈ R N × N , and we say that ω \omega ω represents ψ \psi ψ on P N ′ \mathcal{P}_{N'} P N ′ , for some N ′ ≤ N N'\le N N ′ ≤ N , if ψ ( f ) = ⟨ ω , V N ( f ) ⟩ \psi(f)=\langle\omega,V_N(f)\rangle ψ ( f ) = ⟨ ω , V N ( f )⟩ for every f ∈ P N ′ f\in\mathcal{P}_{N'} f ∈ P N ′ . Weights can be formed and transformed exactly in three ways. First, by Lemma E.3(c), the weights ( N / N ′ ) 2 S N → N ′ ω (N/N')^2S_{N\to N'}\omega ( N / N ′ ) 2 S N → N ′ ω on the grid with N ′ N' N ′ points also represent ψ \psi ψ on P N ′ \mathcal{P}_{N'} P N ′ , and we call them the restriction of ω \omega ω to N ′ N' N ′ points. Second, if ω \omega ω represents ψ \psi ψ on P N \mathcal{P}_N P N and g ∈ P N ′ ′ g\in\mathcal{P}_{N''} g ∈ P N ′′ for some N ′ ′ ≤ N N''\le N N ′′ ≤ N , then ω ⊙ V N ( g ) \omega\odot V_N(g) ω ⊙ V N ( g ) represents the functional f ↦ ψ ( g f ) f\mapsto\psi(gf) f ↦ ψ ( g f ) on P N − N ′ ′ + 1 \mathcal{P}_{N-N''+1} P N − N ′′ + 1 , because g f ∈ P N gf\in\mathcal{P}_N g f ∈ P N for such f f f . Third, by Lemma E.3(b), if a ∈ P N a a\in\mathcal{P}_{N_a} a ∈ P N a for some N a < N N_a<N N a < N , then Ω N ( i ) ⊙ V N ( a ) \Omega_N^{(i)}\odot V_N(a) Ω N ( i ) ⊙ V N ( a ) represents the functional f ↦ Φ i ( a f ) f\mapsto\Phi^i(af) f ↦ Φ i ( a f ) on P N − N a \mathcal{P}_{N-N_a} P N − N a , because a f ∈ P N − 1 af\in\mathcal{P}_{N-1} a f ∈ P N − 1 for such f f f . We write Φ ( a ⋅ ) \Phi(a\cdot) Φ ( a ⋅ ) for the triple of these functionals, i ∈ { 0 , + , − } i\in\{0,+,-\} i ∈ { 0 , + , − } , and ψ ( g ⋅ ) \psi(g\cdot) ψ ( g ⋅ ) for the functional f ↦ ψ ( g f ) f\mapsto\psi(gf) f ↦ ψ ( g f ) .
The Divide-and-Conquer Method
Algorithm 2 gives the method in a form that runs online, without knowledge of the horizon. It keeps an accumulator Ψ t ∈ R 3 \Psi_t\in\mathbb{R}^3 Ψ t ∈ R 3 for every round t t t , initialized to the contribution π t Φ ( F t , t ) = π t ( 1 / 3 , 1 / 3 , 1 / 3 ) \pi_t\Phi(F_{t,t})=\pi_t(1/3,1/3,1/3) π t Φ ( F t , t ) = π t ( 1/3 , 1/3 , 1/3 ) of the portfolio started at round t t t , since E μ [ w i ] = 1 / 3 \mathbb{E}_{\mu}[w^i]=1/3 E μ [ w i ] = 1/3 . The procedure Solve( L , R ) (L,R) ( L , R ) adds the contributions π t Φ ( F s , t ) \pi_t\Phi(F_{s,t}) π t Φ ( F s , t ) of all pairs L ≤ s < t ≤ R L\le s<t\le R L ≤ s < t ≤ R in its Appendix E.1. The procedure Prefix( ψ , L , R ) (\psi,L,R) ( ψ , L , R ) applies a triple ψ = ( ψ 0 , ψ + , ψ − ) \psi=(\psi^0,\psi^+,\psi^-) ψ = ( ψ 0 , ψ + , ψ − ) of linear functionals to the products F L , t F_{L,t} F L , t for t ∈ [ L , R ) t\in[L,R) t ∈ [ L , R ) and adds the results to the accumulators; it evaluates the functional ψ = Φ ( A L , K ⋅ ) \psi=\Phi(A_{L,K}\cdot) ψ = Φ ( A L , K ⋅ ) of the crossing pairs in Appendix E.1. The procedure Epochs removes the horizon: epoch J = 0 , 1 , 2 , … J=0,1,2,\ldots J = 0 , 1 , 2 , … consists of the rounds [ 2 J , 2 J + 1 ) [2^J,2^{J+1}) [ 2 J , 2 J + 1 ) , and at its start, all portfolios started before round 2 J 2^J 2 J are merged into A 1 , 2 J A_{1,2^J} A 1 , 2 J . Blocks of at most m 0 m_0 m 0 rounds, for a fixed integer m 0 ≥ 1 m_0\ge1 m 0 ≥ 1 , are leaves , which are handled round by round.
Representation. In a call on a block [ L , R ) [L,R) [ L , R ) of m : = R − L m:=R-L m := R − L rounds, the polynomials P P P and A A A are stored by their values on the grid with m + 1 m+1 m + 1 points per axis, and products and sums are formed on this grid after resampling the operands. In Solve, the weights of Φ ( A 1 ⋅ ) \Phi(A_1\cdot) Φ ( A 1 ⋅ ) are formed on the grid with m + 1 m+1 m + 1 points as Ω m + 1 ( i ) ⊙ V m + 1 ( A 1 ) \Omega_{m+1}^{(i)}\odot V_{m+1}(A_1) Ω m + 1 ( i ) ⊙ V m + 1 ( A 1 ) , and they are restricted to R − K R-K R − K points before the call of Prefix. In Prefix, the weights ω \omega ω of ψ \psi ψ lie on the grid with m m m points; the first sub-call receives their restriction to K − L K-L K − L points, and the second sub-call receives the restriction of ω ⊙ V m ( P 1 ) \omega\odot V_m(P_1) ω ⊙ V m ( P 1 ) to R − K R-K R − K points. In a leaf of Prefix, ψ ( P ) \psi(P) ψ ( P ) is evaluated on the grid of ψ \psi ψ , after resampling P P P to it. In Epochs, the weights of Φ ( A ⋅ ) \Phi(A\cdot) Φ ( A ⋅ ) at the start of epoch J J J are formed on the grid with 2 J + 1 2^{J+1} 2 J + 1 points and restricted to 2 J 2^J 2 J points, and the update of A A A at the end of epoch J J J is formed on the grid with 2 J + 1 2^{J+1} 2 J + 1 points. In practice, grid sizes may be rounded up to lengths for which the fast transforms are efficient, which preserves exactness.
Scheduling. The procedures run as coroutines. The statement “wait for x t x_t x t ” suspends the current call until x t x_t x t has been observed, and returns at once if it has. The statement “run concurrently” starts two calls, which are then resumed independently, and continues once both have returned. After observing x t x_t x t , the main loop resumes every suspended call, in any order, until each call waits for x t + 1 x_{t+1} x t + 1 or has returned. The calls share no state except the accumulators, to which they only add, so the order does not matter. When all price relatives are known in advance, every wait returns at once, and the same procedures compute Φ ( B 1 ) , … , Φ ( B T ) \Phi(B_1),\ldots,\Phi(B_T) Φ ( B 1 ) , … , Φ ( B T ) offline, as in Appendix § 12 .§ 1 .
Figure 2 (PDF p. 28).
The first lemma shows that the procedures compute the right quantities, regardless of the schedule.
Lemma E.4. Let 1 ≤ L < R 1 \le L < R 1 ≤ L < R .
(a) If the weights of ψ \psi ψ represent ψ \psi ψ on P R − L \mathcal{P}_{R-L} P R − L , then Prefix ( ψ , L , R ) \operatorname{Prefix}(\psi,L,R) Prefix ( ψ , L , R ) adds ψ ( F L , t ) \psi(F_{L,t}) ψ ( F L , t ) to Ψ t \Psi_t Ψ t for every t ∈ [ L , R ) t \in[L,R) t ∈ [ L , R ) and returns F L , R F_{L,R} F L , R .
(b) Solve ( L , R ) \operatorname{Solve}(L,R) Solve ( L , R ) adds π s Φ ( F s , t ) \pi_s\Phi(F_{s,t}) π s Φ ( F s , t ) to Ψ t \Psi_t Ψ t for every pair L ≤ s < t < R L \le s < t < R L ≤ s < t < R and returns ( F L , R , A L , R ) (F_{L,R},A_{L,R}) ( F L , R , A L , R ) .
(c) For every t ≥ 1 t \ge1 t ≥ 1 , the calls started by Epochs \operatorname{Epochs} Epochs add ∑ i = 1 t − 1 π i Φ ( F i , t ) \sum_{i=1}^{t-1}\pi_i\Phi(F_{i,t}) ∑ i = 1 t − 1 π i Φ ( F i , t ) to Ψ t \Psi_t Ψ t in total, so that Ψ t \Psi_t Ψ t reaches Φ ( B t ) \Phi(B_t) Φ ( B t ) .
Proof. We prove (a) and (b) by induction on R − L R-L R − L , and we first treat Prefix \operatorname{Prefix} Prefix . In a leaf, P = F L , t P=F_{L,t} P = F L , t when ψ ( P ) \psi(P) ψ ( P ) is added to Ψ t \Psi_t Ψ t , because F L , L = 1 F_{L,L}=1 F L , L = 1 and F L , t + 1 = ⟨ w , x t ⟩ F L , t F_{L,t+1}=\langle w,x_t\rangle F_{L,t} F L , t + 1 = ⟨ w , x t ⟩ F L , t , and at the end, P = F L , R P=F_{L,R} P = F L , R . Since F L , t ∈ P R − L F_{L,t}\in\mathcal{P}_{R-L} F L , t ∈ P R − L for t < R t<R t < R , the weights of ψ \psi ψ evaluate ψ ( F L , t ) \psi(F_{L,t}) ψ ( F L , t ) exactly. Otherwise, L < K < R L<K<R L < K < R . The first sub-call receives weights that represent ψ \psi ψ on P K − L \mathcal{P}_{K-L} P K − L , so by induction it adds ψ ( F L , t ) \psi(F_{L,t}) ψ ( F L , t ) for t ∈ [ L , K ) t\in[L,K) t ∈ [ L , K ) and returns P 1 = F L , K ∈ P K − L + 1 P_1=F_{L,K}\in\mathcal{P}_{K-L+1} P 1 = F L , K ∈ P K − L + 1 . For t ∈ [ K , R ) t\in[K,R) t ∈ [ K , R ) , we have ψ ( F L , t ) = ψ ( P 1 F K , t ) \psi(F_{L,t})=\psi(P_1F_{K,t}) ψ ( F L , t ) = ψ ( P 1 F K , t ) by (14) , and the weights of the functional ψ ( P 1 ⋅ ) \psi(P_1\cdot) ψ ( P 1 ⋅ ) represent it on P R − K \mathcal{P}_{R-K} P R − K by the second operation on weights, with N = R − L N=R-L N = R − L and N ′ ′ = K − L + 1 N''=K-L+1 N ′′ = K − L + 1 . By induction, the second sub-call adds these values for t ∈ [ K , R ) t\in[K,R) t ∈ [ K , R ) and returns F K , R F_{K,R} F K , R , and P 1 P 2 = F L , R P_1P_2=F_{L,R} P 1 P 2 = F L , R by (14) .
For Solve, a leaf has A = A L , t A=A_{L,t} A = A L , t when Φ ( A ) \Phi(A) Φ ( A ) is added to Ψ t \Psi_t Ψ t , because A L , L = 0 A_{L,L}=0 A L , L = 0 and A L , t + 1 = ⟨ w , x t ⟩ ( A L , t + π t ) A_{L,t+1}=\langle w,x_t\rangle(A_{L,t}+\pi_t) A L , t + 1 = ⟨ w , x t ⟩ ( A L , t + π t ) . Since A L , t ∈ P R − L A_{L,t}\in\mathcal{P}_{R-L} A L , t ∈ P R − L for t < R t<R t < R , Lemma E.3(b) with N = R − L + 1 N=R-L+1 N = R − L + 1 evaluates Φ ( A L , t ) = ∑ i = 1 t − 1 π i Φ ( F i , t ) \Phi(A_{L,t})=\sum_{i=1}^{t-1}\pi_i\Phi(F_{i,t}) Φ ( A L , t ) = ∑ i = 1 t − 1 π i Φ ( F i , t ) exactly, and the leaf returns ( F L , R , A L , R ) (F_{L,R},A_{L,R}) ( F L , R , A L , R ) . Otherwise, by induction, the two calls of Solve add the pairs with L ≤ s < t < K L\le s<t<K L ≤ s < t < K and with K ≤ s < t < R K\le s<t<R K ≤ s < t < R , and return ( F L , K , A L , K ) (F_{L,K},A_{L,K}) ( F L , K , A L , K ) and ( F K , R , A K , R ) (F_{K,R},A_{K,R}) ( F K , R , A K , R ) . The remaining pairs have L ≤ s < K ≤ t < R L\le s<K\le t<R L ≤ s < K ≤ t < R , and for each such t t t , their contributions sum to Φ ( A L , K F K , t ) \Phi(A_{L,K}F_{K,t}) Φ ( A L , K F K , t ) by (14) . The weights of Φ ( A L , K ⋅ ) \Phi(A_{L,K}\cdot) Φ ( A L , K ⋅ ) represent it on P R − K \mathcal{P}_{R-K} P R − K by the third operation on weights, with N = R − L + 1 N=R-L+1 N = R − L + 1 and N a = K − L + 1 N_a=K-L+1 N a = K − L + 1 , and so does their restriction to R − K R-K R − K points; by (a), the call of Prefix adds these contributions. The returned values follow from (14) . All products and sums are exact, since every polynomial formed in a call on m m m rounds lies in P m + 1 \mathcal{P}_{m+1} P m + 1 .
For (c), induction on J J J shows that A = A 1 , 2 J A=A_{1,2^J} A = A 1 , 2 J at the start of epoch J J J : initially A 1 , 1 = 0 A_{1,1}=0 A 1 , 1 = 0 , and A 1 , 2 J + 1 = A 1 , 2 J F 2 J , 2 J + 1 + A 2 J , 2 J + 1 A_{1,2^{J+1}}=A_{1,2^J}F_{2^J,2^{J+1}}+A_{2^J,2^{J+1}} A 1 , 2 J + 1 = A 1 , 2 J F 2 J , 2 J + 1 + A 2 J , 2 J + 1 by (14) . The weights of Φ ( A 1 , 2 J ⋅ ) \Phi(A_{1,2^J}\cdot) Φ ( A 1 , 2 J ⋅ ) , formed on the grid with 2 J + 1 2^{J+1} 2 J + 1 points, represent it on P 2 J \mathcal{P}_{2^J} P 2 J by the third operation on weights, since A 1 , 2 J ∈ P 2 J A_{1,2^J}\in\mathcal{P}_{2^J} A 1 , 2 J ∈ P 2 J . Every round t ≥ 1 t\ge1 t ≥ 1 lies in exactly one epoch, the one with 2 J ≤ t < 2 J + 1 2^J\le t<2^{J+1} 2 J ≤ t < 2 J + 1 . In this epoch, the call of Solve adds the pairs with 2 J ≤ s < t 2^J\le s<t 2 J ≤ s < t by (b), and the call of Prefix adds Φ ( A 1 , 2 J F 2 J , t ) = ∑ i = 1 2 J − 1 π i Φ ( F i , t ) \Phi(A_{1,2^J}F_{2^J,t})=\sum_{i=1}^{2^J-1}\pi_i\Phi(F_{i,t}) Φ ( A 1 , 2 J F 2 J , t ) = ∑ i = 1 2 J − 1 π i Φ ( F i , t ) by (a) and (14) . Calls of other epochs add nothing to Ψ t \Psi_t Ψ t . Together with the initial value π t Φ ( F t , t ) \pi_t\Phi(F_{t,t}) π t Φ ( F t , t ) , this gives Ψ t = ∑ i = 1 t π i Φ ( F i , t ) = Φ ( B t ) \Psi_t=\sum_{i=1}^{t}\pi_i\Phi(F_{i,t})=\Phi(B_t) Ψ t = ∑ i = 1 t π i Φ ( F i , t ) = Φ ( B t ) .
The second lemma shows that the schedule never needs a future price relative.
Lemma E.5. In Algorithm 2, every call on a block [ L , R ) [L,R) [ L , R ) is started before w L w_L w L is computed, and after x L − 1 x_{L-1} x L − 1 has been observed if L ≥ 2 L\ge2 L ≥ 2 , and its inputs depend only on x 1 , … , x L − 1 x_1,\ldots,x_{L-1} x 1 , … , x L − 1 . For every t ∈ [ L , R ) t\in[L,R) t ∈ [ L , R ) , the call completes its contribution to Ψ t \Psi_t Ψ t before it waits for x t x_t x t , using only x 1 , … , x t − 1 x_1,\ldots,x_{t-1} x 1 , … , x t − 1 . Consequently, Ψ t = Φ ( B t ) \Psi_t=\Phi(B_t) Ψ t = Φ ( B t ) when w t w_t w t is computed, and w t w_t w t depends only on x 1 , … , x t − 1 x_1,\ldots,x_{t-1} x 1 , … , x t − 1 .
Proof. A call on [ L , R ) [L,R) [ L , R ) waits for x L , … , x R − 1 x_L,\ldots,x_{R-1} x L , … , x R − 1 in this order and returns right after x R − 1 x_{R-1} x R − 1 has been observed. We show the first two claims by induction over the calls, in the order in which they start. The calls of epoch 0 start before round 1 with the input Φ ( 0 ⋅ ) \Phi(0\cdot) Φ ( 0 ⋅ ) . The calls of epoch J + 1 J+1 J + 1 start as soon as those of epoch J J J return, that is, right after x 2 J + 1 − 1 x_{2^{J+1}-1} x 2 J + 1 − 1 has been observed and before w 2 J + 1 w_{2^{J+1}} w 2 J + 1 is computed, and their input depends on A 1 , 2 J + 1 A_{1,2^{J+1}} A 1 , 2 J + 1 , which depends only on x 1 , … , x 2 J + 1 − 1 x_1,\ldots,x_{2^{J+1}-1} x 1 , … , x 2 J + 1 − 1 . Within Solve( L , R ) (L,R) ( L , R ) , the first sub-call starts with its parent, and the other two start as soon as the first returns, that is, right after x K − 1 x_{K-1} x K − 1 has been observed, with the input Φ ( A L , K ⋅ ) \Phi(A_{L,K}\cdot) Φ ( A L , K ⋅ ) , which depends only on x 1 , … , x K − 1 x_1,\ldots,x_{K-1} x 1 , … , x K − 1 . The same holds within Prefix( ψ , L , R ) (\psi,L,R) ( ψ , L , R ) , whose second sub-call receives ψ ( F L , K ⋅ ) \psi(F_{L,K}\cdot) ψ ( F L , K ⋅ ) . In a leaf, the contribution to Ψ t \Psi_t Ψ t is added right before the wait for x t x_t x t , and it depends on the inputs and on x L , … , x t − 1 x_L,\ldots,x_{t-1} x L , … , x t − 1 ; a call that is not a leaf contributes only through its sub-calls. This proves the first two claims.
When w t w_t w t is computed, x t x_t x t has not been observed, and every call has been resumed until it waits for x t x_t x t or has returned. By the first claim, every call whose block contains t t t has been started, and by the second claim, it has completed its contribution to Ψ t \Psi_t Ψ t . No call adds to Ψ t \Psi_t Ψ t later, since every contribution to Ψ t \Psi_t Ψ t is added before a wait for x t x_t x t . Hence Ψ t \Psi_t Ψ t has its final value, which is Φ ( B t ) \Phi(B_t) Φ ( B t ) by Lemma E.4(c), and it depends only on x 1 , … , x t − 1 x_1,\ldots,x_{t-1} x 1 , … , x t − 1 .
Proof of Proposition E.1
Lemmas E.4 and E.5 show that Algorithm 2 computes w t w_t w t from Ψ t = Φ ( B t ) \Psi_t=\Phi(B_t) Ψ t = Φ ( B t ) and x t x_t x t , using only x 1 , … , x t − 1 x_1,\ldots,x_{t-1} x 1 , … , x t − 1 , exactly in exact arithmetic and without the horizon. Running two calls concurrently changes the order of the operations but not the operations themselves, so the cost is the same as for a sequential run.
Time. Consider a call on a block of m m m rounds that is not a leaf. Apart from its sub-calls, it performs a constant number of resamplings, restrictions, entrywise products, and sums, all on grids with at most m + 1 m+1 m + 1 points per axis, which cost O ( m 2 ln m ) O(m^2 \ln m) O ( m 2 ln m ) by Lemma E.3. A leaf has at most m 0 m_0 m 0 rounds, so it costs O ( 1 ) O(1) O ( 1 ) . Let C P ( m ) C_{\mathrm{P}}(m) C P ( m ) and C S ( m ) C_{\mathrm{S}}(m) C S ( m ) be the largest costs of Prefix and Solve on blocks of m m m rounds. Then, for m > m 0 m>m_0 m > m 0 ,
C P ( m ) ≤ C P ( ⌊ m / 2 ⌋ ) + C P ( ⌈ m / 2 ⌉ ) + O ( m 2 ln m ) C_{\mathrm{P}}(m) \le C_{\mathrm{P}}(\lfloor m/2\rfloor) + C_{\mathrm{P}}(\lceil m/2\rceil) + O(m^2 \ln m) C P ( m ) ≤ C P (⌊ m /2 ⌋) + C P (⌈ m /2 ⌉) + O ( m 2 ln m )
At depth d d d of the recursion of Prefix, there are at most 2 d 2^d 2 d calls, each on at most ⌈ m / 2 d ⌉ ≤ 2 m / 2 d \lceil m/2^d\rceil\le2m/2^d ⌈ m / 2 d ⌉ ≤ 2 m / 2 d rounds, so the calls that are not leaves cost O ( 2 d ( m / 2 d ) 2 ln m ) = O ( m 2 ln m / 2 d ) O(2^d(m/2^d)^2\ln m)=O(m^2\ln m/2^d) O ( 2 d ( m / 2 d ) 2 ln m ) = O ( m 2 ln m / 2 d ) in total, and the at most m m m leaves cost O ( m ) O(m) O ( m ) . Summing over d d d gives C P ( m ) = O ( m 2 ln m ) C_{\mathrm{P}}(m)=O(m^2\ln m) C P ( m ) = O ( m 2 ln m ) . Hence
C S ( m ) ≤ C S ( ⌊ m / 2 ⌋ ) + C S ( ⌈ m / 2 ⌉ ) + C P ( ⌈ m / 2 ⌉ ) + O ( m 2 ln m ) = C S ( ⌊ m / 2 ⌋ ) + C S ( ⌈ m / 2 ⌉ ) + O ( m 2 ln m ) C_{\mathrm{S}}(m) \le C_{\mathrm{S}}(\lfloor m/2\rfloor)+C_{\mathrm{S}}(\lceil m/2\rceil)+C_{\mathrm{P}}(\lceil m/2\rceil)+O(m^2\ln m)=C_{\mathrm{S}}(\lfloor m/2\rfloor)+C_{\mathrm{S}}(\lceil m/2\rceil)+O(m^2\ln m) C S ( m ) ≤ C S (⌊ m /2 ⌋) + C S (⌈ m /2 ⌉) + C P (⌈ m /2 ⌉) + O ( m 2 ln m ) = C S (⌊ m /2 ⌋) + C S (⌈ m /2 ⌉) + O ( m 2 ln m )
and the same argument gives C S ( m ) = O ( m 2 ln m ) C_{\mathrm{S}}(m)=O(m^2\ln m) C S ( m ) = O ( m 2 ln m ) . Epoch J ≥ 1 J\ge1 J ≥ 1 consists of one call of each procedure on 2 J 2^J 2 J rounds, together with the construction of Φ ( A ⋅ ) \Phi(A_{\cdot}) Φ ( A ⋅ ) and the update of A A A on grids with 2 J + 1 2^{J+1} 2 J + 1 points, so it costs O ( 4 J J ) O(4^J J) O ( 4 J J ) . The first T T T rounds involve only the epochs with 2 J ≤ T 2^J\le T 2 J ≤ T , and the work done in an unfinished epoch is at most the cost of the whole epoch. Summing the geometric series over J ≤ log 2 T J\le\log_2 T J ≤ log 2 T gives a total time of O ( T 2 ln T ) O(T^2\ln T) O ( T 2 ln T ) .
Memory. At any time, the active calls are those whose blocks contain the current round. They form one chain of nested calls of Solve in the current epoch, together with, for each of these calls whose second half contains the current round, one chain of nested calls of Prefix on that second half, and the call of Prefix of the epoch with its own chain. A call on m m m rounds stores O ( m 2 ) O(m^2) O ( m 2 ) numbers, namely its inputs, the values returned by its first sub-call, and its current polynomials, and the block sizes decrease geometrically along each chain and across the chains. Together with A A A , which has O ( T 2 ) O(T^2) O ( T 2 ) grid values, and the accumulators, the memory is O ( T 2 ) O(T^2) O ( T 2 ) .
Uneven Work. The work is not spread evenly over the rounds. A call performs its own work at its start, at its midpoint, and right after its last price relative has been observed, and each epoch starts with the construction of Φ ( A ⋅ ) \Phi(A_{\cdot}) Φ ( A ⋅ ) on its largest grid. A single round t t t can therefore require O ( t 2 ln t ) O(t^2\ln t) O ( t 2 ln t ) operations, while the first T T T rounds take O ( T ln T ) O(T\ln T) O ( T ln T ) operations per round on average, compared with O ( t 2 ) O(t^2) O ( t 2 ) operations at every round t t t for the direct method.
Numerical Accuracy
In floating point, every grid array is stored as a matrix of values together with a common logarithmic scale, which avoids overflow. The values of F s , t F_{s,t} F s , t and A L , R A_{L,R} A L , R on the grids are nonnegative, and so are the moment weights Ω N ( i ) \Omega_N^{(i)} Ω N ( i ) , since both one-dimensional rules have positive weights. Entrywise products and sums of nonnegative arrays are accurate to machine precision in every entry. Resampling and restriction, in contrast, mix all entries of an array through orthogonal cosine transforms, so they are accurate only relative to the size of the whole array, and an entry far below the largest one can lose its relative accuracy. The grid values of F s , t F_{s,t} F s , t are wealths of CRPs, and they spread over many orders of magnitude when the rounds from t t t to T T T carry strong evidence for one direction of the shift, but also during a long null phase, in which the tax shrinks the wealth of the risky portfolios while cash keeps its wealth. In both cases, an entry that loses accuracy belongs to a portfolio far behind the best one, and it matters only if later rounds lift it by the order of 30 nats relative to the best one. We expect this to require strong evidence for a shift, and thus to happen typically long after M t M_t M t has crossed 1 / α 1/\alpha 1/ α , but this is a heuristic rather than a guarantee. In any case, projecting every computed allocation onto W \mathcal{W} W keeps the test valid by Proposition 2.4 , so numerical errors can reduce the power of the detector but not its false-alarm control. Running the method a second time on slightly larger grids, which is exact in exact arithmetic but rounds differently, gives an empirical estimate of the error. Appendix § 12 .7 tests this account against the direct method.
Comparison With the Direct Method
We compare the divide-and-conquer method with the direct method of Appendix § 12 .§ 2 , first on the computed allocations and then on cost. All streams use n = 1000 n=1000 n = 1000 reference scores from N ( 0 , 1 ) \mathcal{N}(0,1) N ( 0 , 1 ) , the DKW band at level δ = 0.1 \delta=0.1 δ = 0.1 , and α = 0.05 \alpha=0.05 α = 0.05 .
Agreement. Both methods first match the definition (9) evaluated literally, with each component integrated separately by a tensor Gauss rule that is exact for its degree. For T ∈ { 16 , 32 , 64 } T \in\{16,32,64\} T ∈ { 16 , 32 , 64 } and a shift to N ( 1 , 1 ) \mathcal{N}(1,1) N ( 1 , 1 ) after round ⌊ 2 T / 3 ⌋ \lfloor2T/3 \rfloor ⌊ 2 T /3 ⌋ , the allocations of both methods differ from the literal ones by at most 7.8 ⋅ 10 − 15 7.8 \cdot10^{-15} 7.8 ⋅ 1 0 − 15 . We then compare the two methods on four streams of T ∈ { 500 , 1000 , 2000 , 4000 , 8000 } T \in\{500,1000,2000,4000,8000\} T ∈ { 500 , 1000 , 2000 , 4000 , 8000 } rounds: a null stream; a shift to N ( 1 , 1 ) \mathcal{N}(1,1) N ( 1 , 1 ) after round ⌊ 2 T / 3 ⌋ \lfloor2T/3 \rfloor ⌊ 2 T /3 ⌋ ; a drift with mean 1.5 ( t − ⌊ T / 3 ⌋ ) + / 100 1.5(t-\lfloor T/3 \rfloor)_+/100 1.5 ( t − ⌊ T /3 ⌋ ) + /100 ; and a reversal, with N ( 1 , 1 ) \mathcal{N}(1,1) N ( 1 , 1 ) on the rounds ⌊ T / 3 ⌋ + 1 , … , ⌊ 2 T / 3 ⌋ \lfloor T/3 \rfloor+1,\ldots,\lfloor2T/3 \rfloor ⌊ T /3 ⌋ + 1 , … , ⌊ 2 T /3 ⌋ and N ( − 1 , 1 ) \mathcal{N}(-1,1) N ( − 1 , 1 ) afterwards. On the first three streams, the allocations agree to within 1.6 ⋅ 10 − 15 1.6 \cdot10^{-15} 1.6 ⋅ 1 0 − 15 in every round and ln M t \ln M_t ln M t to within 3.5 ⋅ 10 − 13 3.5 \cdot10^{-13} 3.5 ⋅ 1 0 − 13 (Table 1 ). The reversal stream is the difficult case of Appendix § 12 .§ 6 : it first collects strong evidence for an upward shift, between 25 and 644 nats in ln M t \ln M_t ln M t by the reversal, and then evidence for a downward one. Both methods raise the alarm in the same round, and their allocations agree to within 10 − 9 10^{-9} 1 0 − 9 until 15 to 28 rounds after the reversal. From then on, the divide-and-conquer allocations are inaccurate, and for T ≥ 2000 T \ge2000 T ≥ 2000 they even leave W \mathcal{W} W . The error estimate of Appendix § 12 .§ 6 detects this: it first exceeds 10 − 9 10^{-9} 1 0 − 9 at most three rounds after the allocations first differ by 10 − 9 10^{-9} 1 0 − 9 . Since the test stops at the alarm, which comes 142 to 2627 rounds before this point, the detector itself is not affected. A monitor that keeps betting after an alarm can project the allocations onto W \mathcal{W} W (Appendix § 12 .§ 6 ), which keeps the test valid, although no longer exact.
Table 1. Agreement of the direct and the divide-and-conquer methods. Left: largest difference max t ≤ T max i ∣ w t i − w ~ t i ∣ \max_{t \le T}\max_i \lvert w_t^i-\widetilde{w}_t^i\rvert max t ≤ T max i ∣ w t i − w t i ∣ between the allocations w t w_t w t and w ~ t \widetilde{w}_t w t of the two methods. Right, for the reversal stream: the alarm time τ \tau τ (the same for both methods), the round ⌊ 2 T / 3 ⌋ \lfloor2T/3 \rfloor ⌊ 2 T /3 ⌋ of the reversal, ln M \ln M ln M at the reversal, and the first round at which the allocations differ by more than 10 − 9 10^{-9} 1 0 − 9 .
Cost. Figure 6 reports the wall-clock time and the peak memory of both methods on the shift stream, on one core of an Apple M1 Max. Every run starts a fresh process, and for T ≤ 2000 T \le2000 T ≤ 2000 we report the fastest of three runs. The direct method is a compiled loop, and the divide-and-conquer method uses the fast cosine transforms of SciPy, with blocks of at most m 0 = 32 m_0=32 m 0 = 32 rounds as leaves. The times follow the predicted orders: from T = 8000 T=8000 T = 8000 to T = 12,000 T=12{,}000 T = 12 , 000 , the direct method slows down by a factor of 3.3, against 1.5 3 ≈ 3.4 1.5^3 \approx3.4 1. 5 3 ≈ 3.4 , and the divide-and-conquer method by 2.4, against 1.5 2 ln ( 12,000 ) / ln ( 8000 ) ≈ 2.35 1.5^2 \ln(12{,}000)/\ln(8000) \approx2.35 1. 5 2 ln ( 12 , 000 ) / ln ( 8000 ) ≈ 2.35 . The divide-and-conquer method is faster from T = 2000 T=2000 T = 2000 on, and the gap grows with T T T : at T = 12,000 T=12{,}000 T = 12 , 000 , it takes 43 seconds against 242, a speedup of 5.7. The price is memory. Both methods need O ( T 2 ) O(T^2) O ( T 2 ) memory, but the constant of the divide-and-conquer method is much larger: its peak is 7.8 GiB at T = 12,000 T=12{,}000 T = 12 , 000 , against 0.8 GiB for the direct method, which stores only the coefficients of B t B_t B t . On a machine with 32 GiB of memory, this limits a single run of the divide-and-conquer method to roughly 20,000 rounds.
Figure 6. Cost of the direct and the divide-and-conquer methods on one core, against the horizon T T T : (a) wall-clock time, with reference lines through the last point of each method, and (b) peak memory of the process, including about 0.1 GiB for the Python interpreter.
Details of the Experiments
This appendix gives the complete setup of the experiments in § 5 , the results for every configuration, and further checks. Throughout, the restarting universal portfolio uses the Dirichlet prior Dirichlet ( 1 / 2 , 1 / 2 , 1 / 2 ) \operatorname{Dirichlet}(1/2, 1/2, 1/2) Dirichlet ( 1/2 , 1/2 , 1/2 ) and the heavy-tailed allocation (11) , and its allocations are computed exactly with the direct method of Appendix § 12 .§ 2 . It rejects when its test martingale M t M_t M t reaches 1 / α 1/\alpha 1/ α , and we also record its portfolio wealth Wealth t ≤ M t \operatorname{Wealth}_t \le M_t Wealth t ≤ M t .
Synthetic Experiments
Data. The reference dataset has n n n i.i.d. draws from N ( 0 , 1 ) \mathcal{N}(0,1) N ( 0 , 1 ) , and the test scores satisfy X t ∼ N ( 0 , 1 ) X_t \sim\mathcal{N}(0,1) X t ∼ N ( 0 , 1 ) for t ≤ t 0 t \le t_0 t ≤ t 0 . After the shift, they follow one of two alternatives.
Sharp change point: X t ∼ N ( d , 1 ) X_t \sim\mathcal{N}(d,1) X t ∼ N ( d , 1 ) with d ∈ { 1 , 1.5 , 2 } d \in\{1,1.5,2\} d ∈ { 1 , 1.5 , 2 } , and n = 1000 n = 1000 n = 1000 .
Gradual drift: X t ∼ N ( λ ( t − t 0 ) / 100 , 1 ) X_t \sim\mathcal{N}(\lambda(t-t_0)/100,1) X t ∼ N ( λ ( t − t 0 ) /100 , 1 ) with λ ∈ { 1.5 , 3 , 5 } \lambda\in\{1.5,3,5\} λ ∈ { 1.5 , 3 , 5 } , and n = 2000 n = 2000 n = 2000 . The per-round rates 0.015, 0.03, and 0.05 are those of Shaer et al. [ [36 ] .
The shift time runs over t 0 ∈ { 0 , 200 , 400 , … , 4000 } t_0 \in\{0,200,400,\ldots,4000\} t 0 ∈ { 0 , 200 , 400 , … , 4000 } , every stream has length T = 4500 T = 4500 T = 4500 , and every configuration is repeated 100 times. Within a trial, all magnitudes (or rates) share the same draws, so they differ only after t 0 t_0 t 0 .
Relation To The Experiments Of Shaer et al. [ [36 ] . The three synthetic experiments of Shaer et al. [ [36 ] are slices of this design, with their own random draws. Their delayed change point is d = 2 d = 2 d = 2 at t 0 ∈ { 200 , 600 , 4000 } t_0 \in\{200,600,4000\} t 0 ∈ { 200 , 600 , 4000 } , and we use their seed for each trial for every t 0 > 0 t_0 > 0 t 0 > 0 . Their immediate change point (horizon 1000) and their drift (horizon 100) are the slices t 0 = 0 t_0 = 0 t 0 = 0 ; there, we use their seeds, draw their reference dataset and their test points, and continue the stream to T = 4500 T = 4500 T = 4500 with an independent generator. On all of these slices, both CTM implementations reproduce the authors’ code exactly, including the randomized conformal p p p -values and the warm-up. The median delays read off our results agree with those in Figure 3 of Shaer et al. [ [36 ] within three rounds, with one exception: for the CCTM at t 0 = 4000 t_0 = 4000 t 0 = 4000 , the published curve crosses 1 / 2 1/2 1/2 about eight rounds later than ours. Since the code paths agree exactly, we attribute this difference to the random draws.
Methods And Hyperparameters. All methods use α = 0.05 \alpha= 0.05 α = 0.05 and the Dvoretzky–Kiefer–Wolfowitz band at level δ = 0.1 \delta= 0.1 δ = 0.1 .
Restarting universal portfolio (Algorithm 1): no further parameters and no warm-up.
CCTM [[36 ] ]: ONS on the smoothed bet, with bets in [ − 1 / 2 , 1 / 2 ] [-1/2,1/2] [ − 1/2 , 1/2 ] , clipping threshold C = 0.1 C = 0.1 C = 0.1 , and smoothing constant k = 10 − 6 k = 10^{-6} k = 1 0 − 6 .
Standard CTM: randomized conformal p p p -values against the growing pool, with the same ONS settings.
Oracle: cash up to t 0 t_0 t 0 , then the constant bet that maximizes the wealth over the rounds t 0 + 1 , … , T t_0 + 1,\ldots,T t 0 + 1 , … , T . It knows t 0 t_0 t 0 and the future.
The two CTMs get a warm-up of min { 100 , t 0 } \min\{100,t_0\} min { 100 , t 0 } rounds, in which ONS runs but no bet is placed. This is the warm-up of 100 rounds that Shaer et al. [ [36 ] use for their delayed change point and the absence of warm-up in their other two experiments, and it never uses shifted data.
Metrics. For each configuration, we report the following quantities.
The power given no false alarm, P { τ ≤ T ∣ τ > t 0 } \mathbb{P}\{\tau\le T \mid\tau> t_0\} P { τ ≤ T ∣ τ > t 0 } , whose complement Theorem D.3 bounds.
The median delay of τ − t 0 \tau- t_0 τ − t 0 over the trials without a false alarm, counting a missed detection as ∞ \infty ∞ .
The mean delay E [ min { τ − t 0 , T − t 0 + 1 } ∣ τ > t 0 ] \mathbb{E}[\min\{\tau- t_0, T - t_0 + 1\} \mid\tau> t_0] E [ min { τ − t 0 , T − t 0 + 1 } ∣ τ > t 0 ] , which counts a missed detection as T − t 0 + 1 T - t_0 + 1 T − t 0 + 1 . No synthetic trial misses, so this is the plain mean.
Computation. The restarting portfolio processes each null prefix once and copies its exact state for the three magnitudes (or rates). At t 0 ∈ { 0 , 200 , 600 , 4000 } t_0 \in\{0, 200, 600, 4000\} t 0 ∈ { 0 , 200 , 600 , 4000 } , every method runs to T T T and its whole wealth path is kept; at the other shift times, the restarting portfolio stops once both of its wealths have crossed 1 / α 1/\alpha 1/ α . The full run takes about 3.5 hours on nine cores of an Apple M1 Max.
Sharp Change Point. Table 2 summarizes the median delays of all synthetic settings, and Figure 8 and Figure 9 and Table 3 –Table 5 give the results for the sharp change. The delays of the CTMs grow steadily with the length of the null phase: least-squares fits through t 0 ≥ 200 t_0 \ge200 t 0 ≥ 200 yield slopes of 43, 30, and 25 rounds per 1000 null rounds for the CCTM at d = 1 d = 1 d = 1 , 1.5, and 2, respectively. The delay of the restarting portfolio grows like ln t 0 \ln t_0 ln t 0 : regressed on ln t 0 \ln t_0 ln t 0 for t 0 ≥ 200 t_0 \ge200 t 0 ≥ 200 , it gains 3.8, 2.7, and 2.3 additional rounds whenever t 0 t_0 t 0 increases by a factor of e e e . It has the shortest median delay among the implementable methods at every t 0 ≥ 200 t_0 \ge200 t 0 ≥ 200 and every magnitude, and at t 0 = 4000 t_0 = 4000 t 0 = 4000 it is 4.0 to 4.2 times faster than the CCTM. At t 0 = 0 t_0 = 0 t 0 = 0 , it is 1.5 rounds ahead of the CCTM for d = 1 d = 1 d = 1 and one round behind for d = 1.5 d = 1.5 d = 1.5 and d = 2 d = 2 d = 2 . The wealth paths in Figure 10 show why the CTMs slow down. At the shift, the median log-wealth of every method is close to zero, between − 1 -1 − 1 and 0; the difference arises after the shift, when the ONS iterate needs many rounds to move away from zero (Section § 3 ), and the standard CTM additionally absorbs post-shift scores into its pool. At the end of the stream, in M T M_T M T of the restarting portfolio is within 16 nats of the oracle’s, while that of the CCTM is between 87 and 989 nats lower than that of the restarting portfolio. Before the shift, the restarting portfolio raises a false alarm in 0.2% of the runs and the standard CTM, despite its warm-up, in 0.9%.
Table 2. Median detection delay τ − t 0 \tau- t_0 τ − t 0 in the synthetic experiments, over the trials without a false alarm; Ours is the restarting universal portfolio. Bold: the fastest method for each configuration and shift time excluding oracle (not implementable). Note that the oracle’s delay depends very weakly on t 0 t_0 t 0 (here we only show it for t 0 = 4000 t_0 = 4000 t 0 = 4000 ). Table 3 –Table 8 give further statistics.
Figure 8. Synthetic experiments: median delay τ − t 0 \tau- t_0 τ − t 0 against the shift time, over the trials without a false alarm, for every sharp change (top) and every drift (bottom), on logarithmic vertical axes.
Table 3. Sharp change point, d = 1 d = 1 d = 1 . X t ∼ N ( 1 , 1 ) X_t \sim\mathcal{N}(1,1) X t ∼ N ( 1 , 1 ) after t 0 t_0 t 0 . Reference set n = 1000 n = 1000 n = 1000 , stream length T = 4500 T = 4500 T = 4500 , 100 trials; details in Appendix § 13 .§ 1 . False al. : fraction rejecting at or before t 0 t_0 t 0 ; power : fraction of the trials without a false alarm that reject by T T T , P ( τ ≤ T ∣ τ > t 0 ) \mathbb{P}(\tau\le T \mid\tau> t_0) P ( τ ≤ T ∣ τ > t 0 ) . Delays are over the trials without a false alarm; the median counts misses as ∞ \infty ∞ , the mean counts them as T − t 0 + 1 T - t_0 + 1 T − t 0 + 1 . The restarting portfolio rejects on its test martingale M t M_t M t ; W e a l t h T \mathrm{Wealth}_T Wealth T is its portfolio wealth, and W e a l t h T = M T \mathrm{Wealth}_T = M_T Wealth T = M T for the others. Bold: best implementable strategy in the block.
Figure 9. Synthetic experiments: power given no false alarm , P { τ ≤ t ∣ τ > t 0 } P\{\tau\le t \mid\tau> t_0\} P { τ ≤ t ∣ τ > t 0 } , against the number of rounds after the shift, for every configuration (rows) and t 0 ∈ { 0 , 600 , 4000 } t_0 \in\{0, 600, 4000\} t 0 ∈ { 0 , 600 , 4000 } (columns).
Figure 10. Synthetic experiments: median log-wealth after the shift, for the sharp change with d = 1 d = 1 d = 1 (top) and the drift with λ = 1.5 \lambda= 1.5 λ = 1.5 (bottom), and t 0 ∈ { 200 , 600 , 4000 } t_0 \in\{200, 600, 4000\} t 0 ∈ { 200 , 600 , 4000 } (columns). For the restarting portfolio, the wealth is its test martingale M t M_t M t . The dashed line is the rejection threshold ln ( 1 / α ) \ln(1/\alpha) ln ( 1/ α ) , and the vertical axes are linear between − 1 -1 − 1 and 1 1 1 and logarithmic outside.
Table 5. Sharp change point , d = 2 d = 2 d = 2 . X t ∼ N ( 2 , 1 ) X_t \sim\mathcal{N}(2, 1) X t ∼ N ( 2 , 1 ) after t 0 t_0 t 0 . Reference set n = 1000 n = 1000 n = 1000 , stream length T = 4500 T = 4500 T = 4500 , 100 trials; details in Appendix § 13 .§ 1 . False al. : fraction rejecting at or before t 0 t_0 t 0 ; power : fraction of the trials without a false alarm that reject by T T T , P ( τ ≤ T ∣ τ > t 0 ) \mathbb{P}(\tau\le T \mid\tau> t_0) P ( τ ≤ T ∣ τ > t 0 ) . Delays are over the trials without a false alarm; the median counts misses as ∞ \infty ∞ , the mean counts them as T − t 0 + 1 T - t_0 + 1 T − t 0 + 1 . The restarting portfolio rejects on its test martingale M t M_t M t ; W e a l t h T \mathrm{Wealth}_T Wealth T is its portfolio wealth, and W e a l t h T = M T \mathrm{Wealth}_T = M_T Wealth T = M T for the others. Bold: best implementable strategy in the block.
Gradual Drift. Figure 8 , Figure 9 , and Figure 10 and Table 6 –Table 8 give the results. The drift is harder for every method, because the evidence arrives slowly at first, but the picture is the same. The CCTM’s median delay grows by 21 to 25 rounds per 1000 null rounds, and the restarting portfolio’s by 2.2 to 3.2 additional rounds whenever t 0 t_0 t 0 increases by a factor of e e e . The restarting portfolio is the fastest implementable method at every t 0 ≥ 400 t_0 \ge400 t 0 ≥ 400 , and at t 0 = 4000 t_0 = 4000 t 0 = 4000 it is 2.0, 2.4, and 2.7 times faster than the CCTM for λ = 1.5 \lambda= 1.5 λ = 1.5 , 3, and 5; at t 0 ∈ { 0 , 200 } t_0 \in\{0, 200\} t 0 ∈ { 0 , 200 } , it is within two rounds of the CCTM. Here, the oracle is not uniformly faster. The best constant bet over the whole post-shift window is large, because the drift eventually pushes every p ^ t \hat{p}_t p ^ t to one, and this bet is too aggressive while the drift is still small. The universal portfolio instead averages over all portfolios and increases its exposure as the evidence grows. The final wealth of the standard CTM is capped at 10 250 10^{250} 1 0 250 by the reference implementation, which explains its constant value of ln M T = 575.6 \ln M_T = 575.6 ln M T = 575.6 in the tables.
Table 6. Gradual drift, λ = 1.5 \lambda= 1.5 λ = 1.5 . X t ∼ N ( 1.5 ( t − t 0 ) / 100 , 1 ) X_t \sim\mathcal{N}(1.5(t-t_0)/100,1) X t ∼ N ( 1.5 ( t − t 0 ) /100 , 1 ) after t 0 t_0 t 0 . Reference set n = 2000 n = 2000 n = 2000 , stream length T = 4500 T = 4500 T = 4500 , 100 trials; details in Appendix § 13 .§ 1 . False al. : fraction rejecting at or before t 0 t_0 t 0 ; power : fraction of the trials without a false alarm that reject by T T T , P ( τ ≤ T ∣ τ > t 0 ) \mathbb{P}(\tau\le T \mid\tau> t_0) P ( τ ≤ T ∣ τ > t 0 ) . Delays are over the trials without a false alarm; the median counts misses as ∞ \infty ∞ , the mean counts them as T − t 0 + 1 T-t_0+1 T − t 0 + 1 . The restarting portfolio rejects on its test martingale M t M_t M t ; W e a l t h T \mathrm{Wealth}_T Wealth T is its portfolio wealth, and W e a l t h T = M T \mathrm{Wealth}_T = M_T Wealth T = M T for the others. Bold: best implementable strategy in the block.
Table 8. Gradual drift , λ = 5 \lambda= 5 λ = 5 . X t ∼ N ( 5 ( t − t 0 ) / 100 , 1 ) X_t \sim\mathcal{N}(5(t-t_0)/100,1) X t ∼ N ( 5 ( t − t 0 ) /100 , 1 ) after t 0 t_0 t 0 . Reference set n = 2000 n = 2000 n = 2000 , stream length T = 4500 T = 4500 T = 4500 , 100 trials; details in Appendix § 13 .§ 1 . False al. : fraction rejecting at or before t 0 t_0 t 0 ; power : fraction of the trials without a false alarm that reject by T T T , P ( τ ≤ T ∣ τ > t 0 ) \mathbb{P}(\tau\le T \mid\tau> t_0) P ( τ ≤ T ∣ τ > t 0 ) . Delays are over the trials without a false alarm; the median counts misses as ∞ \infty ∞ , the mean counts them as T − t 0 + 1 T-t_0+1 T − t 0 + 1 . The restarting portfolio rejects on its test martingale M t M_t M t ; W e a l t h T \mathrm{Wealth}_T Wealth T is its portfolio wealth, and W e a l t h T = M T \mathrm{Wealth}_T = M_T Wealth T = M T for the others. Bold : best implementable strategy in the block.
Null Streams. We run 100 null streams of length 4500 for each of n = 1000 n = 1000 n = 1000 and n = 2000 n = 2000 n = 2000 , without any warm-up, as in the type-I experiment of Shaer et al. [ [36 ] . Neither the restarting portfolio nor the CCTM ever reaches 1 / α 1/\alpha 1/ α , and the standard CTM does so on 2% of the streams (Table 9 and Figure 11 ). After 4500 null rounds, the median log-wealth of the restarting portfolio is − 0.9 -0.9 − 0.9 at n = 1000 n = 1000 n = 1000 and − 1.0 -1.0 − 1.0 at n = 2000 n = 2000 n = 2000 , which reflects the logarithmic cost of betting from the first round; the CCTM, which also bets from the first round here, ends lower, at − 2.6 -2.6 − 2.6 and − 2.8 -2.8 − 2.8 .
Figure 11. Synthetic null streams: fraction of the 100 streams whose wealth (M t M_t M t for the restarting portfolio) has reached 1 / α 1/\alpha 1/ α by round t t t , for (a) n = 1000 n = 1000 n = 1000 and (b) n = 2000 n = 2000 n = 2000 . The CCTM never rejects, and its line is hidden under that of the restarting portfolio.
Table 9. Type-I error. Fraction of 100 null streams (X t ∼ N ( 0 , 1 ) X_t \sim\mathcal{N}(0,1) X t ∼ N ( 0 , 1 ) throughout, T = 4500 T = 4500 T = 4500 ) whose wealth ever reaches 1 / α = 20 1/\alpha= 20 1/ α = 20 (M t M_t M t for the restarting portfolio, the martingale itself for the CTMs), and the median final log-wealth, for the reference sizes of the sharp change point (n = 1000 n = 1000 n = 1000 ) and the drift (n = 2000 n = 2000 n = 2000 ).
Type-I Error Against The Reference Size. Following Figure 2 (left) of Shaer et al. [ [36 ] , we vary the reference size over n ∈ { 10 , 500 , 1000 , … , 5000 } n \in\{10, 500, 1000, \ldots, 5000\} n ∈ { 10 , 500 , 1000 , … , 5000 } and run 100 null streams of T = 4500 T = 4500 T = 4500 rounds for each n n n , drawn as in their code. They use T = 20,000 T = 20{,}000 T = 20 , 000 rounds and n = 10 n = 10 n = 10 in place of n = 0 n = 0 n = 0 ; we keep the horizon of the other synthetic experiments, since 1100 exact runs of 20,000 rounds would take more than a day on our machine (Appendix § 12 .7). The CTM settings are those above, without warm-up. Figure 7 shows that both conditional tests reject on at most 1% of the streams for every n n n , far below α = 0.05 \alpha= 0.05 α = 0.05 , including n = 10 n = 10 n = 10 , where the band has width ϵ ≈ 0.39 \epsilon\approx0.39 ϵ ≈ 0.39 . Over all 1100 streams, the restarting portfolio rejects twice, with both M t M_t M t and W e a l t h t \mathrm{Wealth}_t Wealth t , and the CCTM three times.
Figure 7. Type-I error against the reference size n n n : fraction of 100 null streams of T = 4500 T = 4500 T = 4500 rounds on which the test martingale (M t M_t M t for the restarting portfolio) reaches 1 / α 1/\alpha 1/ α . The two lines coincide except at n = 2500 n = 2500 n = 2500 .
Test Martingale Versus Portfolio Wealth. Rejecting on the portfolio wealth W e a l t h t \mathrm{Wealth}_t Wealth t instead of M t M_t M t delays detection by a median of 3 rounds in both scenarios, with a mean of 6 rounds for the sharp change and 8 rounds for the drift. The difference never has the other sign, since M t ≥ W e a l t h t M_t \ge\mathrm{Wealth}_t M t ≥ Wealth t (Proposition 2.4 ).
Table 4. Sharp change point , d = 1.5 d = 1.5 d = 1.5 . X t ∼ N ( 1.5 , 1 ) X_t \sim\mathcal{N}(1.5, 1) X t ∼ N ( 1.5 , 1 ) after t 0 t_0 t 0 . Reference set n = 1000 n = 1000 n = 1000 , stream length T = 4500 T = 4500 T = 4500 , 100 trials; details in Appendix § 13 .§ 1 . False al. : fraction rejecting at or before t 0 t_0 t 0 ; power : fraction of the trials without a false alarm that reject by T T T , P ( τ ≤ T ∣ τ > t 0 ) \mathbb{P}(\tau\le T \mid\tau> t_0) P ( τ ≤ T ∣ τ > t 0 ) . Delays are over the trials without a false alarm; the median counts misses as ∞ \infty ∞ , the mean counts them as T − t 0 + 1 T - t_0 + 1 T − t 0 + 1 . The restarting portfolio rejects on its test martingale M t M_t M t ; W e a l t h T \mathrm{Wealth}_T Wealth T is its portfolio wealth, and W e a l t h T = M T \mathrm{Wealth}_T = M_T Wealth T = M T for the others. Bold: best implementable strategy in the block.
Table 7. Gradual drift, λ = 3 \lambda= 3 λ = 3 . X t ∼ N ( 3 ( t − t 0 ) / 100 , 1 ) X_t \sim\mathcal{N}(3(t-t_0)/100,1) X t ∼ N ( 3 ( t − t 0 ) /100 , 1 ) after t 0 t_0 t 0 . Reference set n = 2000 n = 2000 n = 2000 , stream length T = 4500 T = 4500 T = 4500 , 100 trials; details in Appendix § 13 .§ 1 . False al. : fraction rejecting at or before t 0 t_0 t 0 ; power : fraction of the trials without a false alarm that reject by T T T , P ( τ ≤ T ∣ τ > t 0 ) \mathbb{P}(\tau\le T \mid\tau> t_0) P ( τ ≤ T ∣ τ > t 0 ) . Delays are over the trials without a false alarm; the median counts misses as ∞ \infty ∞ , the mean counts them as T − t 0 + 1 T-t_0+1 T − t 0 + 1 . The restarting portfolio rejects on its test martingale M t M_t M t ; W e a l t h T \mathrm{Wealth}_T Wealth T is its portfolio wealth, and W e a l t h T = M T \mathrm{Wealth}_T = M_T Wealth T = M T for the others. Bold: best implementable strategy in the block.
ImageNet-C
Data. We repeat the ImageNet-C experiment of Shaer et al. [ [36 ] with a clean phase of length t 0 t_0 t 0 inserted before the corrupted stream, so that their experiment is the slice t 0 = 0 t_0 = 0 t 0 = 0 . The scores are the predictive entropies of the ViT-B/16 classifier [8 ] of the timm library [51 ] (weights augreg2) on the ImageNet validation images [7 ] . The 50,000 images are split into a clean holdout of 12,500 images and 37,500 images whose severity-5 ImageNet-C versions [13 ] form the shifted stream, for each of the 15 corruptions. As in the authors’ code, the seed shuffles the holdout and the corrupted images. The reference dataset is the first n n n images of the holdout, and the clean phase consists of the next t 0 t_0 t 0 images, which are never in the reference dataset.
Grid And Hyperparameters. We keep the grid of Shaer et al. [ [36 ] , n ∈ { 100 , 250 , 500 , 1000 , 4000 } n \in\{100, 250, 500, 1000, 4000\} n ∈ { 100 , 250 , 500 , 1000 , 4000 } , the seeds 0 , … , 9 0, \ldots, 9 0 , … , 9 , and all 15 corruptions, and we vary t 0 ∈ { 0 , 125 , 250 , 500 , 1000 , 2000 , 4000 , 8000 } t_0 \in\{0, 125, 250, 500, 1000, 2000, 4000, 8000\} t 0 ∈ { 0 , 125 , 250 , 500 , 1000 , 2000 , 4000 , 8000 } , a geometric grid on which a dependence of order ln t 0 \ln t_0 ln t 0 appears as a straight line. The CTMs keep the ImageNet hyperparameters of Shaer et al. [ [36 ] : α = 0.05 \alpha= 0.05 α = 0.05 , band level δ = α \delta= \alpha δ = α , bets in [ − 1 / 2 , 1 / 2 ] [-1/2, 1/2] [ − 1/2 , 1/2 ] , C = 0.05 C = 0.05 C = 0.05 , k = 10 − 6 k = 10^{-6} k = 1 0 − 6 , and a warm-up of 50 rounds; the released code skips the first 51 observations for the CCTM and 50 for the standard CTM. The restarting portfolio uses the same band and no warm-up. The oracle holds cash until t 0 t_0 t 0 and then makes the best constant bet in hindsight. Every method runs for H = 2000 H = 2000 H = 2000 rounds after the shift, because the direct method costs O ( ( t 0 + H ) 3 ) O((t_0 + H)^3) O (( t 0 + H ) 3 ) ; at t 0 = 0 t_0 = 0 t 0 = 0 , almost all runs detect the shift well within H H H . The restarting portfolio processes the clean phase once for each ( n , s e e d , t 0 ) (n, \mathrm{seed}, t_0) ( n , seed , t 0 ) and copies its state for the 15 corruptions, and the whole grid takes about 40 minutes on seven cores.
Delay. The delay is τ − t 0 \tau- t_0 τ − t 0 for every method, and the warm-up of a CTM is not subtracted. For t 0 ≥ 125 t_0 \ge125 t 0 ≥ 125 , the warm-up lies in the clean phase and costs nothing. At t 0 = 0 t_0 = 0 t 0 = 0 , it falls on shifted data, so the CTMs discard the first 51 or 50 corrupted images, and those rounds count towards their delay; Shaer et al. [ [36 ] instead measure time from the end of the warm-up. Medians count missed detections, i.e., no rejection within H H H rounds, as ∞ \infty ∞ , and they are taken over the runs without a false alarm. Means count a missed detection as H + 1 H + 1 H + 1 instead of dropping it, and like the medians, they are taken over the runs of each method without a false alarm; where some runs miss, the mean is a lower bound.
Results. Figure 12 and Figure 13 show the delay against t 0 t_0 t 0 and the power for each n n n , pooled over corruptions and seeds, and Table 11 –Table 15 break the delay down by corruption group; Table 10 summarizes them for n = 1000 n = 1000 n = 1000 .
Table 11. ImageNet-C, n = 100 n = 100 n = 100 . 15 severity-5 corruptions × \times × 10 seeds after t 0 t_0 t 0 clean images; every method runs H = 2000 H = 2000 H = 2000 rounds past the change. False al. : rejection at or before t 0 t_0 t 0 ; power : P ( τ ≤ t 0 + H ∣ τ > t 0 ) \mathbb{P}\left(\tau\le t_0 + H \mid\tau> t_0\right) P ( τ ≤ t 0 + H ∣ τ > t 0 ) . Delays τ − t 0 \tau- t_0 τ − t 0 (warm-up rounds included), medians over the trials without a false alarm, misses counted as ∞ \infty ∞ ; the mean counts misses as H + 1 H + 1 H + 1 (†: some runs missed, so the mean is a lower bound). The restarting portfolio rejects on M t M_t M t . Groups as in Shaer et al. [ [36 ] , Figure 4 . Bold: best implementable strategy.
Figure 12. ImageNet-C: median delay τ − t 0 \tau-t_0 τ − t 0 against the length t 0 t_0 t 0 of the clean phase , for every reference size n n n , over 15 corruptions and 10 seeds. Runs that miss the shift within 2000 rounds count as infinite delays. The vertical axes are logarithmic, and the horizontal axes are logarithmic beyond t 0 = 0 t_0 = 0 t 0 = 0 .
Figure 13. ImageNet-C: power given no false alarm, P { τ ≤ t ∣ τ > t 0 } P\{\tau\leq t \mid\tau> t_0\} P { τ ≤ t ∣ τ > t 0 } , against the number of rounds after the shift, for every reference size n n n (rows) and t 0 ∈ { 0 , 1000 , 8000 } t_0 \in\{0, 1000, 8000\} t 0 ∈ { 0 , 1000 , 8000 } (columns), over 15 corruptions and 10 seeds.
Table 15. ImageNet-C , n = 4000 n = 4000 n = 4000 . 15 severity-5 corruptions × \times × 10 seeds after t 0 t_0 t 0 clean images; every method runs H = 2000 H = 2000 H = 2000 rounds past the change. False al.: rejection at or before t 0 t_0 t 0 ; power: P ( τ ≤ t 0 + H ∣ τ > t 0 ) \mathbb{P}(\tau\le t_0 + H \mid\tau> t_0) P ( τ ≤ t 0 + H ∣ τ > t 0 ) . Delays τ − t 0 \tau- t_0 τ − t 0 (warm-up rounds included), medians over the trials without a false alarm, misses counted as ∞ \infty ∞ ; the mean counts misses as H + 1 H + 1 H + 1 . The restarting portfolio rejects on M t M_t M t . Groups as in Shaer et al. [ [36 ] , Figure 4 . Bold: best implementable strategy.
At t 0 = 0 t_0 = 0 t 0 = 0 , the restarting portfolio is the fastest method for every n n n , with 16 to 30 rounds against 65 to 83 for the CCTM and 74 to 93 for the standard CTM. Most of this gap is the warm-up of the CTMs; counted from the end of the warm-up, the restarting portfolio and the CCTM are within two rounds of each other.
The delay of the restarting portfolio grows like ln t 0 \ln t_0 ln t 0 . From t 0 = 125 t_0 = 125 t 0 = 125 to t 0 = 8000 t_0 = 8000 t 0 = 8000 , its median delay rises from 33 to 50.5 rounds at n = 1000 n = 1000 n = 1000 , and regressed on ln t 0 \ln t_0 ln t 0 it gains 3.6 (at n = 4000 n = 4000 n = 4000 ) to 10 (at n = 100 n = 100 n = 100 ) additional rounds whenever t 0 t_0 t 0 increases by a factor of e e e . The slope is larger for small n n n , because a wider band makes each nat of restart cost take more rounds to earn.
The delays of both CTMs grow roughly linearly with t 0 t_0 t 0 , by 24 to 41 rounds per 1000 clean rounds. At t 0 = 8000 t_0 = 8000 t 0 = 8000 , the CCTM needs 3.4 (n = 100 n = 100 n = 100 ) to 5.3 (n = 4000 n = 4000 n = 4000 ) times as many rounds as the restarting portfolio.
The CTMs are ahead only for short clean phases. At t 0 = 125 t_0 = 125 t 0 = 125 , one of them is faster for every n n n , e.g., the CCTM with 28 against 33 rounds at n = 1000 n = 1000 n = 1000 . For n ≥ 250 n \ge250 n ≥ 250 , the restarting portfolio has the shortest median delay from t 0 = 250 t_0 = 250 t 0 = 250 on. For n = 100 n = 100 n = 100 , the standard CTM stays ahead up to t 0 = 1000 t_0 = 1000 t 0 = 1000 , because its growing pool of clean scores sharpens its p p p -values, and the restarting portfolio leads from t 0 = 2000 t_0 = 2000 t 0 = 2000 on. Among the corruption groups, the Digital corruptions are the hardest. For brightness at n ≤ 250 n \le250 n ≤ 250 , both conditional tests often miss the shift within H H H , because the band width ϵ ≈ 0.14 \epsilon\approx0.14 ϵ ≈ 0.14 at n = 100 n = 100 n = 100 exceeds the signal; the standard CTM pays no band and detects it once its pool has grown. Figure 3 in § 5 summarizes the comparison of the two conditional tests as the ratio of their delays. At t 0 = 0 t_0 = 0 t 0 = 0 , the ratio is 3.1 to 5.3 for Noise, Blur, and Weather and 1.2 to 3.3 for Digital, dominated by the warm-up of the CCTM; at t 0 = 1000 t_0 = 1000 t 0 = 1000 , where the warm-up is free, it is 1.4 to 2.2 (1.0 to 1.9 for Digital); and at t 0 = 8000 t_0 = 8000 t 0 = 8000 , it grows to 3.3 to 5.7 (1.4 to 4.2 for Digital). For n = 4000 n = 4000 n = 4000 , the standard CTM raises a false alarm at round 392 of the clean phase for one of the 10 seeds, and since the 15 corruptions share the clean phase of a seed, this counts as a false-alarm rate of 0.10 at every t 0 ≥ 500 t_0 \ge500 t 0 ≥ 500 , including t 0 ∈ { 1000 , 8000 } t_0 \in\{1000, 8000\} t 0 ∈ { 1000 , 8000 } in Table 15 .
Null Check. As in the reproduction, the null stream is the rest of the clean holdout, i.e., 12,500 − n 12{,}500-n 12 , 500 − n images, with 100 seeds for each n ∈ { 100 , 500 , 4000 } n \in\{100, 500, 4000\} n ∈ { 100 , 500 , 4000 } (Table 16 ). The test martingale of the restarting portfolio reaches 1 / α 1/\alpha 1/ α on one of the 300 streams (at n = 4000 n = 4000 n = 4000 ), and its portfolio wealth on none. The CCTM never rejects, and the standard CTM rejects on 1% to 3% of the streams. All rates are below α \alpha α . After 8500 to 12,400 clean rounds, the median log-wealth of the restarting portfolio is between − 1.1 -1.1 − 1.1 and − 0.6 -0.6 − 0.6 .
Table 16. ImageNet null check. The stream is the rest of the clean holdout (T = 12400 T = 12400 T = 12400 for n = 100 n = 100 n = 100 , T = 12000 T = 12000 T = 12000 for n = 500 n = 500 n = 500 , T = 8500 T = 8500 T = 8500 for n = 4000 n = 4000 n = 4000 ), 100 seeds per n n n : fraction of streams whose wealth ever reaches 1 / α 1/\alpha 1/ α (M t M_t M t for the restarting portfolio, the martingale itself for the CTMs), and the median final log-wealth.
Table 12. ImageNet-C , n = 250 n = 250 n = 250 . 15 severity-5 corruptions × \times × 10 seeds after t 0 t_0 t 0 clean images; every method runs H = 2000 H = 2000 H = 2000 rounds past the change. False al.: rejection at or before t 0 t_0 t 0 ; power: P ( τ ≤ t 0 + H ∣ τ > t 0 ) \mathbb{P}(\tau\le t_0 + H \mid\tau> t_0) P ( τ ≤ t 0 + H ∣ τ > t 0 ) . Delays τ − t 0 \tau- t_0 τ − t 0 (warm-up rounds included), medians over the trials without a false alarm, misses counted as ∞ \infty ∞ ; the mean counts misses as H + 1 H + 1 H + 1 († : some runs missed, so the mean is a lower bound). The restarting portfolio rejects on M t M_t M t . Groups as in Shaer et al. [ [36 ] , Figure 4. Bold: best implementable strategy.
Table 13. ImageNet-C, n = 500 n = 500 n = 500 . 15 severity-5 corruptions × \times × 10 seeds after t 0 t_0 t 0 clean images; every method runs H = 2000 H = 2000 H = 2000 rounds past the change. False al. : rejection at or before t 0 t_0 t 0 ; power : P ( τ ≤ t 0 + H ∣ τ > t 0 ) \mathbb{P}(\tau\le t_0 + H \mid\tau> t_0) P ( τ ≤ t 0 + H ∣ τ > t 0 ) . Delays τ − t 0 \tau- t_0 τ − t 0 (warm-up rounds included), medians over the trials without a false alarm, misses counted as ∞ \infty ∞ ; the mean counts misses as H + 1 H + 1 H + 1 . The restarting portfolio rejects on M t M_t M t . Groups as in Shaer et al. [ [36 ] , Figure 4 . Bold : best implementable strategy.