betaFeedback

WorksComputer Science

Hypothesis Selection via Weighted Medians

Abstract

Given nn distributions (hypotheses) H={H1,…,Hn}\mathcal H=\{H_1,\ldots,H_n\} and samples from an unknown target distribution PP, proper hypothesis selection seeks a distribution whose total variation distance to PP is close to the best achievable within the known distributions. We give an algorithm that, using O(ε−2log⁡(n/δ))O(\varepsilon^{-2}\log(n/δ)) target samples, running in O(nε−2log⁡(n/δ))O(n\varepsilon^{-2}\log(n/δ)) time, with probability at least 1−δ1-δ, returns Hi^H_{\hat i} satisfying dTV(P,Hi^)≤3min⁡i∈[n]dTV(P,Hi)+ε.d_\mathrm{TV}(P,H_{\hat i})\leq 3\min_{i\in[n]}d_\mathrm{TV}(P,H_i)+\varepsilon. The algorithm achieves the optimal approximation factor and sample complexity. The running time improves the dependence on the failure probability from polynomial to logarithmic in the state-of-the-art bound O~(nε−2δ−1)\tilde{O}(n\varepsilon^{-2}δ^{-1}) of Aamand, Aliakbarpour, Chen, and Silwal (COLT 2026), thereby answering their Question~2.

Introduction

Selecting a probability distribution from a finite class is a basic task in statistical learning. The target distribution need not belong to the class: the aim is to compete with the best available distribution using samples from the target. In hypothesis selection, the quality of this approximation is measured in total variation distance, and the challenge is to obtain statistical guarantees with a running time that scales favorably with the number of distributions.

Let H={H1,…,Hn}\mathcal{H} = \{H_1, \ldots, H_n\} be a class of distributions, each a probability measure on a measurable space (X,B)(\mathcal{X}, \mathcal{B}), and let PP be the unknown target distribution. Fix a common dominating measure μ\mu for PP, H1,…,HnH_1, \ldots, H_n, and write hi=dHi/dμh_i = dH_i/d\mu for the density of HiH_i. We have sample access to PP and sample and density-query access to every HiH_i; the density of PP is not available to the algorithm. Writing OPT=min⁡i∈[n]dTV(P,Hi)\mathrm{OPT} = \min_{i\in[n]}d_{\mathrm{TV}}(P,H_i), the goal is to return a probability measure QQ such that, with probability at least 1−δ1-\delta,

dTV(P,Q)≤C⋅OPT+ε.d_{\mathrm{TV}}(P,Q) \le C \cdot\mathrm{OPT}+\varepsilon.

Here ε∈(0,1)\varepsilon\in(0,1) is the additive error and δ∈(0,1)\delta\in(0,1) is the failure probability. The selection is proper if Q∈HQ \in\mathcal{H}; otherwise, the algorithm is allowed to be improper.

Statistical guarantees. Classical minimum-distance methods achieve approximation factor C=3C=3 using O(ε−2log⁡(n/δ))O(\varepsilon^{-2}\log(n/\delta)) samples from PP [11, 8]. The factor 3 is also optimal for proper selection with a sample size independent of the domain size [7, 1]. Allowing an improper output improves the achievable factor to 2 [7, 5]. Thus, for proper selection, the remaining issue is how efficiently the optimal statistical guarantee can be attained.

Computational guarantees. Classical factor-3 selectors have cubic or quadratic running times in nn [8, 10]. Aliakbarpour, Bun, and Smith [2] obtained a nearly linear dependence on nn, with running time O~(n/(δ3ε3))\widetilde{O}(n/(\delta^3\varepsilon^3)) and optimal target-sample complexity. Aamand, Aliakbarpour, Chen, and Silwal [1] improved the running time to O~(n/(δε2))\widetilde{O}(n/(\delta\varepsilon^2)) for δ>1/n\delta> 1/n. Selected bounds are compared in

AlgorithmRunning timeFailure probabilityComments
Minimum distance [11, 8]O(n3ε−2log⁡n)O(n^{3}\varepsilon^{-2}\log n)1/poly⁡(n)1/\operatorname{poly}(n)
Modified minimum distance [10]O(n2ε−2log⁡n)O(n^{2}\varepsilon^{-2}\log n)1/poly⁡(n)1/\operatorname{poly}(n)
Approx min distance [2]O~(n/(δ3ε3))\widetilde{O}(n/(\delta^{3}\varepsilon^{3}))δ\delta
Semi-distance threshold [1 Theorem 1.3]O~(n/(δε2))\widetilde{O}(n/(\delta\varepsilon^{2}))δ\deltaδ>1/n\delta> 1/n
This paper, Theorem 1.1O(nε−2log⁡(n/δ))O(n\varepsilon^{-2}\log(n/\delta))δ\delta

Table 1. Proper hypothesis selection with approximation factor 3. All rows use O(ε−2log⁡(n/δ))O(\varepsilon^{-2}\log(n/\delta)) target samples; for polynomially small failure probability, this is O(ε−2log⁡n)O(\varepsilon^{-2}\log n). More results are collected in [1 Table 1].

Table 1. Aamand et al. ask whether proper selection can simultaneously achieve factor 3, O(ε−2log⁡(n/δ))O(\varepsilon^{-2}\log(n/\delta)) target samples, and running time O~(nlog⁡(1/δ)/ε2)\widetilde{O}(n\log(1/\delta)/\varepsilon^{2}) [1 Question 2]. We answer this question affirmatively.

Theorem 1.1 (Fast proper hypothesis selection). Let n≥1n \ge1, 0<ε≤10 < \varepsilon\le1, and 0<δ<10 < \delta< 1. With probability at least 1−δ1-\delta, Algorithm 1 returns a distribution H^i∈H\widehat{H}_{i} \in\mathcal{H} which satisfies

dTV(P,H^i)≤3OPT⁡+ε.d_{\mathrm{TV}}(P,\widehat{H}_{i}) \le3\operatorname{OPT}+\varepsilon.

The algorithm uses O(ε−2log⁡(n/δ))O(\varepsilon^{-2}\log(n/\delta)) target samples, and runs in O(nε−2log⁡(n/δ))O(n\varepsilon^{-2}\log(n/\delta)) time.

Overview of the method

The algorithm compares the input distributions with the target through a common median measure. Starting from uniform weights, it updates the weights so that the median measures are close, on average, to a best input distribution.

At round tt, the algorithm maintains positive weights wt\mathbf{w}_{t} summing to one. For each point xx, let ut(x)u_{t}(x) be the lower weighted median of h1(x),…,hn(x)h_{1}(x),\ldots,h_{n}(x) under these weights, and let UtU_{t} be the measure with density utu_{t}. Since UtU_{t} need not have mass one, we measure its distance to HiH_{i} by Dt,i=12∥Ut−Hi∥1D_{t,i}=\frac{1}{2}\lVert U_{t}-H_{i}\rVert_{1}, where ∥⋅∥1\lVert\cdot\rVert_{1} denotes the total variation norm.

Balanced median tests σt,i(x)\sigma_{t,i}(x) indicate whether hi(x)h_{i}(x) lies below or above ut(x)u_{t}(x), with fractional tie values ensuring ∑iwt,iσt,i(x)=0\sum_{i}w_{t,i}\sigma_{t,i}(x)=0. These tests yield gains gt,ig_{t,i} that guide multiplicative weight updates: positive gains increase the corresponding weights, while negative gains decrease them. Since the median measure is not normalized and is difficult to sample from directly, each round uses one target sample and one sample from an easy-to-sample proposal distribution to compute the gains. Importance weights correct for the difference between the proposal and the median measure, with the proposal chosen to keep these weights bounded.

The balance of the tests gives ∑iwt,igt,i=0\sum_{i}w_{t,i}g_{t,i}=0, so the updates preserve the total weight without renormalization. A standard multiplicative-weights argument [3], combined with the Azuma–Hoeffding inequality, shows that each input distribution’s average conditional gain is at most O(ε)O(\varepsilon). The tests also ensure that

Dt,i≤E[gt,i∣Ft−1]+dTV(P,Hi),D_{t,i}\le\mathbb{E}[g_{t,i}\mid\mathcal{F}_{t-1}]+d_{\mathrm{TV}}(P,H_{i}),

where Ft−1\mathcal{F}_{t-1} records the previous rounds. Thus, with high probability, every distribution HiH_{i} satisfies D‾i≤dTV(P,Hi)+O(ε)\overline{D}_{i}\le d_{\mathrm{TV}}(P,H_{i})+O(\varepsilon), where D‾i=1T∑tDt,i\overline{D}_{i}=\frac{1}{T}\sum_{t}D_{t,i}. Applying the triangle inequality through Hi∗H_{i^*} then bounds the average distance between UtU_t and PP by

1T∑t=1T12∥P−Ut∥1≤D‾i∗+12∥P−Hi∗∥1≤2OPT⁡+O(ε).\frac{1}{T}\sum_{t=1}^{T}\frac{1}{2}\lVert P-U_t\rVert_1 \le\overline{D}_{i^*}+\frac{1}{2}\lVert P-H_{i^*}\rVert_1 \le2\operatorname{OPT}+O(\varepsilon).

The same proposal samples provide bounded, unbiased estimates D^t,i\widehat{D}_{t,i} of Dt,iD_{t,i}, including a correction for the mass of UtU_t. Azuma-Hoeffding inequality shows that, with high probability, for every input distribution, the average estimate is close to the average distance, namely ∣D‾^i−D‾i∣≤O(ε)\lvert\widehat{\overline{D}}_i-\overline{D}_i\rvert\le O(\varepsilon). The algorithm returns the input distribution H^i^\widehat{H}_{\hat{i}} with the smallest estimated average distance to the median measures. Uniform concentration of the distance estimates and the choice of i^\hat{i} imply

D‾i^≤D‾^i^+O(ε)≤D‾^i∗+O(ε)≤D‾i∗+O(ε)≤OPT⁡+O(ε).\overline{D}_{\hat{i}}\le\widehat{\overline{D}}_{\hat{i}}+O(\varepsilon)\le\widehat{\overline{D}}_{i^*}+O(\varepsilon)\le\overline{D}_{i^*}+O(\varepsilon)\le\operatorname{OPT}+O(\varepsilon).

Averaging the triangle inequality through UtU_t gives

dTV(P,H^i^)≤1T∑t=1T12∥P−Ut∥1+D‾i^≤3OPT⁡+O(ε).d_{\mathrm{TV}}(P,\widehat{H}_{\hat{i}})\le\frac{1}{T}\sum_{t=1}^{T}\frac{1}{2}\lVert P-U_t\rVert_1+\overline{D}_{\hat{i}}\le3\operatorname{OPT}+O(\varepsilon).

Tracking the constants yields 3OPT⁡+ε3\operatorname{OPT}+\varepsilon with probability at least 1−δ1-\delta after T=O(ε−2log⁡(n/δ))T=O(\varepsilon^{-2}\log(n/\delta)) rounds. Each round evaluates the input densities and computes weighted medians only at the two sampled points, using O(n)O(n) time and one target sample.

Preliminaries

Problem setting and computational model

Let H1,…,HnH_1,\ldots,H_n be probability distributions on a measurable space (X,B)(\mathcal{X},\mathcal{B}), and let PP be the unknown target distribution on the same space. Fix a common σ\sigma-finite dominating measure μ\mu for P,H1,…,HnP,H_1,\ldots,H_n, and write

p=dPdμ,hi=dHidμ(i∈[n]).p=\frac{dP}{d\mu},\qquad h_i=\frac{dH_i}{d\mu}\quad(i\in[n]).

Here hih_i is the density of the distribution HiH_i relative to μ\mu. The target density pp is used only as mathematical notation and is not available to the algorithm. We access PP through a sample oracle, and each HiH_i through a sample oracle and a density oracle that evaluates hi(x)h_i(x) at any supplied point x∈Xx\in\mathcal{X}. Every sample-oracle call returns a fresh independent draw from the requested measure.

For accuracy 0<ε≤10<\varepsilon\le1 and failure probability 0<δ<10<\delta<1, our goal is to return a distribution H^i^∈{H1,…,Hn}\widehat{H}_{\hat{i}}\in\{H_1,\ldots,H_n\} such that

dTV(P,H^i^)≤3OPT⁡+ε,OPT⁡=min⁡i∈[n]dTV(P,Hi),d_{\mathrm{TV}}(P,\widehat{H}_{\hat{i}})\le3\operatorname{OPT}+\varepsilon,\qquad\operatorname{OPT}=\min_{i\in[n]}d_{\mathrm{TV}}(P,H_i),

with probability at least 1−δ1-\delta over the samples and the algorithm’s internal randomness. The selection is proper because the output must be one of the input distributions.

We use an exact-real oracle model: sample-oracle calls, density evaluations, arithmetic operations (addition, subtraction, multiplication, or division), comparisons, ceiling operations, and draws from uniform distributions each take unit time. The algorithm’s running time is the total number of such operations. The sample complexity only counts the number of samples drawn from the target distribution PP.

Notation and density conventions

Write [n]={1,…,n}[n] = \{1, \ldots, n\}, use ln for the natural logarithm and log for the base-two logarithm, and set z+=max⁡{z,0}z_{+} = \max\{z, 0\}. Throughout the paper, fix i∗∈argmin⁡i∈[n]dTV(P,Hi)i^* \in\operatorname*{argmin}_{i \in[n]} d_{\mathrm{TV}}(P, H_i), breaking ties by a fixed rule.

Uppercase symbols denote measures and their lowercase counterparts denote densities relative to μ\mu. In particular, mm, m′m', and uu denote the densities of the mixtures MM, M′M', and the median measure UU introduced in ??.

Since hih_i is the density of HiH_i with respect to μ\mu, Hi(E)=∫Ehi dμH_i(E) = \int_E h_i \,\mathrm{d}\mu denotes the probability of a measurable set E∈BE \in\mathcal{B}. The same convention applies to MM, M′M', and UU, although UU need not have mass one.

Total variation and finite measures

For a finite signed measure VV on (X,B)(\mathcal{X}, \mathcal{B}), write ∥V∥1=∣V∣(X)\lVert V\rVert_1 = |V|(\mathcal{X}) for its total variation norm. If VV has density vv relative to μ\mu, then ∥V∥1=∫∣v∣ dμ\lVert V\rVert_1 = \int|v| \,\mathrm{d}\mu. For probability measures AA, BB, we use

dTV(A,B)=sup⁡E∈B∣A(E)−B(E)∣=12∥A−B∥1.d_{\mathrm{TV}}(A, B) = \sup_{E \in\mathcal{B}} |A(E) - B(E)| = \frac{1}{2}\lVert A - B\rVert_1.

For finite nonnegative measures AA, BB and any measurable function ff with ∣f∣≤1|f| \leq1, the total variation norm gives

∣∫f d(A−B)∣≤∥A−B∥1.(1)\left|\int f \,\mathrm{d}(A-B)\right| \leq\lVert A-B\rVert_1. \tag*{(1)}

We also use the triangle inequality for this norm, which applies even when the intermediate measure is not a probability measure. In particular, for probability measures AA, BB and a finite nonnegative measure UU,

dTV(A,B)≤12∥A−U∥1+12∥U−B∥1.d_{\mathrm{TV}}(A, B) \leq\frac{1}{2}\lVert A-U\rVert_1 + \frac{1}{2}\lVert U-B\rVert_1.

When U(X)≠1U(\mathcal{X}) \ne1, the quantity 12∥U−A∥1\frac{1}{2}\lVert U-A\rVert_1 denotes half the total variation norm, rather than the total variation distance between two probability measures.

A useful identity accounts explicitly for the mass of such a measure. If UU has density uu and mass U(X)=∫u dμU(\mathcal{X}) = \int u \,\mathrm{d}\mu, then

12∥U−Hi∥1=12∫∣u−hi∣ dμ=∫(u−hi)+ dμ−12∫(u−hi) dμ=∫(u−hi)+ dμ+1−U(X)2.(2)\begin{aligned} \frac{1}{2}\lVert U-H_i\rVert_1 &= \frac{1}{2}\int|u-h_i| \,\mathrm{d}\mu\\ &= \int(u-h_i)_{+} \,\mathrm{d}\mu- \frac{1}{2}\int(u-h_i) \,\mathrm{d}\mu\\ &= \int(u-h_i)_{+} \,\mathrm{d}\mu+ \frac{1-U(\mathcal{X})}{2}. \tag*{(2)} \end{aligned}

Indeed, ∣z∣=2z+−z|z| = 2z_{+} - z and ∫hi dμ=1\int h_i \,\mathrm{d}\mu= 1 give this identity directly. The correction (1−U(X))/2(1-U(\mathcal{X}))/2 is needed because the median measures used by the algorithm are not normalized.

Fast proper hypothesis selection

In this section, we present a fast proper hypothesis selection algorithm, Algorithm 1, and prove Theorem 1.1, which is restated below for convenience. § 1.1 provides an overview of the algorithm.

Theorem 3.1 (Theorem 1.1 restated). Let n≥1n \geq1, 0<ε≤10 < \varepsilon\leq1, and 0<δ<10 < \delta< 1. With probability at least 1−δ1-\delta, Algorithm 1 returns a distribution H^i∈H\widehat{H}_i \in\mathcal{H} which satisfies

dTV(P,H^i)≤3OPT⁡+ε.d_{\mathrm{TV}}(P, \widehat{H}_i) \leq3\operatorname{OPT} + \varepsilon.

The algorithm uses O(ε−2log⁡(n/δ))O(\varepsilon^{-2}\log(n/\delta)) target samples, and runs in O(nε−2log⁡(n/δ))O(n\varepsilon^{-2}\log(n/\delta)) time.

Weighted medians and balanced median tests

We now introduce the mixture of the input distributions defined by a weight vector, the median measure constructed from the mixture, and the balanced median tests that compare the median with each input distribution. All of these objects are updated in each round of the algorithm, and the round subscript tt is omitted in this section.

Let w=(w1,…,wn)\mathbf{w}=(w_1,\ldots,w_n) be a vector of positive weights with ∑iwi=1\sum_i w_i=1, and let M=∑iwiHiM=\sum_i w_iH_i be the corresponding mixture of input distributions. Then MM is a probability measure with density m=∑iwihim=\sum_i w_ih_i.

Let u(x)u(x) be the lower weighted median of h1(x),…,hn(x)h_1(x),\ldots,h_n(x): the smallest value whose cumulative weight is at least 1/21/2. The function uu is measurable, since it is selected from finitely many measurable density functions using measurable comparisons. Define the median measure UU by dU=u dμdU=u\,d\mu. Its mass U(X)U(\mathcal{X}) need not be one, so we do not normalize it.

Let W<(x)=∑i:hi(x)<u(x)wiW_{<}(x)=\sum_{i:h_i(x)<u(x)}w_i be the total weight on density values below u(x)u(x), with W=(x)W_{=}(x) and W>(x)W_{>}(x) defined analogously. Define the balanced median tests σi(x)\sigma_i(x) by

σi(x)={1,hi(x)<u(x),W>(x)−W<(x)W=(x),hi(x)=u(x),−1,hi(x)>u(x).(3)\sigma_i(x)= \begin{cases} 1, & h_i(x)<u(x),\\ \dfrac{W_{>}(x)-W_{<}(x)}{W_{=}(x)}, & h_i(x)=u(x),\\ -1, & h_i(x)>u(x). \end{cases} \tag*{(3)}

The tests are measurable signed functions that indicate whether hi(x)h_i(x) is below or above the median, with a fractional tie value that exactly balances the total weight on each side. Replacing the tie value by a fixed sign or by zero does not preserve ∑iwiσi(x)=0\sum_iw_i\sigma_i(x)=0 in general, which is crucial for the multiplicative weight updates. The denominator W=(x)W_{=}(x) is positive because the median is an input value and all weights are positive.

Lemma 3.2 (Weighted-median identities). For every x∈Xx\in\mathcal{X} and i∈[n]i\in[n],

∣σi(x)∣≤1,|\sigma_i(x)|\le1,
∑iwiσi(x)=0,\sum_iw_i\sigma_i(x)=0,
σi(x)(u(x)−hi(x))=∣u(x)−hi(x)∣,\sigma_i(x)(u(x)-h_i(x))=|u(x)-h_i(x)|,
0≤u(x)≤2m(x).0\le u(x)\le2m(x).

In particular, UU is a finite nonnegative measure with U(X)≤2U(\mathcal{X})\le2.

Proof of Lemma 3.2. Fix x∈Xx\in\mathcal{X}. The lower-median definition gives W<(x)<1/2W_{<}(x)<1/2 and W>(x)≤1/2W_{>}(x)\le1/2. Since W=(x)=1−W<(x)−W>(x)W_{=}(x)=1-W_{<}(x)-W_{>}(x), these inequalities imply

−W=(x)≤W>(x)−W<(x)≤W=(x).-W_{=}(x)\le W_{>}(x)-W_{<}(x)\le W_{=}(x).

Thus the tie value lies in [−1,1][-1,1], proving the first identity.

Summing the three cases of Eq. (3) gives

∑iwiσi(x)=W<(x)−W>(x)+W=(x)W>(x)−W<(x)W=(x)=0.\sum_iw_i\sigma_i(x)=W_{<}(x)-W_{>}(x)+W_{=}(x)\frac{W_{>}(x)-W_{<}(x)}{W_{=}(x)}=0.

The third identity follows directly from the sign of u(x)−hi(x)u(x)-h_i(x).

Finally, at least half the weight lies on values at least u(x)u(x), so

m(x)=∑i∈[n]wihi(x)≥u(x)∑i:hi(x)≥u(x)wi≥u(x)2.m(x)=\sum_{i\in[n]}w_ih_i(x)\ge u(x)\sum_{i:h_i(x)\ge u(x)}w_i\ge\frac{u(x)}{2}.

Integrating gives U(X)≤2M(X)=2U(\mathcal{X})\le2M(\mathcal{X})=2 since MM is a probability measure.

Rounded weights and proposal distribution

In each round, the algorithm compares the median measure with the target distribution to guide the weight updates. Sampling from the target is straightforward, but the median measure is not normalized and is difficult to sample from directly. We therefore introduce a proposal distribution which is easy to sample from and use importance weights to correct for the difference between the proposal and the median measure. The subscript tt is also omitted in this section.

Directly sampling from the mixture MM is also difficult, since the mixture weights are arbitrary real numbers. We thus round the weights to dyadic probabilities, which allows exact sampling from the rounded mixture M′M' in linear time, using a uniform integer draw and a sample from one of the input distributions.

Choose the least power of two N≥nN \ge n, so n≤N<2nn \le N < 2n, once for the entire algorithm. Given w\mathbf{w}, first set ai=⌈Nwi⌉a_i = \lceil Nw_i\rceil. Increase a1a_1 by 2N−∑iai2N-\sum_i a_i, so that the final integer weights sum to 2N2N, and define the rounded weights, mixture, and density by

wi′=ai2N,M′=∑iwi′Hi,m′(x)=∑iwi′hi(x).w'_i = \frac{a_i}{2N}, \qquad M' = \sum_i w'_i H_i, \qquad m'(x) = \sum_i w'_i h_i(x).

Lemma 3.3 (Proposal properties). For every x∈Xx \in\mathcal{X} and i∈[n]i \in[n],

wi′≥wi2,wi′≥12N,m′(x)≥m(x)2,m′(x)≥u(x)4.w'_i \ge\frac{w_i}{2}, \qquad w'_i \ge\frac{1}{2N}, \qquad m'(x) \ge\frac{m(x)}{2}, \qquad m'(x) \ge\frac{u(x)}{4}.

Proof of Lemma 3.3. Before increasing a1a_1, positivity of the weights gives max⁡{Nwi,1}≤ai<Nwi+1\max\{Nw_i,1\} \le a_i < Nw_i+1, and hence ∑iai<N+n≤2N\sum_i a_i < N+n \le2N. The remaining integer mass is nonnegative, and adding it to a1a_1 preserves ai≥Nwia_i \ge Nw_i and ai≥1a_i \ge1. Dividing by 2N2N gives the first two inequalities.

Multiplying wi′≥wi/2w'_i \ge w_i/2 by hi(x)h_i(x) and summing gives m′(x)≥m(x)/2m'(x) \ge m(x)/2. Together with 0≤u(x)≤2m(x)0 \le u(x) \le2m(x) from Lemma 3.2, we get m′(x)≥u(x)/4m'(x) \ge u(x)/4.

Sampling from M′M'. Draw I∼Unif⁡([2N])I \sim\operatorname{Unif}([2N]) in unit time. Scan the cumulative sums ∑k≤iak\sum_{k \le i} a_k to find the unique index ii such that ∑k<iak<I≤∑k≤iak\sum_{k < i} a_k < I \le\sum_{k \le i} a_k, and return a fresh sample from HiH_i. The index equals ii with probability ai/(2N)=wi′a_i/(2N) = w'_i, so the procedure returns a sample from M′M'. The sampling time is O(n)O(n): the uniform draw and candidate-sample query each take unit time, and the cumulative scan takes O(n)O(n) time.

The iterative procedure

We now describe the iterative procedure, in which we use the balanced median tests to guide how to update the weights such that the new median measure is closer to the target.

Define the number of rounds

T=⌈400ε−2⌈log⁡3nδ⌉⌉.T = \left\lceil400\varepsilon^{-2}\left\lceil\log\frac{3n}{\delta}\right\rceil\right\rceil.

Let (Ft)t=0T(\mathcal{F}_t)_{t=0}^{T} be the filtration generated by the random choices in the algorithm, with F0\mathcal{F}_0 containing the fixed input. At round tt, the weights wt=(wt,1,…,wt,n)\mathbf{w}_t=(w_{t,1},\ldots,w_{t,n}), median measure UtU_t, tests σt,i\sigma_{t,i}, and proposal Mt′M'_t are fixed. Draw independent fresh samples Xt∼Mt′X_t \sim M'_t and Yt∼PY_t \sim P, and define

ρt=ut(Xt)mt′(Xt)(4)\rho_t = \frac{u_t(X_t)}{m'_t(X_t)} \tag*{(4)}
gt,i=12(ρtσt,i(Xt)−σt,i(Yt))(5)g_{t,i} = \frac{1}{2}\left(\rho_t\sigma_{t,i}(X_t)-\sigma_{t,i}(Y_t)\right) \tag*{(5)}
D^t,i=(ut(Xt)−hi(Xt))+mt′(Xt)+1−ρt2.(6)\widehat{D}_{t,i} = \frac{\left(u_t(X_t)-h_i(X_t)\right)_+}{m'_t(X_t)}+\frac{1-\rho_t}{2}. \tag*{(6)}

Since every wt,i′>0w'_{t,i}>0, if mt′(x)=0m'_t(x)=0 then all hi(x)h_i(x) and ut(x)u_t(x) vanish. Ratios with denominator mt′(x)m'_t(x) are defined to be zero. This convention preserves the integral identities, and Mt′M'_t assigns that set probability zero. The expectation calculations in § 3.4.2 make this explicit.

Gains and distance estimates. ρt\rho_t is the importance weight that corrects for the difference between the proposal and the median measure. § 3.4.2 proves that

E[gt,i∣Ft−1]=12∫σt,i d(Ut−P),E[D^t,i∣Ft−1]=12∥Ut−Hi∥1.\mathbb{E}[g_{t,i}\mid\mathcal{F}_{t-1}] = \frac{1}{2}\int\sigma_{t,i}\,d(U_t-P), \qquad\mathbb{E}[\widehat{D}_{t,i}\mid\mathcal{F}_{t-1}] = \frac{1}{2}\lVert U_t-H_i\rVert_1.

By the definition of the tests, a positive gain gt,ig_{t,i} suggests that HiH_i lies, on average, on the same side of the median as the target, so increasing the weight of HiH_i would move the median measure closer to the target, while a negative gain suggests the opposite. Starting from uniform weights, we update the weights of the input distributions based on the gains. It’ll be shown that this update rule ensures that the average distance between the median measures and the target distribution across all rounds is small.

The distance estimates D^t,i\widehat{D}_{t,i} are collected in each round to estimate the average distance between the median measures and each input distribution. Since 0≤(ut−hi)+≤ut≤4mt′0\leq(u_t-h_i)_+\leq u_t\leq4m'_t, it’ll be shown that the distance estimate D^t,i\widehat{D}_{t,i} lies in an interval of length four, independently of nn and the current weights. This bound is crucial for the concentration analysis via the Azuma-Hoeffding inequality in Lemma 3.7. In contrast, the direct estimate ∣ut(Xt)−hi(Xt)∣/(2mt′(Xt))\lvert u_t(X_t)-h_i(X_t)\rvert/(2m'_t(X_t)) introduces the ratio hi(Xt)/mt′(Xt)h_i(X_t)/m'_t(X_t), whose bound 1/wt,i′≤2N1/w'_{t,i}\leq2N depends on nn.

Each round takes linear time. The algorithm represents UtU_t implicitly through the weights and the densities of the input distributions. In each round, it computes the weighted median and tests only at XtX_t and YtY_t. Using the idea of median-of-medians [6], Section A shows that the weighted median can be computed in O(n)O(n) time. Then the tests can be computed in O(n)O(n) time by scanning the input densities and accumulating the weights. Rounding, proposal sampling, density evaluation, and the updates also take O(n)O(n) time, giving a total of O(n)O(n) per round.

Algorithm 1: Proper hypothesis selection via weighted medians

Input: Sample oracle for PP; sample and density oracles for H1,…,HnH_1,\ldots,H_n; accuracy ε\varepsilon and failure probability δ\delta.

Output: An input distribution H^i\widehat{H}_{i}.

  1. Choose NN as the least power of two at least nn; set T=⌈400ε−2⌈log⁡3n/δ⌉⌉T=\lceil400\varepsilon^{-2}\lceil\log3n/\delta\rceil\rceil

  2. Initialize w1,i=1/nw_{1,i}=1/n and D^i=0\widehat{D}_i=0 for every i∈[n]i\in[n]

  3. for t=1,…,Tt=1,\ldots,T do

  4. &nbsp;&nbsp;&nbsp;&nbsp;Use wtw_t to define UtU_t and σt,i\sigma_{t,i} by Eq. (3)

  5. &nbsp;&nbsp;&nbsp;&nbsp;Construct wt′w'_t and Mt′M'_t using the rounding procedure of Lemma 3.3

  6. &nbsp;&nbsp;&nbsp;&nbsp;Draw independent fresh samples Xt∼Mt′X_t\sim M'_t and Yt∼PY_t\sim P

  7. &nbsp;&nbsp;&nbsp;&nbsp;Evaluate all hi(Xt),hi(Yt)h_i(X_t),h_i(Y_t), the two weighted medians and their tests, and mt′(Xt)=∑iwt,i′hi(Xt)m'_t(X_t)=\sum_i w'_{t,i}h_i(X_t)

  8. &nbsp;&nbsp;&nbsp;&nbsp;Compute ρt\rho_t by Eq. (4)

  9. &nbsp;&nbsp;&nbsp;&nbsp;for i=1,…,ni=1,\ldots,n do

  10. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compute gt,ig_{t,i} and D^t,i\widehat{D}_{t,i} by Eq. (5) and Eq. (6)

  11. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wt+1,i←wt,i(1+(ε/50)gt,i)w_{t+1,i}\gets w_{t,i}(1+(\varepsilon/50)g_{t,i})

  12. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;D^i←D^i+D^t,i/T\widehat{D}_i\gets\widehat{D}_i+\widehat{D}_{t,i}/T

  13. Return H^i^\widehat{H}_{\hat{i}} for i^∈argmini∈[n]D^i\hat{i}\in\mathop{\rm argmin}_{i\in[n]}\widehat{D}_i

Analysis of the algorithm

In this section, we analyze the performance of Algorithm 1 and prove Theorem 3.1. Each round of the algorithm draws one sample from the target distribution, and runs in O(n)O(n) time. The total sample complexity is T=O(ε−2log⁡(n/δ))T = O(\varepsilon^{-2}\log(n/\delta)), and the total time complexity is O(nT)=O(nε−2log⁡(n/δ))O(nT) = O(n\varepsilon^{-2}\log(n/\delta)), as claimed in Theorem 3.1. We now show that the output distribution H^i\widehat{H}_i satisfies dTV(P,H^i)≤3OPT⁡+εd_{\mathrm{TV}}(P,\widehat{H}_i) \le3\operatorname{OPT}+\varepsilon with probability at least 1−δ1-\delta.

Bounded estimates and validity of the updates

Suppose that the current weights are positive and sum to one. By Lemma 3.3, mt′≥ut/4m'_t \ge u_t/4, so 0≤ρt≤40 \le\rho_t \le4 and

0≤(ut(Xt)−hi(Xt))+mt′(Xt)≤ρt.0 \le\frac{(u_t(X_t)-h_i(X_t))_+}{m'_t(X_t)} \le\rho_t.

Together with ∣σt,i∣≤1|\sigma_{t,i}| \le1 from Lemma 3.2, these bounds imply

∣gt,i∣≤52,−32≤D^t,i≤52.(7)|g_{t,i}| \le\frac{5}{2}, \qquad-\frac{3}{2} \le\widehat{D}_{t,i} \le\frac{5}{2}. \tag*{(7)}

Validity of the update. The initial weights are positive and sum to one. The balance identity ∑iwiσi(x)=0\sum_i w_i\sigma_i(x)=0, in Lemma 3.2 holds pointwise, and therefore

∑iwt,igt,i=12(ρt∑iwt,iσt,i(Xt)−∑iwt,iσt,i(Yt))=0.\sum_i w_{t,i}g_{t,i} = \frac{1}{2}\left(\rho_t\sum_i w_{t,i}\sigma_{t,i}(X_t)-\sum_i w_{t,i}\sigma_{t,i}(Y_t)\right)=0.

Consequently,

∑iwt+1,i=∑iwt,i+ε50∑iwt,igt,i=1.\sum_i w_{t+1,i}=\sum_i w_{t,i}+\frac{\varepsilon}{50}\sum_i w_{t,i}g_{t,i}=1.

Moreover, ∣(ε/50)gt,i∣≤ε/20≤1/20|(\varepsilon/50)g_{t,i}| \le\varepsilon/20 \le1/20, so every update factor is positive. Induction shows that all weight vectors, medians, and proposals are well defined, and that Eq. (7) holds in every round.

With this in place, the following standard multiplicative-weights argument [3] bounds the cumulative gain of each input distribution.

Lemma 3.4 (Deterministic gain bound). For every i∈[n]i \in[n],

1T∑t=1Tgt,i≤50ln⁡nεT+ε8≤7ε32.\frac{1}{T}\sum_{t=1}^{T}g_{t,i}\le\frac{50\ln n}{\varepsilon T}+\frac{\varepsilon}{8}\le\frac{7\varepsilon}{32}.

Proof of Lemma 3.4. Since wt+1,i=wt,i(1+(ε/50)gt,i)w_{t+1,i}=w_{t,i}(1+(\varepsilon/50)g_{t,i}) and w1,i=1/nw_{1,i}=1/n, it holds that

ln⁡wT+1,i=−ln⁡n+∑t=1Tln⁡(1+(ε/50)gt,i)≥−ln⁡n+ε50∑t=1Tgt,i−ε22500∑t=1Tgt,i2≥−ln⁡n+ε50∑t=1Tgt,i−ε2T400,\begin{aligned} \ln w_{T+1,i}=-\ln n+\sum_{t=1}^{T}\ln(1+(\varepsilon/50)g_{t,i}) \\ &\ge-\ln n+\frac{\varepsilon}{50}\sum_{t=1}^{T}g_{t,i}-\frac{\varepsilon^2}{2500}\sum_{t=1}^{T}g_{t,i}^{2} \\ &\ge-\ln n+\frac{\varepsilon}{50}\sum_{t=1}^{T}g_{t,i}-\frac{\varepsilon^2T}{400}, \end{aligned}

where the first inequality uses ln⁡(1+x)≥x−x2\ln(1+x) \ge x-x^2 for ∣x∣≤1/2|x| \le1/2, and the second uses gt,i2≤25/4g_{t,i}^2 \le25/4. The weights are positive and sum to one, so 0<wT+1,i≤10 < w_{T+1,i} \le1 and ln⁡wT+1,i≤0\ln w_{T+1,i} \le0. Rearranging gives

1T∑t=1Tgt,i≤50ln⁡nεT+ε8.\frac{1}{T}\sum_{t=1}^{T} g_{t,i} \le\frac{50\ln n}{\varepsilon T}+\frac{\varepsilon}{8}.

Finally, since ln⁡2<3/4\ln2 < 3/4, we have ln⁡n≤ln⁡(3n/δ)≤3⌈log⁡(3n/δ)⌉/4\ln n \le\ln(3n/\delta) \le3\lceil\log(3n/\delta)\rceil/4. Together with T≥400ε−2⌈log⁡(3n/δ)⌉T \ge400\varepsilon^{-2}\lceil\log(3n/\delta)\rceil, this gives

50ln⁡nεT+ε8≤3ε32+ε8=7ε32.\frac{50\ln n}{\varepsilon T}+\frac{\varepsilon}{8}\le\frac{3\varepsilon}{32}+\frac{\varepsilon}{8}=\frac{7\varepsilon}{32}.

Conditional expectations

Recall the filtration Ft\mathcal{F}_t from § 3.3. Define

Dt,i=12∥Ut−Hi∥1,D‾i=1T∑t=1TDt,i.D_{t,i}=\frac{1}{2}\lVert U_t-H_i\rVert_1,\qquad\overline{D}_i=\frac{1}{T}\sum_{t=1}^{T}D_{t,i}.

Note that UtU_t need not have mass one.

Lemma 3.5 (Conditional expectations). For every round t∈[T]t \in[T] and coordinate i∈[n]i \in[n],

Dt,i≤E[gt,i∣Ft−1]+dTV(P,Hi),E[D^t,i∣Ft−1]=Dt,i.D_{t,i}\le\mathbb{E}[g_{t,i}\mid\mathcal{F}_{t-1}]+d_{\mathrm{TV}}(P,H_i),\qquad\mathbb{E}[\widehat{D}_{t,i}\mid\mathcal{F}_{t-1}]=D_{t,i}.

Proof of Lemma 3.5. Conditional on Ft−1\mathcal{F}_{t-1}, the current weights, median, tests, and proposal are fixed, and Xt∼Mt′X_t\sim M'_t and Yt∼PY_t\sim P are fresh and independent. By the sign identity σi(x)(ut(x)−hi(x))=∣ut(x)−hi(x)∣\sigma_i(x)(u_t(x)-h_i(x))=|u_t(x)-h_i(x)| in Lemma 3.2,

Dt,i=12∫∣ut(x)−hi(x)∣ dμ(x)=12∫σt,i d(Ut−Hi)=12∫σt,i d(Ut−P)+12∫σt,i d(P−Hi).(8)\begin{aligned} D_{t,i} &=\frac{1}{2}\int|u_t(x)-h_i(x)|\,d\mu(x)\\ &=\frac{1}{2}\int\sigma_{t,i}\,d(U_t-H_i)\\ &=\frac{1}{2}\int\sigma_{t,i}\,d(U_t-P)+\frac{1}{2}\int\sigma_{t,i}\,d(P-H_i). \tag*{(8)} \end{aligned}

Importance sampling gives

E[ρtσt,i(Xt)∣Ft−1]=∫{x:mt′(x)>0}ut(x)σt,i(x)mt′(x)mt′(x) dμ(x)=∫σt,i dUt.\mathbb{E}[\rho_t\sigma_{t,i}(X_t)\mid\mathcal{F}_{t-1}] =\int_{\{x:m'_t(x)>0\}}\frac{u_t(x)\sigma_{t,i}(x)}{m'_t(x)}m'_t(x)\,d\mu(x) =\int\sigma_{t,i}\,dU_t.

On the set {x:mt′(x)=0}\{x:m'_t(x)=0\}, which has measure zero under Mt′M'_t, we have already defined the ratio ρt=ut(x)/mt′(x)\rho_t=u_t(x)/m'_t(x) to be zero. The expectation can therefore be written as an integral over x:mt′(x)>0x:m'_t(x)>0. After canceling mt′(x)m'_t(x) on this set, we obtain the last equality by extending the integral to all of X\mathcal{X}, since ut(x)=0u_t(x)=0 wherever mt′(x)=0m'_t(x)=0. Since E[σt,i(Yt)∣Ft−1]=∫σt,i dP\mathbb{E}[\sigma_{t,i}(Y_t)\mid\mathcal{F}_{t-1}]=\int\sigma_{t,i}\,dP, we obtain

E[gt,i∣Ft−1]=12∫σt,i d(Ut−P).(9)\mathbb{E}[g_{t,i}\mid\mathcal{F}_{t-1}] =\frac{1}{2}\int\sigma_{t,i}\,d(U_t-P). \tag*{(9)}

Combining Eqs. (8) and (9) and applying Eq. (1) yields

Dt,i=E[gt,i∣Ft−1]+12∫σt,i d(P−Hi)≤E[gt,i∣Ft−1]+dTV(P,Hi).\begin{aligned} D_{t,i} &=\mathbb{E}[g_{t,i}\mid\mathcal{F}_{t-1}]+\frac{1}{2}\int\sigma_{t,i}\,d(P-H_i)\\ &\le\mathbb{E}[g_{t,i}\mid\mathcal{F}_{t-1}]+d_{\mathrm{TV}}(P,H_i). \end{aligned}

For the distance estimate, Eq. (2) gives

Dt,i=∫(ut(x)−hi(x))+ dμ(x)+1−Ut(X)2.D_{t,i}=\int(u_t(x)-h_i(x))_+\,d\mu(x)+\frac{1-U_t(\mathcal{X})}{2}.

Both utu_t and (ut−hi)+(u_t-h_i)_+ vanish wherever mt′=0m'_t=0, so the same importance-sampling calculation yields

E[(ut(Xt)−hi(Xt))+mt′(Xt)∣Ft−1]=∫(ut(x)−hi(x))+ dμ(x),\mathbb{E}\left[\left.\frac{(u_t(X_t)-h_i(X_t))_+}{m'_t(X_t)}\right|\mathcal{F}_{t-1}\right]=\int(u_t(x)-h_i(x))_+\,d\mu(x),
E[ρt∣Ft−1]=Ut(X).\mathbb{E}[\rho_t\mid\mathcal{F}_{t-1}]=U_t(\mathcal{X}).

Substituting into Eq. (6) proves

E[D^t,i∣Ft−1]=Dt,i.\mathbb{E}[\widehat{D}_{t,i}\mid\mathcal{F}_{t-1}]=D_{t,i}.

Concentration bounds

We now show that the average gains and distance estimates concentrate around their conditional expectations. The weights, weighted medians and proposals depend on previous samples, so we use a conditional form of the Azuma–Hoeffding inequality [4, 9].

Lemma 3.6 (Azuma–Hoeffding inequality). Let (Ft)t=0T(\mathcal{F}_t)_{t=0}^T be a filtration and let (ξt)t=1T(\xi_t)_{t=1}^T be a sequence of random variables, each Ft\mathcal{F}_t-measurable with E[ξt∣Ft−1]=0\mathbb{E}[\xi_t\mid\mathcal{F}_{t-1}]=0. Suppose that at≤ξt≤bta_t\leq\xi_t\leq b_t almost surely, where at,bta_t,b_t are Ft−1\mathcal{F}_{t-1}-measurable and bt−at≤cb_t-a_t\leq c for a constant c>0c>0. Then for s>0s>0,

Pr⁡{1T∑t=1Tξt>s}≤exp⁡(−2Ts2c2).\Pr\left\{\frac{1}{T}\sum_{t=1}^{T}\xi_t>s\right\}\leq\exp\left(-\frac{2Ts^2}{c^2}\right).

The same bound holds for the lower tail.

Lemma 3.7 (Concentration of gains and distance estimates). With probability at least 1−δ1-\delta, the following inequalities hold simultaneously for every i∈[n]i\in[n]:

1T∑t=1TE[gt,i∣Ft−1]≤1T∑t=1Tgt,i+5ε32,\frac{1}{T}\sum_{t=1}^{T}\mathbb{E}[g_{t,i}\mid\mathcal{F}_{t-1}]\leq\frac{1}{T}\sum_{t=1}^{T}g_{t,i}+\frac{5\varepsilon}{32},
∣D^i−Di∣≤ε8.\lvert\widehat{D}_i-D_i\rvert\leq\frac{\varepsilon}{8}.

Proof of Lemma 3.7. T=⌈400ε−2⌈log⁡3nδ⌉⌉T=\left\lceil400\varepsilon^{-2}\left\lceil\log\frac{3n}{\delta}\right\rceil\right\rceil and ln⁡2<3/4\ln2<3/4 imply Tε2512≥2532⌈log⁡3nδ⌉≥ln⁡3nδ\frac{T\varepsilon^2}{512}\geq\frac{25}{32}\left\lceil\log\frac{3n}{\delta}\right\rceil\geq\ln\frac{3n}{\delta}.

For a fixed ii, the differences ξt=E[gt,i∣Ft−1]−gt,i\xi_t=\mathbb{E}[g_{t,i}\mid\mathcal{F}_{t-1}]-g_{t,i} have conditional mean zero and conditional range of length five by Eq. (7). Apply Lemma 3.6 with c=5c=5 and s=5ε/32s=5\varepsilon/32 to bound the probability that the first inequality fails for this ii by exp⁡(−Tε2/512)≤δ/(3n)\exp(-T\varepsilon^2/512)\leq\delta/(3n). A union bound over i∈[n]i\in[n] gives failure probability at most δ/3\delta/3.

By Lemma 3.5, D^t,i−Dt,i\widehat{D}_{t,i}-D_{t,i} has conditional mean zero, and its conditional range has length four by Eq. (7). Apply both tails of Lemma 3.6 with c=4c=4 and s=ε/8s=\varepsilon/8 to bound the probability that the second inequality fails for this ii by 2exp⁡(−Tε2/512)≤2δ/(3n)2\exp(-T\varepsilon^2/512)\leq2\delta/(3n). A union bound over i∈[n]i\in[n] gives failure probability at most 2δ/32\delta/3.

Combining the two failure probabilities proves the simultaneous guarantee.

Combining Lemmas 3.4, 3.5 and 3.7 gives the following corollary.

Corollary 3.8. With probability at least 1−δ1-\delta, the following inequalities hold simultaneously for every i∈[n]i \in[n]:

D‾i≤dTV(P,Hi)+3ε8,∣D^i−D‾i∣≤ε8.\overline{D}_i \le d_{\mathrm{TV}}(P,H_i) + \frac{3\varepsilon}{8}, \qquad\left|\widehat{D}_i-\overline{D}_i\right| \le\frac{\varepsilon}{8}.

Proof of Corollary 3.8. On the event of Lemma 3.7, for every i∈[n]i \in[n], we already have the second inequality ∣D^i−D‾i∣≤ε8\left|\widehat{D}_i-\overline{D}_i\right| \le\frac{\varepsilon}{8}. The first inequality follows from the following chain of inequalities:

D‾i≤D^i+ε8≤1T∑t=1TE[gt,i∣Ft−1]+dTV(P,Hi)+ε8≤1T∑t=1Tgt,i+5ε32+dTV(P,Hi)+ε8≤dTV(P,Hi)+3ε8.\begin{aligned} \overline{D}_i \\ &\le\widehat{D}_i+\frac{\varepsilon}{8} \\ &\le\frac{1}{T}\sum_{t=1}^{T}\mathbb{E}[g_{t,i}\mid\mathcal{F}_{t-1}]+d_{\mathrm{TV}}(P,H_i)+\frac{\varepsilon}{8} \\ &\le\frac{1}{T}\sum_{t=1}^{T}g_{t,i}+\frac{5\varepsilon}{32}+d_{\mathrm{TV}}(P,H_i)+\frac{\varepsilon}{8} \\ &\le d_{\mathrm{TV}}(P,H_i)+\frac{3\varepsilon}{8}. \end{aligned}

Approximation guarantee

On the event in Corollary 3.8, which has probability at least 1−δ1-\delta. Fix i∗∈arg⁡min⁡idTV(P,Hi)i^* \in\arg\min_i d_{\mathrm{TV}}(P,H_i). Since the output index i^\widehat{i} minimizes the estimated average distance, the average distance between the median measures and the output distribution is bounded by

D‾i∗≤D^i∗+ε8≤D^i^+ε8≤D‾i∗+ε4≤OPT+5ε8.\overline{D}_{i^*} \le\widehat{D}_{i^*}+\frac{\varepsilon}{8} \le\widehat{D}_{\widehat{i}}+\frac{\varepsilon}{8} \le\overline{D}_{i^*}+\frac{\varepsilon}{4} \le\mathrm{OPT}+\frac{5\varepsilon}{8}.

where the first, third, and fourth inequalities follow from Corollary 3.8, and the second inequality follows from the definition of i^\widehat{i}. Moreover, the median measures are close to the best distribution on average, and thus close to the target distribution, since

1T∑t=1T12∥P−Ut∥1≤1T∑t=1T12(∥P−Hi∗∥1+∥Hi∗−Ut∥1)≤dTV(P,Hi∗)+D‾i∗\begin{aligned} \frac{1}{T}\sum_{t=1}^{T}\frac{1}{2}\lVert P-U_t\rVert_1 \le\frac{1}{T}\sum_{t=1}^{T}\frac{1}{2}\left(\lVert P-H_{i^*}\rVert_1+\lVert H_{i^*}-U_t\rVert_1\right) \\ &\le d_{\mathrm{TV}}(P,H_{i^*})+\overline{D}_{i^*} \end{aligned}
≤2OPT+3ε8.\le2\mathrm{OPT}+\frac{3\varepsilon}{8}.

where the last inequality uses Corollary 3.8. For every tt, use UtU_t as the intermediate measure in the triangle inequality:

dTV(P,Hi^)≤12∥P−Ut∥1+12∥Ut−Hi^∥1=12∥P−Ut∥1+Dt,i^.d_{\mathrm{TV}}(P,H_{\widehat{i}}) \le\frac{1}{2}\lVert P-U_t\rVert_1+\frac{1}{2}\lVert U_t-H_{\widehat{i}}\rVert_1 = \frac{1}{2}\lVert P-U_t\rVert_1+D_{t,\widehat{i}}.

Averaging the triangle inequality through TT rounds yields

dTV(P,Hi^)≤1T∑t=1T12∥P−Ut∥1+D‾i^d_{\mathrm{TV}}(P,H_{\widehat{i}}) \le\frac{1}{T}\sum_{t=1}^{T}\frac{1}{2}\lVert P-U_t\rVert_1+\overline{D}_{\widehat{i}}
≤2OPT+3ε8+OPT+5ε8=3OPT+ε.\begin{aligned} \le2\mathrm{OPT}+\frac{3\varepsilon}{8}+\mathrm{OPT}+\frac{5\varepsilon}{8} \\ &=3\mathrm{OPT}+\varepsilon. \end{aligned}

AI Disclosure

ChatGPT was used extensively during the preparation of this work. The author suggested using a pointwise median to obtain an improper distribution with approximation factor 2 on the lower-bound instance of [1]. Then, ChatGPT proposed combining weighted medians with multiplicative weight updates. ChatGPT and Claude also assisted with exposition and editing. The author takes full responsibility for the results, proofs, and references.

Finding the weighted median in linear time

The median-of-medians algorithm of Blum et al. [6] finds the kk-th smallest of nn values in deterministic O(n)O(n) time, without sorting all the values. We can adapt this algorithm to find the weighted median of nn values with positive weights in O(n)O(n) time, without sorting all the values, as shown below.

Lemma A.1. Given real values v1,…,vnv_1,\ldots,v_n with positive weights w1,…,wnw_1,\ldots,w_n, satisfying ∑i=1nwi=1\sum_{i=1}^{n} w_i = 1, the smallest input value whose cumulative weight is at least 1/21/2 can be found deterministically in O(n)O(n) worst-case time.

Proof of Lemma A.1. Initialize an active set A={1,…,n}A = \{1,\ldots,n\} and a residual target τ=1/2\tau= 1/2. Use the median-of-medians algorithm to select the ordinary median of the active values, i.e., find the ⌈∣A∣/2⌉\lceil|A|/2 \rceil-th smallest value. Write zz for its value, scan the active set and partition AA into

A<={i∈A:vi<z},A=={i∈A:vi=z},A>={i∈A:vi>z},A_{<} = \{i \in A : v_i < z\}, \qquad A_{=} = \{i \in A : v_i = z\}, \qquad A_{>} = \{i \in A : v_i > z\},

and compute WL=∑i∈A<wiW_L = \sum_{i\in A_{<}} w_i and WE=∑i∈A=wiW_E = \sum_{i\in A_{=}} w_i. Apply the following rules:

  1. If τ≤WL\tau\le W_L, retain A<A_{<} and leave τ\tau unchanged.

  2. If WL<τ≤WL+WEW_L < \tau\le W_L + W_E, return zz.

  3. If τ>WL+WE\tau> W_L + W_E, retain A>A_{>} and replace τ\tau by τ−WL−WE\tau- W_L - W_E.

These rules ensure that the active set always contains the smallest value whose cumulative weight is at least 1/21/2. Since zz represents the median value of the active set, each nonterminal step at least halves the active-set size, including in the presence of ties. Thus the procedure terminates after at most ⌈log⁡n⌉\lceil\log n \rceil steps. Finding the median, computing the cumulative weights, and partitioning take O(∣A∣)O(|A|) operations per step, for a total of

O(n)+O(n/2)+O(n/4)+⋯=O(n),O(n) + O(n/2) + O(n/4) + \cdots= O(n),

which is the desired worst-case bound.

References

  1. [1][AACS26] Anders Aamand, Maryam Aliakbarpour, Justin Y. Chen, and Sandeep Silwal. How fast can you find a good hypothesis? In Steve Hanneke and Tor Lattimore, editors, Proceedings of Thirty Ninth Conference on Learning Theory, volume 336 of Proceedings of Machine Learning Research, pages 1–2. PMLR, 29 Jun–03 Jul 2026. 1, 2, 12arxiv.org/abs/2509.03734
  2. [2][ABS24] Maryam Aliakbarpour, Mark Bun, and Adam Smith. Optimal hypothesis selection in (almost) linear time. Advances in Neural Information Processing Systems, 37:141490–141527, 2024. 1, 2DOI
  3. [3]Sanjeev Arora, Elad Hazan, and Satyen Kale. The multiplicative weights update method: a meta-algorithm and applications. Theory of computing, 8(1):121–164, 2012. 2, 8
  4. [4]Kazuoki Azuma. Weighted sums of certain dependent random variables. Tohoku Mathematical Journal, Second Series, 19(3):357–367, 1967. 10DOI
  5. [5]Olivier Bousquet, Mark Braverman, Gillat Kol, Klim Efremenko, and Shay Moran. Statistically near-optimal hypothesis selection. In 2021 IEEE 62nd Annual Symposium on Foundations of Computer Science (FOCS), pages 909–919. IEEE, 2022. 1arxiv.org/abs/2108.07880
  6. [6]Manuel Blum, Robert W. Floyd, Vaughan R. Pratt, Ronald L. Rivest, Robert Endre Tarjan, et al. Time bounds for selection. J. Comput. Syst. Sci., 7(4):448–461, 1973. 7, 12DOI
  7. [7]Olivier Bousquet, Daniel Kane, and Shay Moran. The optimal approximation factor in density estimation. In Conference on Learning Theory, pages 318–341. PMLR, 2019. 1arxiv.org/abs/1902.05876
  8. [8]Luc Devroye and Gábor Lugosi. Combinatorial methods in density estimation, volume 1. Springer, 2001. 1, 2
  9. [9]Wassily Hoeffding. Probability inequalities for sums of bounded random variables. Journal of the American statistical association, 58(301):13–30, 1963. 10
  10. [10]Satyaki Mahalanabis and Daniel Stefankovic. Density estimation in linear time. In Rocco A. Servedio and Tong Zhang, editors, 21st Annual Conference on Learning Theory - COLT 2008, Helsinki, Finland, July 9-12, 2008, pages 503–512. Omnipress, 2008. 1, 2arxiv.org/abs/0712.2869
  11. [11]Yannis G Yatracos. Rates of convergence of minimum distance estimators and kolmogorov’s entropy. The Annals of Statistics, 13(2):768–774, 1985. 1, 2DOI

Paper details

vlnc:W_qrvnp4uc
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 10

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

ChatGPT, Claude

View statement
Looking for related papers…
Contents