Sequential Predictive Two-Sample and Independence Testing

We study the problems of sequential nonparametric two-sample and independence testing. Sequential tests process data online and allow using observed data to decide whether to stop and reject the null hypothesis or to collect more data, while maintaining type I error control. We build upon the principle of (nonparametric) testing by betting, where a gambler places bets on future observations and their wealth measures evidence against the null hypothesis. While recently developed kernel-based betting strategies often work well on simple distributions, selecting a suitable kernel for high-dimensional or structured data, such as images, is often nontrivial. To address this drawback, we design prediction-based betting strategies that rely on the following fact: if a sequentially updated predictor starts to consistently determine (a) which distribution an instance is drawn from, or (b) whether an instance is drawn from the joint distribution or the product of the marginal distributions (the latter produced by external randomization), it provides evidence against the two-sample or independence nulls respectively. We empirically demonstrate the superiority of our tests over kernel-based approaches under structured settings. Our tests can be applied beyond the case of independent and identically distributed data, remaining valid and powerful even when the data distribution drifts over time.

Paper

References (34)

Scroll for more · 22 remaining

Similar papers

Peer review

Reviewer qWK68/10 · confidence 4/52023-06-16

Summary

[Update: After reading the other reviews and the rebuttal, I have increased my score from 7 to 8] The paper provides an algorithm for sequential testing of the homogeneity (two-sample) and independence hypothesis. The core idea is that one learns a classifier to distinguish $P$ from $Q$ (in case of two-sample testing) or $P_{XY}$ from $P_X \times P_Y$ (in case of Independence testing) from the previously seen data. This learned algorithm is used to place a bet on a new observation (how likely it is that it is from one class or the other). If it matches one updates the betting budget (starting from 1). There is also a parameter that trades-off how much of the existing budget is used at a step. If the betting budget ever exceeds $1/\alpha$, with $\alpha$ the significance level, then one rejects the test. The authors show that the test controls type-I error and is consistent under the alternative if a non-trivial classifier can be learned. Furthermore they provide a strategy to select betting fractions which improves performance, especially if the classifier during the first iterations has poor quality.

Strengths

- The paper nicely combines recent work on sequential testing with the power of general classification algorithms. It does not require any specific learning algorithms but can use any existing learning framework. - The theory is presented at an adequate level. - The experiments nicely underline the theoretical statements of the work and show good empirical performance.

Weaknesses

- If I understand correctly, the main innovation over Pandeva et al [2022] is that the present work uses adaptive betting fractions? Is this a correct interpretation? I struggle a bit to clearly see the parallels and differences to Pandeva et al. They formulate their test in terms of E-values. Can your tests also be rephrased in terms of E-values to make a comparison simpler? **Minor**: - It took me a bit to understand the notation in some places: - l. 75. What does $\sigma$ stand for? - After l. 104. Say that probability and expectations are wrt 1/2 (P+Q) (at least that's what I figured) - Introduce $\vee \wedge$ notation for min/max - l. 127 what is the expectation taken over?

Questions

- Please see my remark above regarding Pandeva et al. Below are curiosities that could further improve the paper, but are not absolutely critical. - In Batch C2ST, where the sample size is fixed upfront, usually half the data is used for learning/testing. However, I am not aware that this is a principled choice. What if you used your approach even in batch testing to circumvent the need of selecting the splitting ratio. Can we get better power? I think it would be nice to have an experiment with exactly the same algorithm / architecture and compare the two approaches. - You prove that the type-I error is controlled even if the test is run indefinitely. I am curious: Does the test eventually exhaust the significance level? Do you have any theoretical or empirical insights? - you apply your test to every new datapoint. Panderas et al only update after a small batch of new data is presented. Have you considered this? It might be computationally a bit more convenient, and I am curious how it would affect test power.

Rating

8: Strong Accept: Technically strong paper, with novel ideas, excellent impact on at least one area, or high-to-excellent impact on multiple areas, with excellent evaluation, resources, and reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

4 excellent

Presentation

3 good

Contribution

3 good

Limitations

I do not see much limitations.

Reviewer VGT66/10 · confidence 2/52023-06-16

Summary

The authors propose methods of two-sample and independence tests in the setting of sequentially released data. Theoretical and empirical evaluations of the proposed methods are included.

Strengths

The authors propose algorithms for sequential two-sample and independence tests. The setting is interesting and important for practical applications. They provide theoretical results regarding the stop of the algorithm and the growth rate of the wealth. They also study the proposed methods numerically with synthetic and real-world data.

Weaknesses

The readability can be improved. The introduction part is so long that I understand the contributions of the paper. I think the authors should split Section 1 into 2 sections: one is for explaining the motivation and the contribution, the other is for the problem setting.

Questions

- In the paper, the initial values of $\lambda_t^{ONS}$ and $g_t$ are set as 0. Are there any strategies to set better initial values, or are there any empirical observations about that? - What is $\sigma(Z_1,\ldots,Z_{t-1})$ in line 75? Does it mean the $\sigma$-algebra? - In line 121, can we guarantee the existence of the minimizer $g_{\star}$? or is it just an assumption?

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

2: You are willing to defend your assessment, but it is quite likely that you did not understand the central parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

2 fair

Contribution

3 good

Limitations

In the proposed algorithm, the computation is the same for all $t$. Thus, the estimated $\lambda_t^{ONS}$ and $g_t$ for small $t$ seem to perform worse than those for large $t$. It cannot be helped to a certain extent, but in the sequential setting, I think investigating some strategies to improve the performance for small $t$ would be important.

Reviewer FPjp6/10 · confidence 3/52023-07-05

Summary

This paper proposes two sequential predictive two-sample tests based on betting, one is constructed by the payoff function $W\cdot \mathrm{sign}[g(Z)]$ for the misclassification risk, and the other is by the payoff function $W\cdot g(Z)$ for the squared risk. The limiting growth rate and the expected growth rate of both tests for an optimal $g^*\in G$ are given, and additionally, the same quantities of the squared-risk based test for an arbitrary $g\in G$ are given.

Strengths

Originality\ The paper proposes and thoroughly analyzes the sequential predictive two-sample tests; to the best of my knowledge, the proposed tests and the theoretical results are new. Quality\ The theoretical result is decent, which gives a growth rate comparison for the test based on the misclassification and the test based on the squared risk. Clarity\ The paper overall presents well. Significance\ The paper fills the blank that there is no formal construction of a classifier two-sample test using the betting framework.

Weaknesses

1. The variance of the growth rate is not given and it is actually also important in the derivation of the testing power. 2. The expected growth rate is a result of optimal $\lambda$ instead of an arbitrary one. 3. The comparison with the likelihood ratio test (Alix Lhéritier, 2018) is missing in the real-data experiment.

Questions

1. Why $\lambda$ is restricted to $[0, 1]$ instead of $[-1, 1]$. I can imagine a case where the payoff is negative, then using negative $\lambda$ would help increase the wealth in betting. 2. Is fitting the betting framework into the coin flip case the reason why the payoff functions are restricted to $[-1,1]$? 3. Why the ONS in algorithm 1 is different from the one in (Cutkosky and Orabona, 2018) work and (Shubhanshu Shekhar and Aaditya Ramdas, 2021), e.g., the update of $z_t$ and $\lambda_{t+1}^{ONS}$.

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

Please see the weakness section.

Reviewer ssj44/10 · confidence 4/52023-07-07

Summary

The work considered the problems of sequential nonparametric two-sample and independence testing. The researchers propose a novel approach, which overcomes the issues of kernel-based testing, such as finding an appropriate kernel for high-dimensional or structured data like text and images. The authors empirically demonstrate the superiority of their tests over kernel-based methods in structured settings. Furthermore, the tests remain valid and powerful even when the data distribution drifts over time.

Strengths

1. The authors propose a prediction-based betting strategies to help alleviate problems associated with kernel selection and adaptability with high-dimensional or structured data. 2. The authors provide compelling empirical evidence that their method outperforms existing kernel-based tests, especially in the context of structured settings. 3. The author provides the theoretical analysis about the properties of the proposed method.

Weaknesses

1. The authors should provide more technical details about the principle of testing by betting strategies. This is the key concepts in the paper but the author does not elaborate it too much in the paper. 2. The paper provides a high-level overview of the research making it challenging for general readers to comprehend. 3. The presentation is poor is a way mixed with methodology, theory, and numerical study in a single section (e.g. Section 2). 4. It is uncommon that one paper focused on two testings: the two-sample test and the independence test.

Questions

1. Does the proposed method have any potential limitations on data-dependency due to the use of nonparametric techniques? 2. Could the authors clarify how your method can retain its power when data distribution drifts over time? 3. It is not clear how the proposed techniques can be scalable to larger datasets?

Rating

4: Borderline reject: Technically solid paper where reasons to reject, e.g., limited evaluation, outweigh reasons to accept, e.g., good evaluation. Please use sparingly.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

1 poor

Contribution

2 fair

Limitations

The authors do not mention the limitations of this work.

Reviewer ryYs7/10 · confidence 4/52023-07-08

Summary

Kernel-based nonparametric two sample and independence tests performance can break down in the cases of complex data like images. The paper proposes sequential two sample and independence tests based on the misclassification rate. Compared to kernel-based tests, the proposed tests, which use CNNs, reject the null hypothesis faster than sequential kernel-based two sample and independence tests on image data while still controlling the type I error rate. The power comparison between the two approaches is somewhat inconclusive.

Strengths

The proposed approach is quite general and well suited to complex data like images that can be modeled with DNNs. The work is well supported theoretically. The empirical results argue favorably for the approach. The paper is well written.

Weaknesses

Some discussion of the practical computational complexity of the approach compared to kernel based tests would improve the paper. An empirical comparison to kernel-based tests on simpler data would highlight the advantages/disadvantages of each approach.

Questions

Optimizing the bandwidths is one drawback of kernel tests - how much hyperparameter tuning was required to achieve the performance reported? Have the authors compared the approach to kernel-based tests on simpler data? How do the runtimes compare to kernel-based tests?

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

4 excellent

Presentation

4 excellent

Contribution

4 excellent

Limitations

Could be expanded

Reviewer FPjp2023-08-11

Thank you for your reply. \ **Regarding the variance of growth rate**\ I understand the test's consistency is irrelevant to the variance of the growth rate. However, I was referring to the testing power, which is a finite-sample result. That is related to the variance of the growth rate. As for the comparison with [1], did you use CNN for your method and use a kernel to construct the sequential MMD test for [1]?

Reviewer FPjp2023-08-11

I re-read the paper, especially the experiments and conclusion. If I understand that correctly, the gain of testing power is attributed to the use of a predictive model over the kernel instead of the form of constructed statistic (e.g., with the payoff $W g(Z)$)? In fact, I found the gap between the proposed work and [1] is smaller than I thought. The sequential MMD test, which is used as an example for the test by betting in [1], can also be simply constructed with a predictive model by replacing $g$ with a predictive model; although $g$ might not by contained in the RKHS anymore. Hence, the superiority of the proposed method over the ''kernel'' test counterparts seems to be questionable to me.

Authorsrebuttal2023-08-12

> Regarding the variance of growth rate: I understand the test's consistency is irrelevant to the variance of the growth rate. However, I was referring to the testing power, which is a finite-sample result. That is related to the variance of the growth rate. Variance of the log wealth is not a metric that has ever been considered before in any paper on betting from the original (non-testing) works in information theory like Kelly (1954), Breiman (1963), Cover (1970s), or in any paper on using betting for statistical hypothesis testing (i.e., papers cited in our work). It is the variance of the payoffs that is important, not the variance of the growth rate (i.e., not the variance of the log payoffs): in particular, this is the reason why we have two terms in our bounds on the growth rate and why under the ''low-variance'' regime, we get a faster growth rate (the expected margin is not squared). We have finite sample guarantees on the rate of growth of wealth (due to the use of nonasymptotic regret bounds in our proofs), but we have stated the asymptotic growth rate because it is more interpretable. Regarding additional finite-sample results, we now also have bounds for the stopping time $\tau$, namely $P(\tau>t)$ and $\mathbb{E}[\tau]$, where an upper bound on the latter easily follows from the former bound (since $\mathbb{E}[\tau] = \sum_{t=0}^\infty P(\tau>t)$) for the case when the 2ST null is false. For simplicity, assume that the same classifier $g$ (e.g., the Bayes-optimal classifier) is utilized for betting using the payoff: $f(Z_t,W_t)=W\cdot g(Z_t)$. We show that: $\mathbb{E}[\tau] \leq O\Big( \Big( \frac{1}{\mathbb{E}[W \cdot g(Z)]} + \frac{1}{\sup_{s\in[0,1]}(1-R_s(sg))} \Big)\cdot \log(1/\alpha) \Big)$, meaning that the expected stopping time is upper bounded by the sum of the reciprocals of the expected margin of a classifier and the deviation of its (optimized) squared risk from the worst-case value. We get the squared risk term exactly because we account for the variance of the payoffs (otherwise, the upper bound is proportional only to the reciprocal of the *squared* expected margin of a classifier, which is always worse). We have added this result with the proof to the Appendix, and we are more than happy to provide a short proof sketch! > As for the comparison with [1], did you use CNN for your method and use a kernel to construct the sequential MMD test for [1]? This is correct. > I re-read the paper, especially the experiments and conclusion. If I understand that correctly, the gain of testing power is attributed to the use of a predictive model over the kernel instead of the form of constructed statistic (e.g., with the payoff $W_tg(Z_t)$)? In fact, I found the gap between the proposed work and [1] smaller than I thought. The sequential MMD test, which is used as an example for the test by betting in [1], can also be simply constructed with a predictive model by replacing it with a predictive model; although might not be contained in the RKHS anymore. Hence, the superiority of the proposed method over the ''kernel'' test counterparts seems to be questionable to me. While the two betting-based tests are closely related (which we highlighted at the end of the Introduction), our paper actually constructs a different betting game from that in [1]. Both papers are indeed similar from the standpoint of using a chosen distance measure between distributions (e.g., kernel-MMD in [1], or the squared risk of a classifier in our work) as a starting point for designing effective betting strategies. However, our paper is not just about constructing a valid test, but characterizing its quality: we explicitly relate the growth rate and consistency to interpretable and intuitive metrics that are associated with classifiers, namely their risks and margin. When we use the squared risk as a measure of distance, the resulting bets indeed happen to take a similar form as in the sequential kernel-MMD test from [1]. However, our theoretical results provide practical suggestions for designing powerful predictive 2STs, e.g., we show that training a classifier via direct margin maximization / minimizing the hinge loss (which may be hinted at by the distance measure in [1]) will hurt the power of the resulting 2ST, i.e., the growth rate of the wealth. Further, we also relate our test to earlier sequential predictive 2STs and show how we address their limitations. Last, we never argued that either of the approaches: kernel- or classifier-based, is superior to the other and confirmed that across different experimental setups. Our motivation was not to develop a predictive test that should replace a kernel one but rather to complement the existing kernel approach with a new method that may be better suited for high-dimensional or structured data (like images).

Reviewer FPjp2023-08-16

Thank you for your clarification. I acknowledge the main contribution of this work is a formal formalization of predictive two-sample testing by betting and deriving sound theorems about the test. A follow-up question about the ONS: the ONS proposed in the original paper is to minimize a reward. It is plausible to use their ONS algorithm here to maximize the reward (the wealth). However, as far as I understand, the ONS in your algorithm swaps the max and min operations in the original ONS; I am not sure if this could still maintain the original asymptotic optimality of the interested parameter. A safe way to maintain the same result of the original ONS from my perspective, which seems to be different from the ONS you implement, is to plug $-\lambda_t$ into the original ONS, update $-\lambda_t$ to $-\lambda_{t+1}$ and then use the negation of $-\lambda_{t+1}$. Can you comment on this confusion about ONS?

Authorsrebuttal2023-08-16

Sure! We thank the reviewer for pointing out another typo in the description of the ONS algorithm. Before diving into the details, we would like to note a correct implementation of the algorithm is used in our experiments, and hence, all the results still stand. [1] applies ONS for coin betting and defines the wealth updates as $\mathrm{Wealth}\_t=\text{Wealth}_{t-1} \cdot(1-g_t v_t)$. Here, $g_t$ denotes the observed outcomes (which is $-f_t$ in our notation), and $v_t$ is our $\lambda_t$. A correct version of the ONS for updating betting fractions according to our notation (which matches that in [1]) is stated below: 1. Observe $f_t \in [-1, 1]$; 2. Set $z_t := \frac{-f_t}{1+\lambda_{t}^{ONS} f_t}$; 3. Set $ a_t := a_{t-1} + z^2_t$ ; 4. Set $\lambda_{t+1}^{ONS} := \min(1/2, \max(0, \lambda_{t+1}^{ONS} - \frac{2}{2−\log 3} \cdot \frac{z_t}{a_t}))$; We have updated the paper to include the correct version of the algorithm. You can also verify that our experiments indeed use the correct algorithm by checking our code: in the supplement, if you open /code/utils/testing.py and search for “ONS” as a betting scheme (self.bet_scheme), you will find the following in lines 135--139: ` grad = self.run_mean/(1+self.run_mean*self.opt_lmbd) ` ` self.grad_sq_sum += grad**2 ` ` self.opt_lmbd = max(0, min(self.truncation_level, self.opt_lmbd + 2/(2-np.log(3))*grad/self.grad_sq_sum)) ` The above snippet matches the pseudo-code above and uses the correct signs (we moved the negation from the numerator in step 2 to the update rule in step 4 which corresponds to solving the maximization problem, i.e., grad is the derivative of $h(\lambda) = \log(1+\lambda\cdot f_t)$ and a plus has is a sign in the last line). [1] “Black-Box Reductions for Parameter-free Online Learning in Banach Spaces”, Cutkosky and Orabona, 2018.

Reviewer FPjp2023-08-16

Thank you for your clarification. My concerns are largely addressed. I am happy to increase the score from 5 to 6.

Reviewer qWK62023-08-15

Thanks -- no further questions

I thank the authors for their clarifications and adding additional experiments relative to Batch 2ST. Also they have appropriately addressed my other questions which went beyond the initial submission. I conclusion I am raising my score from 7 to 8.

Reviewer VGT62023-08-16

I have read the response. Thank you for your response.

Reviewer ssj42023-08-16

I have read the response. Thank you for your response.

Program Chairsdecision2023-09-21

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC