SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
f _ {t} ^ {\mathrm {m}} \left(X _ {t}, Y _ {t}\right) = \frac {1}{2} \left(\operatorname {s i g n} \left[ g _ {t} \left(Y _ {t}\right) \right] - \operatorname {s i g n} \left[ g _ {t} \left(X _ {t}\right) \right]\right), \tag {41a}
$$
$$
f _ {t} ^ {\mathrm {s}} \left(X _ {t}, Y _ {t}\right) = \frac {1}{2} \left(g _ {t} \left(Y _ {t}\right) - g _ {t} \left(X _ {t}\right)\right). \tag {41b}
$$
After  $(X_{t},Y_{t})$  has been used for betting, we update a training dataset and an existing predictor:
$$
\mathcal {D} _ {t} = \mathcal {D} _ {t - 1} \cup \left\{\left(Y _ {t}, + 1\right), \left(X _ {t}, - 1\right) \right\}, \quad g _ {t + 1} = \mathcal {A} _ {\mathrm {c}} ^ {2 \mathrm {S T}} \left(\mathcal {D} _ {t}, g _ {t}\right).
$$
Testing under Distribution Drift. Batch two-sample and independence tests generally rely on either a cutoff computed using the asymptotic null distribution of a chosen test statistic (if tractable) or a permutation p-value. Both approaches require imposing i.i.d. (or exchangeability, for the latter option) assumption about the data distribution, and if the distribution drifts, both approaches fail to guarantee the type I error control. In contrast, Seq-C-2ST and Seq-C-IT remain valid beyond the i.i.d. setting by construction (analogous to tests developed in [Shekhar and Ramdas, 2023, Podkopaev et al., 2023]). First, we define the problems of sequential two-sample and independence testing under distribution drift.
Definition 6 (Sequential two-sample testing under distribution drift). Suppose that we observe that a stream of independent observations:  $\left((X_{t},Y_{t})\right)_{t\geq 1}$ , where  $(X_{t},Y_{t})\sim P_{X}^{(t)}\times P_{Y}^{(t)}, t\geq 1$ . The goal is to design a sequential test for the following pair of hypotheses:
$$
H _ {0}: P _ {X} ^ {(t)} = P _ {Y} ^ {(t)}, \forall t, \tag {42a}
$$
$$
H _ {1}: \exists t ^ {\prime}: P _ {X} ^ {(t ^ {\prime})} \neq P _ {Y} ^ {(t ^ {\prime})}. \tag {42b}
$$
Definition 7 (Sequential independence testing under distribution drift). Suppose that we observe that a stream of independent observations from the joint distribution which drifts over time:  $((X_{t},Y_{t}))_{t\geq 1}$  where  $(X_{t},Y_{t})\sim P_{XY}^{(t)}$ . The goal is to design a sequential test for the following pair of hypotheses:
$$
H _ {0}: P _ {X Y} ^ {(t)} = P _ {X} ^ {(t)} \times P _ {Y} ^ {(t)}, \forall t, \tag {43a}
$$
$$
H _ {1}: \exists t ^ {\prime}: P _ {X Y} ^ {(t ^ {\prime})} \neq P _ {X} ^ {(t ^ {\prime})} \times P _ {Y} ^ {(t ^ {\prime})}. \tag {43b}
$$
The superscripts highlight that, in contrast to the standard i.i.d. setting (Definitions 5 and 2), the underlying distributions may drift over time. For independence testing, we need to impose an additional assumption that enables reasoning about the type I error control of Seq-C-IT.
Assumption 5. Consider the setting of independence testing under distribution drift (Definition 7). We assume that for each  $t \geq 1$ , it holds that either  $P_X^{(t-1)} = P_X^{(t)}$  or  $P_Y^{(t-1)} = P_Y^{(t)}$ , meaning that at each step either the distribution of  $X$  changes or that of  $Y$  changes, but not both simultaneously<sup>5</sup>.
We have the following result about the type I error control of our tests under distribution drift.
Corollary 2. The following claims hold:
1. Suppose that  $H_0$  in (42a) is true. Then Seq-C-2ST satisfies:  $\mathbb{P}_{H_0}(\tau < \infty) \leq \alpha$ .
2. Suppose that  $H_0$  in (43a) is true. Further, suppose that Assumption 5 is satisfied. Then Seq-C-IT satisfies:  $\mathbb{P}_{H_0}(\tau < \infty) \leq \alpha$ .
The above result follows from the fact the payoff functions underlying Seq-C-2ST (41) and Seq-C-IT (23) are valid under the more general null hypotheses (42a) and (43a) respectively. The rest of the proof of Corollary 2 follows the same steps as that of Theorem 2, and we omit the details. We conclude with an example which shows that Assumption 5 is necessary for the type I error control.
Example 2. Consider the following case when the null  $H_0$  in (43a) is true, but Assumption 5 is not satisfied. We show that Seq-C-IT fails to control type I error (at any prespecified level  $\alpha \in (0,1)$ ), and for simplicity, focus on the payoff function based on the squared risk (23). Suppose that we observe a sequence of observations:  $((X_t,Y_t))_{t\geq 1}$ , where  $(X_{t},Y_{t}) = (t + W_{t},t + V_{t})$  and  $W_{t},V_{t}\stackrel {\mathrm{iid}}{\sim}\mathrm{Bern}(1 / 2)$ . It suffices to show that there exists a sequence of predictors  $(g_{t})_{t\geq 1}$ , for which
$$
\lim  _ {t \rightarrow \infty} \inf  _ {t} \frac {1}{t} \sum_ {i = 1} ^ {t} f _ {t} ^ {\mathrm {s}} \left(\left(X _ {2 t - 1}, Y _ {2 t - 1}\right), \left(X _ {2 t}, Y _ {2 t}\right)\right) ^ {\text {a . s .}} > 0. \tag {44}
$$
If (44) holds, then using the same argument as in the proof of Theorem 2, one can then deduce that  $\mathbb{P}(\tau < \infty) = 1$ . Consider the following sequence of predictors  $(g_t)_{t \geq 1}$ :
$$
g _ {t} (x, y) = \left(\left(x - \left(2 t - \frac {1}{2}\right)\right) \left(y - \left(2 t - \frac {1}{2}\right)\right) \wedge 1\right) \vee - 1.
$$
$$
g _ {t} \left(X _ {2 t}, Y _ {2 t}\right) = \left(\left(W _ {2 t} + \frac {1}{2}\right) \left(V _ {2 t} + \frac {1}{2}\right) \wedge 1\right) \vee - 1,
$$
$$
g _ {t} \left(X _ {2 t - 1}, Y _ {2 t - 1}\right) = \left(W _ {2 t - 1} - \frac {1}{2}\right) \left(V _ {2 t - 1} - \frac {1}{2}\right),
$$
$$
g _ {t} \left(X _ {2 t}, Y _ {2 t - 1}\right) = \left(W _ {2 t} + \frac {1}{2}\right) \left(V _ {2 t - 1} - \frac {1}{2}\right),
$$
$$
g _ {t} \left(X _ {2 t - 1}, Y _ {2 t}\right) = \left(W _ {2 t - 1} - \frac {1}{2}\right) \left(V _ {2 t} + \frac {1}{2}\right).
$$
Simple calculation shows that:
$\mathbb{E}\left[g_t(X_{2t},Y_{2t})\right] = 11 / 16,\quad \mathbb{E}\left[g_t(X_{2t - 1},Y_{2t - 1})\right] = \mathbb{E}\left[g_t(X_{2t},Y_{2t - 1})\right] = \mathbb{E}\left[g_t(X_{2t - 1},Y_{2t})\right] = 0$  and hence, for all  $t\geq 1$ , it holds that  $\mathbb{E}\left[f_t^{\mathrm{s}}((X_{2t - 1},Y_{2t - 1}),(X_{2t},Y_{2t}))\right] = 11 / 64 > 0$ . This in turn implies (44), and hence, we conclude that Seq-C-IT fails to control the type I error.
Technically, a slightly weaker condition suffices - at odd  $t$ , the distribution can change arbitrarily, but at even  $t$ , either the distribution of  $X$  changes or that of  $Y$  changes but not both; however, this weaker condition is slightly less intuitive than the stated condition.
C.1 Synthetic Experiments
Under the alternative, the power of our test depends on the performance of a classifier according to misclassification/squared risk. If the distribution drifts over time, then models updated via online gradient descent may retain predictive power. In such cases, our test will still have high power despite the present distribution drift. Of course, if the distribution shifts adversarially, the method will not have power, but neither will any other method. So the implicit goal is to maintain type-1 error control under the null despite shifting distributions (beyond the i.i.d. assumption typically made in the literature) while retaining power against reasonable (but not all) distribution drifts. To put this into context, we consider four settings:
1.  $P = Q = \mathcal{N}(0,1)$ , i.e., the 2ST null is true;
2.  $P = \mathcal{N}(0,1)$  and  $Q = \mathcal{N}(0.5,1)$ , i.e., the 2ST null is false;
3. Up to time  $t = 250$ ,  $P^{(t)} = Q^{(t)} = \mathcal{N}(0,1)$ , but for  $t > 251$ , we have  $P^{(t)} = \mathcal{N}(0,1)$  and  $Q^{(t)} = \mathcal{N}(0.5,1)$ , i.e., there is a distribution shift and the 2ST null is false;
4. Up to time  $t = 250$ ,  $P^{(t)} = Q^{(t)} = \mathcal{N}(0,1)$ , but for  $t > 251$ ,  $P^{(t)} = Q^{(t)} = \mathcal{N}(0.5,1)$ , i.e., there is a change in distribution yet the 2ST null is still true.
We use a standard logistic regression model as an underlying predictor with weights updated via online gradient descent and monitor the tests until  $T = 2000$  observations. In Figure 6, we observe that our test controls the type-1 error whenever the 2ST null is true even if there is a shift in distribution, and retains high power if the alternative is true.
Figure 6: Average rejection rates for four settings: solid lines correspond to the standard i.i.d. setting and dashed lines correspond to the settings that involve distribution shift. Despite there being a shift in distribution, our test that utilizes logistic regression learned via online gradient descent controls the type-1 error under a more general 2ST null hypothesis and has power under the alternative. Results are aggregated over 500 random sequences from the corresponding distributions.
D.1 Auxiliary Results
Proposition 2 (Ville's inequality [Ville, 1939]). Suppose that  $(\mathcal{M}_t)_{t\geq 0}$  is a nonnegative supermartingale process adapted to a filtration  $(\mathcal{F}_t)_{t\geq 0}$ . Then, for any  $a > 0$  it holds that:
$$
\mathbb {P} \left(\exists t \geq 1: \mathcal {M} _ {t} \geq a\right) \leq \frac {\mathbb {E} \left[ \mathcal {M} _ {0} \right]}{a}.
$$
D.2 Supporting Lemmas
Lemma 6. Consider sequential two-sample testing setting (Definition 1). Suppose that a predictor  $g \in \mathcal{G}$  satisfies  $\mathbb{E}[f(Z, W)] > 0$ , where  $f(z, w) \coloneqq wg(z)$ .
(a) Consider the wealth process  $(\mathcal{K}_t)_{t\geq 0}$  based on  $f$  along with the ONS strategy for selecting betting fractions (Algorithm 1). Then we have the following lower bound on the growth rate of the wealth process:
$$
\lim  _ {t \rightarrow \infty} \inf  _ {t} \frac {\log \mathcal {K} _ {t}}{t} \geq \frac {1}{4} \left(\frac {\left(\mathbb {E} [ f (Z , W) ]\right) ^ {2}}{\mathbb {E} [ f ^ {2} (Z , W) ]} \wedge \mathbb {E} [ f (Z, W) ]\right). \tag {45}
$$
(b) For  $\lambda_{\star} = \arg \max_{\lambda \in [-0.5,0.5]}\mathbb{E}\left[\log (1 + \lambda f(Z,W))\right]$ , it holds that:
$$
\mathbb {E} \left[ \log \left(1 + \lambda_ {\star} f (Z, W)\right) \right] \leq \frac {4}{3} \cdot \frac {\left(\mathbb {E} [ f (Z , W) ]\right) ^ {2}}{\mathbb {E} \left[ (f (Z , W)) ^ {2} \right]} \wedge \frac {\mathbb {E} [ f (Z , W) ]}{2}. \tag {46}
$$
Analogous result holds when the payoff function  $f(z, w) \coloneqq w \cdot \operatorname{sign}[g(z)]$  is used instead.
Proof. (a) Under the ONS betting strategy, for any sequence of outcomes  $(f_t)_{t \geq 1}$ ,  $f_t \in [-1, 1]$ , it holds that (see the proof of Theorem 1 in [Cutkosky and Orabona, 2018]):
$$
\log \mathcal {K} _ {t} \left(\lambda_ {0}\right) - \log \mathcal {K} _ {t} = O \left(\log \left(\sum_ {i = 1} ^ {t} f _ {i} ^ {2}\right)\right), \tag {47}
$$
where  $\mathcal{K}_t(\lambda_0)$  is the wealth of any constant betting strategy  $\lambda_0 \in [-1/2, 1/2]$  and  $\mathcal{K}_t$  is the wealth corresponding to the ONS betting strategy. Hence, it follows that
$$
\frac {\log \mathcal {K} _ {t}}{t} \geq \frac {\log \mathcal {K} _ {t} \left(\lambda_ {0}\right)}{t} - C \cdot \frac {\log t}{t}, \tag {48}
$$
for some absolute constant  $C > 0$ . Next, consider
$$
\lambda_ {0} = \frac {1}{2} \left(\left(\frac {\sum_ {i = 1} ^ {t} f _ {i}}{\sum_ {i = 1} ^ {t} f _ {i} ^ {2}} \wedge 1\right) \vee 0\right).
$$
$$
\begin{array}{l} \frac {\log \mathcal {K} _ {t} (\lambda_ {0})}{t} = \frac {1}{t} \sum_ {i = 1} ^ {t} \log (1 + \lambda_ {0} f _ {i}) \\ \geq \frac {1}{t} \sum_ {i = 1} ^ {t} \left(\lambda_ {0} f _ {i} - \lambda_ {0} ^ {2} f _ {i} ^ {2}\right) \tag {49} \\ = \left(\frac {\frac {1}{t} \sum_ {i = 1} ^ {t} f _ {i}}{4} \vee 0\right) \cdot \left(\frac {\frac {1}{t} \sum_ {i = 1} ^ {t} f _ {i}}{\frac {1}{t} \sum_ {i = 1} ^ {t} f _ {i} ^ {2}} \wedge 1\right), \\ \end{array}
$$
where in (a) we used that  $\log(1 + x) \geq x - x^2$  for  $x \in [-1/2, 1/2]$ . From (48), it then follows that:
$$
\begin{array}{l} \liminf_{t\to \infty}\frac{\log\mathcal{K}_{t}}{t}\overset {\text{a.s.}}{\geq}\left(\frac{\mathbb{E}\left[ f(Z,W)\right]}{4}\lor 0\right)\cdot \left(\frac{\mathbb{E}\left[ f(Z,W)\right]}{\mathbb{E}\left[ f^{2}(Z,W)\right]}\land 1\right) \\ = \frac {1}{4} \left(\frac {\left(\mathbb {E} [ f (Z , W) ]\right) ^ {2}}{\mathbb {E} [ f ^ {2} (Z , W) ]} \wedge \mathbb {E} [ f (Z, W) ]\right), \\ \end{array}
$$
which completes the proof of the first assertion of the lemma.
(b) Since  $\log (1 + x)\leq x - 3x^{2} / 8$  for any  $x\in [-0.5,0.5]$ , we know that:
$$
\begin{array}{l} \mathbb {E} \left[ \log \left(1 + \lambda_ {\star} f (Z, W)\right) \right] \leq \mathbb {E} \left[ \lambda_ {\star} f (Z, W) - \frac {3}{8} \left(\lambda_ {\star} f (Z, W)\right) ^ {2} \right] \\ \leq \max  _ {\lambda \in [ - 0. 5, 0. 5 ]} \left(\lambda \cdot \mathbb {E} [ f (Z, W) ] - \frac {3 \lambda^ {2}}{8} \cdot \mathbb {E} \left[ (f (Z, W)) ^ {2} \right]\right). \\ \end{array}
$$
The optimizer of the above is
$$
\tilde {\lambda} = \frac {4 \mathbb {E} [ f (Z , W) ]}{3 \mathbb {E} \left[ (f (Z , W)) ^ {2} \right]} \wedge \frac {1}{2}.
$$
Hence, as long as  $\mathbb{E}\left[f(Z,W)\right] \leq (3/8) \cdot \mathbb{E}\left[(f(Z,W))^2\right]$ , we have:
$$
\mathbb {E} \left[ \log \left(1 + \lambda_ {\star} f (Z, W)\right) \right] \leq \frac {2}{3} \frac {\left(\mathbb {E} [ f (Z , W) ]\right) ^ {2}}{\mathbb {E} \left[ (f (Z , W)) ^ {2} \right]}. \tag {50}
$$
If however,  $\mathbb{E}\left[f(Z,W)\right] > (3 / 8)\cdot \mathbb{E}\left[(f(Z,W))^2\right]$ , then we know that:
$$
\mathbb {E} \left[ \log \left(1 + \lambda_ {\star} f (Z, W)\right) \right] \leq \frac {\mathbb {E} \left[ f (Z , W) \right]}{2}.
$$
To bring it to a convenient form, we multiply the upper bound in (50) by two and get the bound (46), which completes the proof of the second assertion of the lemma.
D.3 Proofs for Section 2
Proof. 1. The first equality in (9) follows from two facts: (a) for any  $g \in \mathcal{G}$  and any  $s \in (0,1]$ , it holds that  $R_{\mathrm{m}}(sg) = R_{\mathrm{m}}(g)$ , (b)  $R_{\mathrm{m}}(0) = 1 / 2$ . The second equality easily follows from the following fact: sign  $[x] / 2 = 1 / 2 - \mathbb{1} \{x < 0\}$ .
2. Consider an arbitrary predictor  $g \in \mathcal{G}$ . Let us consider all possible scenarios:
(a) If  $\mathbb{E}\left[W\cdot g(Z)\right]\leq 0$  , then the RHS of (10) is zero. For the LHS of (10), we have that:
$$
\sup  _ {s \in [ 0, 1 ]} \left(1 - R _ {\mathrm {s}} (s g)\right) \geq 1 - R _ {\mathrm {s}} (0) = 0,
$$
so the bound (10) holds.
(b) Next, assume that  $\mathbb{E}\left[W\cdot g(Z)\right] > 0$  , then it is easy to derive that:
$$
s _ {\star} := \underset {s \in [ 0, 1 ]} {\arg \max } (1 - R _ {\mathrm {s}} (s g)) = \frac {\mathbb {E} [ W \cdot g (Z) ]}{\mathbb {E} [ g ^ {2} (Z) ]} \wedge 1. \tag {51}
$$
A simple calculation shows that:
$$
1 - R _ {\mathrm {s}} (s _ {\star} g) \geq \mathbb {E} [ W \cdot g (Z) ] \cdot \left(\frac {\mathbb {E} [ W \cdot g (Z) ]}{\mathbb {E} [ g ^ {2} (Z) ]} \wedge 1\right),
$$
and hence, we conclude that the bound (10) holds.
$^6 \vee$  and  $\wedge$  denote a maximum and a minimum respectively:  $a \vee b = \max \{a, b\}$ ,  $a \wedge b = \min \{a, b\}$ .
To establish the second part of the statement, note that  $d_{\mathrm{s}}(P,Q) > 0$  iff there is a predictor  $g \in \mathcal{G}$  such that  $R_{\mathrm{s}}(g) < 1$ . For the squared risk, we have:
$$
1 - R _ {\mathrm {s}} (g) = 2 \mathbb {E} [ W \cdot g (Z) ] - \mathbb {E} [ g ^ {2} (Z) ], \tag {52}
$$
and hence,  $R_{\mathrm{s}}(g) < 1$  trivially implies that  $\mathbb{E}\left[W\cdot g(Z)\right] > 0$ . The converse implication trivially follows from (10). Hence, the result follows.
$$
\lim  _ {t \rightarrow \infty} \left(\frac {1}{t} \log \mathcal {K} _ {t} ^ {\mathrm {m}, \star}\right) \stackrel {\text {a . s .}} {\geq} \left(\frac {1}{2} - R _ {\mathrm {m}} \left(g _ {\star}\right)\right) ^ {2}. \tag {14}
$$
(b) The growth rate of the oracle wealth process  $(\mathcal{K}_t^{\mathrm{s},\star})_{t\geq 0}$  satisfies:
If  $\mathbb{E}\left[W\cdot g_{\star}(Z)\right] > 0$ , then the test based on  $(\mathcal{K}_t^{\mathrm{s},\star})_{t\geq 0}$  is consistent:  $\mathbb{P}_{H_1}(\tau < \infty) = 1$ . Further, the optimal growth rate achieved by  $\lambda_{\star}^{\mathrm{s}}$  in (13) satisfies:
Proof. 1. We trivially have that the payoff functions (11a) and (11b) are bounded:  $\forall (z,w)\in \mathcal{Z}\times \{-1,1\}$ , it holds that  $f_{\star}^{\mathrm{m}}(z,w)\in [-1,1]$  and  $f_{\star}^{\mathrm{s}}(z,w)\in [-1,1]$ . Further, under the null  $H_0$  in (1a), it trivially holds that  $\mathbb{E}_{H_0}[f_{\star}^{\mathrm{m}}(Z_t,W_t)\mid \mathcal{F}_{t - 1}] = \mathbb{E}_{H_0}[f_{\star}^{\mathrm{s}}(Z_t,W_t)\mid \mathcal{F}_{t - 1}] = 0$ , where  $\mathcal{F}_{t - 1} = \sigma (\{(Z_i,W_i)\}_{i\leq t - 1})$ . Since ONS betting fractions  $(\lambda_t^{\mathrm{ONS}})_{t\geq 1}$  are predictable, we conclude that the resulting wealth process is a nonnegative martingale. The assertion of the Theorem then follows directly from Ville's inequality (Proposition 2) when  $a = 1 / \alpha$ .
2. Suppose that  $H_{1}$  in (1b) is true. First, we prove the results for the lower bounds:
(a) Consider the wealth process based on the misclassification risk  $(\mathcal{K}_t^{\mathrm{m},\star})_{t\geq 0}$ . Note that for all  $t\geq 1$ :
$$
\mathbb {E} \left[ f _ {\star} ^ {\mathrm {m}} \left(Z _ {t}, W _ {t}\right) \right] = 2 \cdot \left(\frac {1}{2} - R _ {\mathrm {m}} \left(g _ {\star}\right)\right), \quad \left(f _ {\star} ^ {\mathrm {m}} \left(Z _ {t}, W _ {t}\right)\right) ^ {2} = 1.
$$
Since  $\mathbb{E}\left[f_{\star}^{\mathrm{m}}(Z_t,W_t)\right] \in [0,1]$ , we also have  $(\mathbb{E}\left[f_{\star}^{\mathrm{m}}(Z_t,W_t)\right])^2 \leq \mathbb{E}\left[f_{\star}^{\mathrm{m}}(Z_t,W_t)\right]$ . From the first part of Lemma 6, it follows that:
$$
\liminf_{t\to \infty}\frac{\log\mathcal{K}_{t}^{\mathrm{m},\star}}{t}\overset {\text{a.s.}}{\geq}\frac{1}{4}\left(\mathbb{E}\left[ f_{\star}^{\mathrm{m}}(Z_{t},W_{t})\right]\right)^{2} = \left(\frac{1}{2} -R_{\mathrm{m}}\left(g_{\star}\right)\right)^{2}.
$$
From the second part of Lemma 6, and (46) in particular, it follows that:
$$
\mathbb {E} \left[ \log \left(1 + \lambda_ {\star} ^ {\mathrm {m}} f _ {\star} ^ {\mathrm {m}} (Z, W)\right) \right] \leq \left(\frac {1 6}{3} \cdot \left(\frac {1}{2} - R _ {\mathrm {m}} (g _ {\star})\right) ^ {2} \wedge \left(\frac {1}{2} - R _ {\mathrm {m}} (g _ {\star})\right)\right).
$$
The first term in the above is smaller or equal than the second one whenever  $R_{\mathrm{m}}(g_{\star}) \geq 5 / 16$ . We conclude that the assertion of the theorem is true.
(b) Next, we consider the wealth process based on the squared error:  $(\mathcal{K}_t^{\mathrm{s},\star})_{t\geq 0}$ . Note that:
$$
\mathbb {E} \left[ f _ {\star} ^ {s} \left(Z _ {t}, W _ {t}\right) \right] = \mathbb {E} \left[ W \cdot g _ {\star} (Z) \right],
$$
$$
\mathbb {E} \left[ \left(f _ {\star} ^ {\mathrm {s}} \left(Z _ {t}, W _ {t}\right)\right) ^ {2} \right] = \mathbb {E} \left[ g _ {\star} ^ {2} (Z) \right],
$$
and hence from Lemma 6, it follows that:
$$
\lim  _ {t \rightarrow \infty} \inf  _ {t} \frac {\log \mathcal {K} _ {t} ^ {\mathrm {s} , \star}}{t} \geq \frac {1}{4} \left(\frac {\left(\mathbb {E} [ W \cdot g _ {\star} (Z) ]\right) ^ {2}}{\mathbb {E} [ g _ {\star} ^ {2} (Z) ]} \wedge \mathbb {E} [ W \cdot g _ {\star} (Z) ]\right). \tag {53}
$$
In the above, we assume that the following case is not possible:  $g_{\star}(Z) \stackrel{\mathrm{a.s.}}{=} 0$  (for such  $g_{\star}$ , the corresponding expected margin and the growth rate of the resulting wealth process are clearly zero, and will still be highlighted in our resulting bound). Next, note that since  $g_{\star} \in \arg \min_{g \in \mathcal{G}} R_{\mathrm{s}}(g)$ , we have that:
$$
1 - R _ {\mathrm {s}} \left(g _ {\star}\right) = \sup  _ {s \in [ 0, 1 ]} \left(1 - R _ {\mathrm {s}} \left(s g _ {\star}\right)\right),
$$
meaning that  $g_{\star}$  can not be improved by scaling with  $s < 1$ . From Proposition 1, and (51) in particular, it follows that:
$$
\frac {\mathbb {E} [ W \cdot g _ {\star} (Z) ]}{\mathbb {E} [ g _ {\star} ^ {2} (Z) ]} \geq 1, \tag {54}
$$
and hence, the bound (53) reduces to
$$
\liminf_{t\to \infty}\frac{\log\mathcal{K}_{t}^{\mathrm{s},\star}}{t}\overset {\text{a.s.}}{\geq}\frac{\mathbb{E}\left[W\cdot g_{\star}(Z)\right]}{4}.
$$
From the second part of Lemma 6, it follows that:
$$
\mathbb {E} \left[ \log \left(1 + \lambda_ {\star} ^ {\mathrm {s}} f _ {\star} ^ {\mathrm {s}} (Z, W)\right) \right] \leq \frac {4}{3} \frac {\left(\mathbb {E} [ W \cdot g _ {\star} (Z) ]\right) ^ {2}}{\mathbb {E} \left[ (g _ {\star} (Z)) ^ {2} \right]} \wedge \frac {\mathbb {E} [ W \cdot g _ {\star} (Z) ]}{2}. \tag {55}
$$
Next, we use that  $g_{\star}$  satisfies (54), which implies that the second term in (55) is smaller, and hence,
$$
\mathbb {E} \left[ \log \left(1 + \lambda_ {\star} ^ {\mathrm {s}} f _ {\star} ^ {\mathrm {s}} (Z, W)\right) \right] \leq \frac {\mathbb {E} \left[ W \cdot g _ {\star} (Z) \right]}{2},
$$
which concludes the proof of the second part of the theorem.
Proof. Following the same argument as that of the proof of Theorem 1, we can deduce that:
$$
\lim  _ {t \rightarrow \infty} \inf  _ {t} \frac {\log \mathcal {K} _ {t} ^ {\mathrm {s}}}{t} \geq \frac {1}{4} \left(\frac {\left(\mathbb {E} [ W \cdot g (Z) ]\right) ^ {2}}{\mathbb {E} [ g ^ {2} (Z) ]} \wedge \mathbb {E} [ W \cdot g (Z) ]\right). \tag {56}
$$
Hence, it suffices to argue that the lower bound (56) is equivalent to (18a). Without loss of generality, we can assume that  $\mathbb{E}\left[W\cdot g(Z)\right]\geq 0$  , and further, the two lower bounds are equal if  $\mathbb{E}\left[W\cdot g(Z)\right] = 0$  . Hence, we consider the case when  $\mathbb{E}\left[W\cdot g(Z)\right] > 0$  . First, let us consider the case when
$$
\frac {\mathbb {E} [ W \cdot g (Z) ]}{\mathbb {E} [ g ^ {2} (Z) ]} <   1. \tag {57}
$$
Using (51), we get that:
$$
\sup  _ {s \in [ 0, 1 ]} (1 - R _ {\mathrm {s}} (s g)) = \frac {\left(\mathbb {E} [ W \cdot g (Z) ]\right) ^ {2}}{\mathbb {E} [ g ^ {2} (Z) ]}, \tag {58}
$$
and hence, two bounds coincide. For the upper bound (19), we use Lemma 6, and the upper bound (46) in particular. Note that the first term in (46) is less than the second term whenever
$$
\frac {\mathbb {E} \left[ W \cdot g (Z) \right]}{\mathbb {E} \left[ (g (Z)) ^ {2} \right]} \leq \frac {3}{8} <   1.
$$
However, in this regime we also know that (58) holds, and hence the two bounds coincide. This completes the proof.
1. If  $H_0$  in (1a) is true, the test ever stops with probability at most  $\alpha$ :  $\mathbb{P}_{H_0}(\tau < \infty) \leq \alpha$ .
2. Suppose that  $H_{1}$  in (1b) is true. Then:
(a) Under Assumption 1, the test with the payoff (22a) is consistent:  $\mathbb{P}_{H_1}(\tau < \infty) = 1$ .
(b) Under Assumption 2, the test with the payoff (22b) is consistent:  $\mathbb{P}_{H_1}(\tau < \infty) = 1$ .
Proof. 1. We trivially have that the payoff functions (22a) and (22b) are bounded:  $\forall t \geq 1$  and  $\forall (z, w) \in \mathcal{Z} \times \{-1, 1\}$ , it holds that  $f_t^{\mathrm{m}}(z, w) \in [-1, 1]$  and  $f_t^{\mathrm{s}}(z, w) \in [-1, 1]$ . Further, under the null  $H_0$  in (1a), it trivially holds that  $\mathbb{E}_{H_0}[f_t^{\mathrm{m}}(Z_t, W_t) | \mathcal{F}_{t-1}] = \mathbb{E}_{H_0}[f_t^{\mathrm{s}}(Z_t, W_t) | \mathcal{F}_{t-1}] = 0$ , where  $\mathcal{F}_{t-1} = \sigma(\{(Z_i, W_i)\}_{i \leq t-1})$ . Since ONS betting fractions  $\left(\lambda_t^{\mathrm{ONS}}\right)_{t \geq 1}$  are predictable, we conclude that the resulting wealth process is a nonnegative martingale. The assertion of the Theorem then follows directly from Ville's inequality (Proposition 2) when  $a = 1 / \alpha$ .
2. Note that if ONS strategy for selecting betting fractions is deployed, then (49) implies that the tests will be consistent as long as
$$
\lim  _ {t \rightarrow \infty} \inf  _ {i = 1} \frac {1}{t} \sum_ {i = 1} ^ {t} f _ {i} ^ {\text {a . s .}} > 0, \tag {59}
$$
where for  $i \geq 1$ ,  $f_{i} = f_{i}^{\mathrm{m}}(Z_{i}, W_{i})$  and  $f_{i} = f_{i}^{\mathrm{s}}(Z_{i}, W_{i})$  for the payoffs based on the misclassification and the squared risks respectively.
(a) Recall that
$$
f _ {i} ^ {\mathrm {m}} \left(Z _ {i}, W _ {i}\right) = W _ {i} \cdot \operatorname {s i g n} \left[ g _ {i} \left(Z _ {i}\right) \right],
$$
and Assumption 1 states that: