{'fraction_non_alphanumeric': 0.044713247797186585, 'fraction_numerical': 0.009255680939867058, 'mean_word_length': 4.15930615093211, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Detection of Correlations with Adaptive Sensing

The problem of detecting correlations from samples of a high-dimensional Gaussian vector has recently received a lot of attention. In most existing work, detection procedures are provided with a full sample. However, following common wisdom in experimental design, the experimenter may have the capacity to make targeted measurements in an on-line and adaptive manner. In this work, we investigate such adaptive sensing procedures for detecting positive correlations. It it shown that, using the same number of measurements, adaptive procedures are able to detect significantly weaker correlations than their non-adaptive counterparts. We also establish minimax lower bounds that show the limitations of any procedure.


Introduction
In this paper we consider a statistical testing problem related to anomaly detection: the detection of correlations between signals. In the general problem of anomaly detection, one aims to identify unexpected activity in data. It has applications in numerous domains [14], such as finance [9], computer security [21], health monitoring [29], or detection of activity in sensor networks [24,33,39]. In many situations, anomalies can be detected by looking at unusual signal values at any of the sensors. For instance, a home security alarm is usually comprised of various infrared or related sensors, and an alert is raised as soon as a single sensor detects an unusual signal. However, in other situations, when signals are "weak", they may never appear anomalous in isolation, and anomalies may only be detected when considering the signals together as a collection. This type of phenomena may be referred to as either contextual anomaly detection [35], or collective anomaly detection [34], depending on the setup. A prototypical example of such a problem is the detection of Distributed Denialof-Service (DDoS) attacks in computer networks, which has become an important challenge in recent years [32,37,40]. In a DDoS attack, the attacker usually controls a large number of computers distributed around the world. These machines are used to simultaneously send requests to a target server, which is then flooded by the amount of packets, and can become unavailable as a result. As a side effect, this type of attack can produce high volumes of traffic in various parts of the worldwide internet infrastructure. However, packets sent by the attacker through the machines that he/she controls cannot usually be detected as anomalous in isolation [27], and detection of DDoS requires to correlate signals obtained at different points in the network. Collective anomalies also appear, for instance, in the context of detection of the outbreak of diseases [28]. Another important type of anomaly detection problem appears when dealing with sensor data arranged on a two-dimensional grid (e.g., loop detectors in lanes of road networks, or wireless sensor networks [2]). In this case, collective anomalies may be characterised by neighbouring signals being correlated. Besides anomaly detection, detection of correlations is also of interest to assess to what extent dimensionality reduction can be performed on a data stream. Reduction of dimensionality is a workhorse of data analysis, and there has been a strong recent interest in modifying principal component analysis to deal with high-dimensional data [10,12,26]. Testing when this type of transformation is justified is thus an important problem.
In this work, we consider a simple correlation model: given multiple observations from a Gaussian multivariate distribution we want to test whether the corresponding covariance matrix is diagonal against non-diagonal alternatives. Such problems have recently received a lot of attention in the literature, where different models and choices of non-diagonal covariance alternatives were considered [4,5,10,12,20]. We consider the detection of sparse positive correlations, which has been treated in the case of a unique multivariate sample [4], or of multiple samples [5]. However, this paper deviates from the existing literature in that we consider an adaptive sensing or sequential experimental design setting. More precisely, data is collected in a sequential and adaptive way, where data collected at earlier stages informs the collection of data in future stages. Adaptive sensing has been studied in the context of other detection and estimation problems, such as in detection of a shift in the mean of a Gaussian vector [13,19], in compressed sensing [6,13,18], in experimental design, optimization with Gaussian processes [36], and in active learning [15]. Adaptive sensing procedures are quite flexible, as the data collection procedure can be "steered" to ensure most collected data provides important information. As a consequence, procedures based on adaptive sensing are often associated with better detection or estimation performances than those based on non-adaptive sensing with a similar measurement budget. In this paper, our objective is to determine whether this is also the case for detection of sparse positive correlations, and if so, to quantify how much can be gained.
Our main goal is to solve the hypothesis testing problem where C is some class of non-empty subsets of {1, . . . , n}, each of size k. In other words, under the alternative hypothesis, there exists an unknown subset S ∈ C such that corresponding components are positively correlated with strength ρ > 0. We often refer to the elements of S as the subset of contaminated coordinates. The model of correlations we consider appears naturally in the problem of detecting a sparse signal embedded in noise. Indeed, with (Y t i ) and N t being independent standard normal random variables, and for some S ∈ C, then the vectors U t are independent multivariate zero-mean normal vectors with covariance matrix Σ S . The variable N t represent a common signal present at each contaminated coordinate and Y t i the additive white noise. In all cases we assume that the cardinality of each S ∈ C is the same: |S| = k. We consider the following types of classes C for the contaminated coordinates: • k-intervals: all sets of k contiguous coordinates, of the form {z, z + 1, . . . , z + k − 1} for some 1 ≤ z ≤ n − k + 1; this class has size linear in n, and we denote it by C [k] .
• k-sets: all subsets of {1, . . . , n} of cardinality k. We denote this class by C k .
In addition, it is of interest for applications to consider settings where the coordinates {1, . . . , n} are laid out according to a two-dimensional grid [n 1 ]×[n 2 ] with n 1 n 2 = n, similarly to a spatially arranged array of sensors. Although k-sets still make sense in this setting, the contaminated set can be further assumed in this case to be connected and spatially localized in some sense. The following example is most intuitive: • (k 1 , k 2 )-rectangles: for k 1 k 2 = k, this comprises all sets of the form Results for rectangles or similar two-dimensional shapes can be obtained easily from our results for k-intervals, and are identical up to constants. We omit the rather straightforward details here. For any t = 1, 2, . . . denote by P ∅ the distribution of U t under the null, and by P S the distribution under the alternative with contaminated set S ∈ C. In addition, for a positive integer q, we denote by P ⊗q the product measure P ⊗ . . . ⊗ P with q factors. As previously, we let [q] = {1, . . . , q}.

Adaptive vs. Non-Adaptive Sensing and Testing
Clearly, the above hypothesis testing problem would be trivial if one has access to an infinite number of i.i.d. samples (U t ) t∈{1,...,∞} . Therefore, one must include some further restrictions on the data that is made available for testing. In particular, we only consider testing procedures that make use of at most M entries of the matrix (U t i ) t∈{1,...,∞},i∈ [n] . It is useful to regard this as a matrix with n columns and an infinite number of rows.
The key idea of adaptive sensing is that information gleaned from previous observations can be used to guide the collection of future observations. To formalize this idea consider the following notation: for any subset A ⊆ [n] we denote by |A| the cardinality of A. When A is nonempty we write U A = (U i ) i∈A ∈ R |A| for the subvector of a vector U ∈ R n indexed by coordinates in A. Finally, if U is a random variable taking values in R n denote by P| A the distribution of U A .
Let S ∈ C ∪ {∅} be the set of contaminated coordinates, and M ≥ 2 be an integer. In our model we are allowed to collect information as follows. We consider successive rounds. At round t ∈ N, one chooses a non-empty query subset A t ⊆ [n] of the components, and observes U t A t . To avoid technical difficulties later on, we define the observation made at time t as X t , so that X t A t = U t A t and X t [n]\A t = 0. In words, one observes the A t coordinates of U t , while the remaining coordinates are completely uninformative. Each successive round proceeds in the same fashion, under the requirement that the budget constraint is satisfied. Note that clearly, the number of rounds is not larger than M . Again, to avoid technical difficulties we assume the total number of rounds to be M in what follows, even if this means A t = ∅ for some values of t. See Figure 1 for an illustration. In our setting, one can select the query sequence randomly and sequentially, and hence, we write the query sequence (a 1 , . . . , a M ) as a realization of a sequence (A 1 , . . . , A M ) of M random subsets of [n], some of which may be empty, and such that M t=1 |A t | ≤ M . A key aspect of adaptive sensing is that the query at round T may depend on all the information available up to that point. We assume A t can depend on the history at time t−1, which we denote by H t−1 = (A j , X j ) j∈[t −1] . More precisely, we assume A t is a measurable function of H t−1 , and possibly of additional randomization. We call the collection of all the conditional distributions of A t given H t−1 for t ∈ [M ] the sensing strategy. In particular, if there is no additional randomization, A t is a deterministic function of H t−1 . We denote the set of all possible adaptive sensing strategies with sensing budget M as AS(M ).
At this point, it is important to formally clarify what is meant by non-adaptive sensing. This is simply the scenario where . In other words, all the decisions regarding the collection of data must be taken before any observations are made. The collection (A t ) t∈[M ] is known as a non-adaptive sensing strategy. A natural and important choice is uniform sensing, where A t = [n] for t = 1, . . . , M/n (assume M is divisible by n). In words, one collects m = M/n i.i.d. samples from P S . This problem has been thoroughly studied in [4]; we summarize some of the main results of [4] in Section 1.3. Now that we have formalized how data is collected, we can perform statistical tests. Formally, a test is a measurable binary function φ : H M → φ(H M ) ∈ {0, 1}, that is, a Figure 1: Adaptive sensing over a two dimensional grid of sensors. The figure illustrates how information can be obtained within the sensing model for n = 40 and k = 6, under the alternative hypothesis with S being a (2, 3)-rectangle in a 8 × 5 grid. The correlated coordinates form a clique in the graph of correlations, and this is shown through light edges. At every step, the experimenter selects coordinates to be sensed, and these are shown circled. At the first step, the experimenter samples all the coordinates, while at the two subsequent steps, the experimenter reduced the amount of coordinates sampled. This corresponds to a total budget of |A 1 | + |A 2 | + |A 3 | = 40 + 22 + 13 = 75 coordinate measurements.
binary function of all the information obtained by the (adaptive or non-adaptive) sensing strategy. The result of the test is φ(H M ), and if this is one we declare the rejection of the null hypothesis. Finally, an adaptive testing procedure is a pair (A, φ) where A is a sensing strategy and φ is a test.
For any sensing strategy A and S ∈ C, define P A ∅ (resp. P A S ) as the distribution under the null (resp. under the alternative with contaminated set S) of the joint sequence (A 1 , X 1 , . . . , A M , X M ) of queries and observations. The performance of an adaptive testing procedure (A, φ) is evaluated by comparing the worst-case risk to the corresponding minimax risk R * AS = inf A∈AS(M ),φ R(A, φ), where the infimum is over all adaptive testing procedures (A, φ) with a budget of M coordinate measurements. The minimax risk R * AS depends on M , although we do not write this dependence explicitly for notational ease.
Let m = M/n be the equivalent number of full vector measurements. In the following, we will just say m measurements for simplicity. This change of parameters allows for easier comparison with the special case of uniform sensing, where a full vector of length n is measured m times. In particular, when m = M/n is an integer, uniform sensing corresponds to the deterministic sensing procedure with A t = [n] for t ∈ [m], A t = ∅ for t > m, and for S ∈ C ∪ {∅}. We are interested in the high-dimensional setting, where the ambient dimension n is high. All quantities such as the correlation coefficient ρ, the contaminated set size k, and the number of vector measurements m will thus be allowed to depend on n. In particular, we always assume that n, k and m all go to infinity simultaneously, albeit possibly at different rates, and our main concern is to identify the range of parameters in which it is possible to construct adaptive tests whose risks converge to zero. We consider the sparse regime where k = o(n). Although the case of fixed ρ is of interest, most of our results will be concerned with the case where ρ converges to zero with n. When ρ = 1, the problem is trivial as detecting duplicate entries in a single sample vector from the distribution allows one to perform detection perfectly, while for fixed ρ < 1, the problem essentially becomes easier as the measurement budget m increases.

Uniform Sensing and Testing
The simplest and most-natural type of non-adaptive sensing strategy we can consider is uniform sensing. As stated before, this corresponds to the choice A t = [n] for t = 1, . . . , m (recall that m = M/n), that is one collects m i.i.d. samples from P S . The minimax risk and the performance of several uniform sensing testing procedures have been analyzed in [4]. The authors of that work analyzed the performance of tests based on the localized squared sum statistic which was shown to be near-optimal in a variety of scenarios. The localized squared sum test that rejects the null hypothesis when T loc exceeds a properly chosen threshold was shown to have an asymptotically vanishing risk when, for some positive constant c, This condition was shown to be near-optimal in most regimes for the classes of k-sets and kintervals, unless k exceeds √ n. In this latter and rather easier case, the simple non-localized squared sum statistic T s = m t=1 ( n i=1 X t i ) 2 is near optimal. From (2), it is easy to see that the size of the class plays an important role, as a smaller class C leads to a weaker sufficient condition for detection. In particular, the localized squared sum test has asymptotically vanishing risk when Necessary conditions for detection almost matching the previous sufficient conditions have been derived in [4]. Although the dependence on the ambient dimension n is only logarithmic, this can still be significant in regimes where n is large but m is small.

Related Work
A closely related problem is that of detecting non zero mean components of a Gaussian vector X, referred to as the detection-of-means problem. This problem has received ample attention in the literature, see, for instance, [1,7,8,16,17,22,23] and references therein. The detection-of-means problem can be formulated as the multiple hypothesis testing problem where 1 S is the indicator vector of S, I n is the identity matrix, and µ = 0. In other words, one needs to decide whether the components of X are independent standard normal random variables or they are independent normals with unit variance, and there is a (unknown) subset S of k components that have non-zero mean. The set of contaminated components S is assumed to belong to a class C of subsets of [n]. The behavior of the minimax risk has been analyzed for various class choices C [1,7,11,22]. Detection and estimation in this model has been analyzed under adaptive sensing in [13,19], where it is shown that, perhaps surprisingly, all sufficiently symmetric classes C lead to the same almost matching necessary and sufficient conditions for detection. This is quite different from the non-adaptive version of the problem where size and structure of C influence, in a significant way, possibilities of detection (see [1]).
Recall that the correlation model of Section 1.1 can be rewritten as for some S ∈ C, with (Y t i ), N t independent standard normals, and that, as a consequence, the correlation model can be seen as a random mean shift model, with a slightly different normalization. However, most results on adaptive sensing for detection-of-means heavily hinge on the independence assumption between coordinates, which is not applicable for the detection of correlations. In particular, we shall see that the picture is more subtle in the presence of correlations.
A second problem, perhaps even more related, is that of detection in sparse principal component analysis (sparse PCA) within the rank one spiked covariance model, defined as the testing problem for some u ∈ R n with u 0 = k, u 2 = 1, where u 0 is the number of nonzero elements of u, and u 2 is the Euclidean norm of u. There is, also for this problem, a growing literature, see [10,12,26]. Note that when the coordinates of u are constrained in {0, 1/ √ k}, we recover a problem akin to that of detection of positive correlations, but with unnormalized variances over the contaminated set. The related problem of support estimation has been considered in [3] under the similar assumption that coordinates of u are constrained in 0, ±1/ √ k .

Results and Contributions
The main contribution of this paper is to show that adaptive sensing procedures can significantly outperform the best non-adaptive tests for the model in Section 1.1. We tackle the classes of k-intervals and k-sets. For k-intervals, necessary and sufficient conditions are almost matching. In particular, the number of measurements m necessary and sufficient to ensure that the risk approaches zero has almost no dependence on the signal dimension n. This is in stark contrast with the non-adaptive sensing results, where it is necessary for m to grow logarithmically with n.
For k-sets, we obtain sufficient conditions that still depend logarithmically in n, but which improve nonetheless upon uniform sensing in some regimes. Although not uniform, the proposed sensing strategy is still non-adaptive. In addition to this, in a slightly different model akin to that of sparse PCA mentioned above, we show that all previous results (both non-adaptive and adaptive) carry on, and we obtain a tighter sufficient condition for detection of k-sets, that is nearly independent of the dimension n, and also improves significantly over non-adaptive sensing. Our results are summarized in Table 1. The paper is structured as follows. We obtain a general lower bound in Section 2, and study various classes of contaminated sets. In Section 3, we propose procedures for k-sets and k-intervals. In Section 4, we prove a tighter sufficient condition under a slightly different model, for k-sets. Finally, we conclude with a discussion in Section 5.

Notation
We denote by E P the expectation with respect to a distribution P. The Kullback-Leibler (KL) divergence between two probability distributions P and Q such that P is absolutely continuous with respect to Q is KL(P || Q) = E P [log (dP/dQ)], with dP/dQ the Radon-Nikodym derivative of P with respect to Q. When P and Q admit densities f and g, respectively, with respect to the same dominating measure, we write KL(P || Q) = KL(f || g).
We denote by 1 A the indicator function of an event or condition A.

Lower bounds
We say that a sequence z = (a 1 , Consider an adaptive testing procedure (A, φ), with query sequence (A 1 , . . . , A M ) ∈ 2 [n] M , and (X 1 , . . . , X M ) ∈ (R n ) M the corresponding sequence of observations. Let S ∈ C ∪ {∅} be the set of contaminated coordinates. For t ∈ [M ], we denote by f A t | H t−1 (· | h t−1 ) the probability mass function of A t given H t−1 = h t−1 , and by f X t | A t ; S (·|a t ) the density of X t | A t = a t over R n with respect to a suitable dominating measure over R n (e.g., the product of the Lebesgue measure and a point mass at 0). Therefore, the joint sequence Z = (A 1 , X 1 , . . . , A M , X M ) admits a density f S with respect to some appropriate dominating measure. For any M -admissible sequence (a 1 , x 1 , . . . , a M , x M ), this density factorizes as For concreteness, let the density f S be zero on any joint subsequence that is not Madmissible. It is crucial to note that all the terms in the factorization corresponding to the sensing strategy (i.e., corresponding to the selection of A t given the history) do not depend on S. This is central to our arguments, as likelihood ratios simplify. More precisely, for any M -admissible sequence (a 1 , where the second equality follows from the sensing model. Likelihood ratios play a crucial role in the characterization of testing performance. In particular, a classical argument (see, e.g., [38,Lemma 2.6]) shows that, for any distributions P, Q over a common measurable space Ω and any measurable function φ : Ω → {0, 1}, Therefore This entails that the minimax risk under adaptive sensing can be lower bounded by upper bounding the maximin KL divergence. Here, in order to bound the maximum KL divergence, we will take an approach similar to [13] for detection-of-means under adaptive sensing, although our setup differs slightly. In [13], the testing procedures measure a single coordinate at a time, while we need multiple measures per step in order to capture correlations. We have the following necessary condition.
Theorem 1. Let C be either the class of k-sets or k-intervals or disjoint k-intervals, and define , ρ 2 (k + 1) .
Then the minimax risk R * AS of adaptive testing procedures with a measurement budget of M = mn coordinates is lower bounded as As a consequence, for the risk R * AS to converge to zero, it is necessary that mkD(ρ, k) → ∞.
Proof. First remark the following: for ρ ≤ 1/2, and for any A ⊆ [n], The proof is given in Appendix 6.2. The KL divergence between the joint probability models can we written as Define the class complexity For any sensing strategy A, it holds that From [13, Lemma 3.1], we conclude that, for the both classes C k and D [k] , respectively k-sets and disjoint k-intervals we have C(C k , M ) = C(D [k] , M ) = M k n = mk (assuming without loss of generality for disjoint k-intervals that n/k is an integer 1 ). As C(·, M ) is decreasing with respect to set inclusion for any fixed M , C(C [k] , M ) = mk as well, and the result follows.
The lower bound argument in Theorem 1 yields the same lower bound for detection using any of the three classes of interest. This phenomenon is akin to what was observed in the context of detection-of-means under adaptive sensing, where the lower bounds are the same provided the classes of contaminated components are symmetric. In this setting, it was shown in addition in [13] that the condition in the lower bound is essentially sufficient and therefore, unlike in the non-adaptive counterpart of the problem, knowledge of the structure of C does not make the detection problem any easier. However, the problem of detection of correlations considered here seems to be more subtle in that one lacks matching upper bounds for all cases. Namely, we do not know whether: (a) for detection-of-correlations structure does not help; or (b) the lower bound is loose for some classes, in particular the class of k-sets.
Recall that we are interested in the characterization of the regimes for which the risk R * AS converges to zero as m, k, n → ∞. Clearly, if ρ decays at a rate no faster than 1/k, the previous necessary condition for the risk to vanish asymptotically is always satisfied. Nevertheless, the lower bound gives an indication about the rate at which the risk converges to zero. However, when ρ = o (1/k) the situation is different, and Theorem 1 leads to the following necessary condition. Corollary 1. Let C denote either the class of k-sets, k-intervals or disjoint k-intervals, and suppose ρ = o (1/k). For R * AS to converge to zero it is necessary that ρk Proof. From the previous results, it is necessary that , ρ 2 (k + 1) goes to infinity for the risk to converge to zero. This quantity is asymptotically equivalent to mρ 2 k 2 , and mρ 2 k 2 → ∞ if and only if ρk √ m → ∞.
Recall that a sufficient condition for non-adaptive detection of k-intervals with the localized squared sum test is ρk √ m > c log(n) and ρkm > c log(n).
When ρ = o(1/k) one has, asymptotically, ρk < 1 and the first condition is stronger than the second. Non-adaptive detection with k-intervals is thus possible asymptotically for ρk √ m > c log(n). This corresponds to the condition of Corollary 1 up to a logarithmic factor in n, which implies that in the case of k-intervals, one can improve at most by a factor logarithmic in n with adaptive sensing. This can be still quite significant, and we show in Section 3 that this can indeed be achieved.

Adaptive tests 3.1 The Case of k-intervals
In this section, we study the case of the class C [k] of intervals of length k. It is sufficient to work with the class D [k] of disjoint intervals for the following reason: assume that one has a procedure for detection of disjoint k-intervals. Then, for detection of general k-intervals, this procedure can be applied as if the objective was detection of disjoint k/2-intervals. Indeed, if S is any k-interval, there exist at most two sets in D [k/2] that intersect S, and at least one of them, say S , has a full intersection with S, i.e., |S ∩ S | = k/2. As a consequence, under mild conditions on the procedure, this leads to a sufficient condition for detection of kintervals identical up to constants to that associated with the original procedure for disjoint k-intervals. Since up to two of the disjoint intervals can contain contaminated coordinates, the theoretical analysis still has to be slightly amended, but these technical modifications are straightforward for the methods that we propose. To keep the presentation simple, we only show how to perform detection in the case of disjoint k-intervals.
Recall that D [k] = {I 1 , . . . , I n/k }, where I j = {(j − 1)k + 1, . . . , jk} for j ∈ [ n/k ]. For simplicity, we assume that n/k is an integer. As the intervals are disjoint, the problem is equivalent to n/k independent hypothesis testing problems, each of them over vectors in R k that are mutually independent. Formally, this can be cast as a testing problem over a matrix Z ∈ R n k ×k , where Z has independent standard Gaussian entries except under the alternative where Z has a single row whose entries are mutually correlated standard Gaussian random variables with correlation ρ. In this framework, each row corresponds to one of the n/k disjoint k-intervals.
In the context of support recovery from signals with independent entries using adaptive sensing, [30,31] have proposed the sequential thresholding (ST) procedure, which is based on an intuitive bisection idea. Although initially introduced for support estimation, ST can be easily adapted to detection, and we present such results here. In addition, we present a slight generalization to signals with independent vector entries, which will allow us to apply the modified procedure to the disjoint k-intervals problem. We will also use the original ST procedure in Section 4.2, and for this reason, we first present the method using general notations here. Let Q 0 and Q 1 be two probability distributions over Rd, and let Z ∈ Rñ ×d be a random matrix. Consider the multiple testing problem defined as follows. Under the null, Z has rows identically distributed according to Q 0 . Under the alternative, a small unknown subset ofk rows of Z are distributed according to Q 1 , while the remaining rows are distributed according to Q 0 . In both cases, all rows are independent. More formally, denote by Z 1 , . . . , Zñ the rows of Z, such that the testing problem is for some S ∈ C with |S| =k, where, as already mentioned, all rows are independent in both cases. We refer to this testing problem as that of detection from signals with independent (vector) entries. The framework of adaptive sensing introduced in Section 1.2 can be easily adapted to this model. In this case, in order to allow for vector entries, we consider that the experimenter is allowed to obtain samples from rows of Z, and that he can select which rows to query in a sequential manner as previously, under the constraint that the total number of rows measured be less than M . We also refer to this straightforward extension as adaptive sensing, and we say thatm = M/ñ is the number of measurements (i.e.,m is the equivalent number of times the full matrix Z was observed). Sequential thresholding is a procedure for testing with adaptive sensing within the type of model just mentioned. Assume that Q 0 and Q 1 admit densities f 0 and f 1 , respectively, with respect to some common dominating measure, and for i ∈ [n], denote by the likelihood ratio associated to i.i.d. observations z 1 i , . . . , zm i ∈ Rd of Z i , the i-th row of Z. ST proceeds as outlined in Figure 3. Initially, ST measures allñ rowsm =m/4 times, and throws away a fraction (of about half under the null) of theñ rows based on the values of the likelihood ratios. This is repeated with the remaining rows a number of times logarithmic iñ n, at which point ST calls detection if some coordinates have not been thrown away. This is illustrated in Figure 2.
The following result is easily deduced from the analysis of ST for support estimation.

Proposition 1 (Sufficient condition for ST).
Assumek/ñ → 0, and then the sequential thresholding procedure with a budget ofm measurements has risk tending to zero asñ goes to infinity.
Proof. We begin by showing that the event of termination upon K r=0 |S r | >ñ has an asymptotically vanishing probability. Assume the alternative hypothesis with contaminated set S. Then, similarly as in [13, Proposition 4.1], using Bernstein's inequality for sums of truncated hypergeometric variables, Here, z 1 1 , . . . , zm 1 denote without loss of generality observations of the first row, as rows are exchangeable under the null. which converges to zero. The application of the Chernoff-Stein lemma as in [30] allows us to bound the probability of error as follows. The type I error of the procedure is bounded bỹ n −k 2 K . Let E i,t denote the event that the likelihood ratio is below γ for coordinate i at step t (in which case, coordinate i will not be included in S t ). Without loss of generality, assume that 1 ∈ S. The type II error is We write a . = e −mD for limm →∞ log ā m = D. From the Chernoff-Stein lemma, Hence, for K = (1 + ε 1 ) log 2 n and ε 2 > 0, there existsm 0 such that form ≥m 0 , the type II error is bounded by Hence, the risk goes to zero if for some ε 1 , ε 2 > 0, it holds that As a consequence, for the risk to go to zero, it is sufficient that The result follows by substitutingm withm 4 .
We now show how the previous procedure can be used for adaptive detection with disjoint k-intervals. As before, we assume that n/k is an integer. Defineñ = n/k,k = 1,m = m, andd = k. Let Q 0 = P 0 | I 1 be the joint probability distribution over an interval under the null, and Q 1 = P S | S be the joint probability distribution over the contaminated interval under the alternative with contaminated interval S ∈ D [k] . Here, the choice of the interval used in Q 0 does not matter, as intervals are exchangeable under the null hypothesis. We refer to the corresponding sequential thresholding procedure as ST for disjoint k-intervals. This procedure is illustrated in Figure 4. This provides the following sufficient condition for detection of disjoint k-intervals.
Proposition 2. Assume that ρ converges to zero. There exists numerical constants C 3 and C 4 such that, when either ρk → ∞ and m log(1 + ρk) ≥ C 3 log log(n/k), or ρk → 0 and ρk √ m ≥ C 4 log log(n/k), the sequential thresholding procedure for disjoint k-intervals has risk converging to zero.
Proof. The detailed computations can be found in Appendix 6.3. Assume that ρk > 1, then Similarly, when ρk < 1/2 and k > 32, Combined with Proposition 1, this gives the desired result.
Consider the case where ρk → ∞. In that case, omitting constant factors, sequential thresholding would succeed for m ≥ log log(n) log(1+ρk) . Recall that uniform non-adaptive testing is possible for m ≥ c log n ρk . When ρk > log(n) asymptotically, both conditions are trivially satisfied for m constant, while when ρk < log(n), we already improve upon non-adaptive tests. In spite of this, the dependence on ρk of our sufficient condition when ρk → ∞ is logarithmic, while it is only linear for ρk → 0. This may appear surprising, as one may argue the former case corresponds to a regime where the signal is stronger (and so the problem should be easier). However, this surprising fact is solely an artifact from the sequential thresholding procedure, and from the fact that ST does not require knowledge of k. This results in a sufficient condition that is independent of k. In particular, it does not become easier to satisfy as k increases, but it can be fixed through a small modification of the sensing methodology that we present in the following.
In order to recover the same linear dependence in both cases, we propose to add a subsampling stage prior to sequential thresholding. This subsampling can be decided before any data is collected, and thus can be viewed as a non-adaptive aspect of the entire procedure. Consider the simple deterministic subsampling scheme wherein one keeps the first p coordinates per interval, for some p ∈ {2, . . . , k}, and measures each p-tuple mn pn/k = mk p times. This prompts the following question: is there a value of p that allows one to detect more easily? Define the p-truncated intervals as I p j = {(j − 1)k + 1, . . . , (j − 1)k + p} for j ∈ [n/k]. Formally, we consider the deterministic sensing strategy A p = (A t ) where for t ∈ mk p , A t = j∈[n/k] As this involves one simple testing problem per interval, the difficulty of testing is essentially characterized by the KL divergence KL(P Ap 0 || P Ap S ) between the distributions under the null and the alternative. In this section, we make explicit the dependence of P S on p by using the notation P p S . Consider any fixed S ∈ D [k] , then the best KL divergence that can be obtained is max p∈{2,...,k} which is independent of S . Due to nonlinearity in the KL divergence the optimal value of p is generally different than k, as illustrated in Figure 5. The optimal p and corresponding optimal value seem hard to compute analytically, but numerical evidence shows that, for ρ away from zero, the optimal p is of the order of ρ −1 . This observation is sufficient for our purposes, and is formalized below. Remark that when ρk < 1, the optimal value of p is clamped to k. Equipped with this subsampling stage when ρk → ∞, we can now modify the ST for k-intervals procedure as follows: when ρk → ∞, setm = mk p ,d = 1 ρ , and use only observations corresponding tod coordinates per interval. We refer to this new procedure as the modified sequential thresholding for disjoint k-intervals.
Proposition 3. Assume that ρ converges to zero. There exists numerical constants C 5 and C 6 such that, when either ρk → ∞ and ρkm ≥ C 5 log log(n/k), or ρk → 0 and ρk √ m ≥ C 6 log log(n/k), the modified sequential thresholding procedure for disjoint k-intervals has risk converging to zero.
Proof. We have the following straightforward new lower bound: with p = 1 ρ , when ρk > 1, we have 1 ρ < k + 1, and as a consequence, Although the lower bound appears weaker than previously, this corresponds to a setting where more measurements can be carried out. The sufficient condition for ST leads to the result.
The adaptive procedure allows us to obtain a mild dependence on the original dimension n of the problem. When ρ = o(1/k), this sufficient condition almost matches the lower bound of Corollary 1, while when ρk → ∞, the sufficient condition is already satisfied for m = log log(n/k).

The Case of k-sets: Randomized Subsampling
In this section, we consider the class C k of k-sets. In this case, we do not currently know whether a procedure along the lines of ST can be successfully applied. However, the idea of subsampling the coordinates can still be used to yield modest but important performance gains. While for disjoint k-intervals a deterministic subsampling was sufficient, this is not the case for k-sets, where any deterministic subsampling that selects less than about n − k coordinates cannot have risk converging to zero. For this reason, we consider a randomized subsampling of the coordinates.
Consider a sample B of 2np k elements drawn without replacement from [n] for some p ≥ 2. Let θ : R 2np/k → {0, 1} be the localized squared sum test with ambient dimension 2np k , and contaminated sets C = C p of size p , and consider the sensing strategy defined by We refer to the adaptive sensing procedure ((A t ), θ) as the randomized testing procedure. Define Y = |B ∩ S| (resp. Y = 0) under the alternative with contaminated S ∈ C k (resp. under the null), which is the number of contaminated elements in the subsample. Clearly Y is a hypergeometric random variable with expectation k n 2n k p ∈ [2p − k/n, 2p]. In words, we consider a subsample of the coordinates, with about 2p contaminated coordinates (in expectation) under the alternative, and we apply the (non-adaptive) localized squared sum test.
Note that the procedure is strictly non-adaptive, as the subsampling can be decided in advance. However, this sensing strategy is a bit different than uniform sensing, as not all coordinates are measured. Nonetheless, this allows one to detect under weaker conditions than with uniform non-adaptive sensing when k is large enough. Proposition 4. Let 2 ≤ p ≤ k such that p goes to infinity. Assume that ρ converges to zero and that ρmk ≥ C 1 log 2pn for some constant C 1 , then the randomized testing procedure has risk converging to zero.
Proof. Let η I (resp. η II ) be the risk of type I (resp. of type II) for θ. The type I error of the randomized testing procedure is p I = η I . Let p + = P (Y ≥ p ) the probability of the sample containing at least p contaminated elements, and p − = 1 − p + . Note that since 2np k k n = 2p goes to infinity, we can assume that Y is distributed according to a Poisson distribution with parameter 2p, as this is asymptotically equivalent to the hypergeometric distribution.
, which converges to zero. The type II error of the randomized testing procedure is p II = p + η II + p − (1 − η I ) ≤ η II + p − . It remains to show that η I and η II both go to zero. This follows from the sufficient conditions for the localized squared sum test, and from p mk Hence, the sufficient conditions for the localized squared sum test θ provides the result.
In particular, for p = log log n, it is sufficient that, omitting constants, to ensure the detection risk converges to zero. This does not match the adaptive lower bound, and the dependence on n is still logarithmic. However, this already improves upon the setting of uniform non-adaptive sensing when k ≥ m log n . Indeed, recall that using uniform sensing, the sufficient condition is ρm ≥ log n, ρ √ mk ≥ log n.
The first condition is insensitive to subsampling, due to the dependence in mk, and we do not improve with respect to it. The second condition, however, only depends on m, and does not get easier to satisfy when k is large. Hence, our result shows that it is more efficient when k is large enough to reduce to a problem with an almost constant contaminated set size, but with an increased budget of full vector measurements.

Unnormalized correlation model 4.1 Model and Extensions of Previous Results
An alternative choice to the previous correlation model is the following unnormalized model with covariance matrix under the alternative with contaminated set S ∈ C. This model is a special case of the rank one spiked covariance model introduced in [25]. Observe that this correlation model can also be rewritten as with (Y t i ), N t independent standard normals. This can thus be interpreted as a random additive noise model, as for the model of Section 1.1. Observe that our original correlation detection model is obtained by normalizing each component such that the components have unit variance. This is a minor difference that does not essentially change the difficulty of detection in the non-adaptive setting (indeed all upper and lower bounds proved in [4] can be reproved for this model with minor modifications). Interestingly, however, under adaptive sensing the information provided by the higher variance in the contaminated components can be exploited to give a major improvement over the normalized model. This may be done by applying the sequential thresholding algorithm to the squares of the components as described below.
In the following, for any quantity X relative to the normalized model of Section 1.1, we denote byX the corresponding quantity related to the unnormalized model. All of previous results can be shown to hold for this model as well. As already mentioned, this includes the necessary and sufficient conditions of [4] (Proposition 10 in Appendix), but also the lower bound of Theorem 1 (Proposition 11 in Appendix), and sufficient conditions for k-sets and k-intervals of Propositions 4 and 3 (Proposition 13 in Appendix). In particular, the procedures associated to the sufficient conditions can be used with little modifications.

The case of k-sets
The procedure proposed below combines randomized subsampling with sequential thresholding, in order to capitalize on the unnormalized model. Consider the second moments Y i = X 2 i . Under the alternative with contaminated set S ∈ C, Y i is distributed as follows: (a) for i / ∈ S, Y i is distributed according to a chi-squared distribution with one degree of freedom (that we denote by χ 2 1 ), (b) for i ∈ S, Y i is distributed as (1 + ρ) χ 2 1 . Note that under our sensing model, it is perfectly legitimate to sample A 1 = {1}, . . . , A n = {n}, and thus obtain independent samples of each of the coordinates of the random vector. In particular, this allows us to obtain independent samples from the coordinates of Y . As a consequence, we can directly apply ST to detect increased variance over a subset of the coordinates. As already mentioned, ST does not require knowledge of k, which results in a sufficient condition that is independent of k. This condition can, however, be significantly weakened using the random subsampling used in last section. As in Proposition 4, this is due to the fact that by subsampling, one can increase the budget of full vector measurements, while the decrease in the contaminated set size does not impact the sufficient condition for detection. This is summarized in the following result, which can be proved similarly as Proposition 4.
Proposition 5 (Sufficient condition for ST+randomized subsampling). Assumek/ñ → 0, and then the sequential thresholding procedure with randomized subsampling (p = log log 2ñ ) and a budget of 4m full vector measurements has risk tending to zero asñ goes to infinity. Letñ = n,k = k, andm = m. Let Q 0 be the χ 2 1 distribution, and Q 1 be the (1 + ρ) χ 2 1 distribution, both with respect to Lebesgue's measure. We consider the associated sequential thresholding procedure (with randomized subsampling), with the previous modification of sampling independent single coordinates. We refer to this procedure as variance thresholding. This leads to the following sufficient condition for detection.
Proposition 6. Assume that ρ converges to zero and that ρ √ km ≥ C 2 log log 2 n for some constant C 2 . Then, the risk of the variance thresholding procedure converges to zero.
Proof. Let g be the density of a χ 2 1 -distributed random variable, such that the density of a (1+ρ)χ 2 1 -distributed random variable is given by 1 1+ρ g · 1+ρ . Then, using g(x) ∝ x −1/2 e −x/2 , As the expectation of a χ 2 1 -distributed random variable is one, this leads to Plugging this expression into the sufficient condition of Proposition 5 provides the result.
Assume for the following discussion that ρk → 0. The necessary condition that we have established previously is that ρk √ m goes to infinity. Neglecting the double log factor, the sufficient condition that we have just obtained is that ρ √ km goes to infinity, which is stronger. Hence, there is a gap between the sufficient and necessary condition. In particular, that ρk √ m goes to infinity was shown to be near-sufficient for detection with k-intervals, and the gap that we observe for k-sets does not allow us to conclude as to whether structure helps for detection (as is the case under non-adaptive sensing).
Recall that the unnormalized model is similar to that of detection in the problem of sparse PCA. The method of diagonal thresholding (also referred to as Johnstone's diagonal method) is a simple and tractable method for detection (and support estimation) in sparse PCA (with uniform non-adaptive sensing), which consists in testing based on the diagonal entries of empirical covariance matrix -that is, the empirical variances. Hence, it is similar to the method that we consider here, except that we estimate variances based on independent samples for each coordinate. Note that this last point is essential to our method. Indeed, consider the opposite case where we do not use independent samples for each coordinates. For the sake of illustration, assume ρ = 1, such that the contaminated components are exactly equal. In this case, the probability of throwing away one component is equal to that of throwing away all contaminated components, and failure will occur with fixed non small probability due to the use of dependent samples.
Finally, it is noteworthy that a naïve implementation of the optimal test in the nonadaptive setting has complexity O(n k ), while with adaptive sensing, we obtain a procedure that can be carried out in time and space linear in n, and still improves significantly with respect to the non-adaptive setting.

Discussion
We showed that for k-intervals, adaptive sensing allows one to reduce the logarithmic dependence in n of sufficient conditions for non-adaptive detection to a mild log log n, and that this is near-optimal in a minimax sense.
For k-sets, the story is less complete. The sufficient condition obtained in the unnormalized model is still stronger than the sufficient condition obtained for k-intervals, and does not match our common lower bounds, which leaves open the question of whether structure helps under adaptive sensing for detection of correlations? The analogous question for detection-ofmeans has a negative answer, meaning structure does not provide additional information for detection. However, for detection-of-correlations a definite answer is still elusive. Another open question is to what extent adaptive sensing allows one to overcome the exponential computational complexity barrier that one can encounter in the non-adaptive setting.
Aside from the normalized and unnormalized correlation models, other types of models can be considered. A more general version of our normalized model has been analyzed in [4], where the correlations need not be all the same, leading to results that involve the mean correlation coefficient ρ avg = i,j∈S : i =j (Σ S ) i,j / k(k − 1). In addition, we assume in most procedures that ρ and/or k are known, and it would be of interest to have procedures that do not require such knowledge.

.1 Inequalities and KL divergences
In this section, we collect elementary inequalities that we use repeatedly in the computations. For For x ≥ 1, log(1 + x) The following expression of the KL divergence is used throughout the paper.
Proposition 7. We have Proof. The KL divergence between P 0 and P S can be computed using the standard formula for KL divergence between two centered Gaussian vectors, with covariance matrices When k < 2, the divergence is zero, and we will thus assume k ≥ 2. Up to a simultaneous permutation of rows and columns, where J ρ (k) ∈ R k×k has unit diagonal and coefficients equal to ρ everywhere else. J ρ (k) is a symmetric matrix, hence diagonalizable, and has eigenvalues 1 − ρ with multiplicity k − 1 and 1 + (k − 1)ρ with multiplicity one. As a consequence, we have, for k ≥ 2, .
The KL divergence is thus

Proof of bound on KL divergence
Proof. First note since the KL divergences are independent of n, it is sufficient to use the expressions of Proposition 7 with a contaminated set of size s = |A ∩ S| ≤ k. As previously, we assume s ≥ 2, as the result is trivial otherwise. Consider the expression for the KL divergence given in (10). Using (3), we obtain KL(P 0 | A || P S | A ) = KL(P 0 || P S∩A ) .

Proof of Proposition 2
Proof. We have KL(Q 0 || Q 1 ) = kf (ρ) + h(ρ) with As previously, using (7), f (ρ) ≥ ρ 2 16 . Assume that ρk < 1 and k > 7, then using (5) and (7) 7 Extensions to unnormalized model 7.1 Uniform (non-adaptive) lower bound for detection of positive correlations Proposition 8. For any class C, any ρ ∈ [0, 0.9), the minimum risk in the normalized model (resp. the unnormalized model) under uniform (non-adaptive) sensing is bounded as where Z is the size of the intersection of two elements of C drawn independently and uniformly at random.
Proof. This is essentially a reproduction of the proof of [4] with minor modifications. The details are omitted.

Uniform (non-adaptive) upper bound for detection of positive correlations
Let Proof. This is proved in [4] for the normalized model. In the case of the unnormalized model, the test statistic is distributed as kχ 2 m under the null, and as (k(1 + ρ) + ρk(k − 1))χ 2 m under the alternative, which changes only mildly the proof with respect to the normalized model.
Proof. The KL divergence betweenP 0 andP S can be computed using the standard formula for KL divergence between two centered Gaussian vectors, with covariances matrices Σ 0 = I n , Σ 1 =Σ S .
Proposition 11. For any A ⊂ [n], Proof. First note since the KL divergences are independent of n, it is sufficient to use the expressions of Proposition 7 with a contaminated set of size s = |A ∩ S|. As previously, we assume s ≥ 1, as the result is trivial otherwise. Consider the unnormalized model, with KL divergence given in (12). Using (3), we obtain KL(P 0 | A ||P S | A ) = KL(P 0 ||P A∩S ) ≤ ρs 2 .
Combining these last two inequalities yields the desired result.
Proposition 12. Assume that ρ converges to zero. There exists numerical constants C 3 and C 4 such that, when either ρk → ∞ and m log(1 + ρk) ≥ C 3 log log(n/k), or ρk → 0 and ρk √ m ≥ C 4 log log(n/k), the sequential thresholding procedure for disjoint k-intervals has risk converging to zero.