<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Learning-based Support Estimation in Sublinear Time</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>2021</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10275616</idno>
					<idno type="doi"></idno>
					<title level='j'>International Conference on Learning Representations</title>
<idno></idno>
<biblScope unit="volume"></biblScope>
<biblScope unit="issue"></biblScope>					

					<author>Talya Eden</author><author>Piotr Indyk</author><author>Shyam Narayanan</author><author>Ronitt Rubinfeld</author><author>Sandeep Silwal</author><author>Tal Wagner</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[We consider the problem of estimating the number of distinct elements in a large data set (or, equivalently, the support size of the distribution induced by the data set) from a random sample of its elements. The problem occurs in many applications, including biology, genomics, computer systems and linguistics.  A line of research spanning the last decade resulted in algorithms that estimate the support up to ±εn from a sample of size O(log2(1/ε)·n/logn),  where n is the data set size. Unfortunately, this bound is known to be tight, limiting further improvements to the complexity of this problem.  In this paper we consider estimation algorithms augmented with a machine-learning-based predictor that, given any element,  returns an estimation of its frequency.   We show that if the predictor is correct up to a constant approximation factor, then the sample complexity can be reduced significantly, to log(1/ε)·n1−Θ(1/log(1/ε)).We evaluate the proposed algorithms on a collection of data sets, using the neural-network based estimators from Hsu et al, ICLR’19 as predictors. Our experiments demonstrate substantial (up to 3x) improvements in the estimation accuracy com-pared to the state of the art algorithm.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1">INTRODUCTION</head><p>Estimating the support size of a distribution from random samples is a fundamental problem with applications in many domains. In biology, it is used to estimate the number of distinct species from experiments <ref type="bibr">(Fisher et al., 1943)</ref>; in genomics to estimate the number of distinct protein encoding regions <ref type="bibr">(Zou et al., 2016)</ref>; in computer systems to approximate the number of distinct blocks on a disk drive <ref type="bibr">(Harnik et al., 2016)</ref>, etc. The problem has also applications in linguistics, query optimization in databases, and other fields.</p><p>Because of its wide applicability, the problem has received plenty of attention in multiple fields 1 , including statistics and theoretical computer science, starting with the seminal works of <ref type="bibr">Good and Turing Good (1953)</ref> and <ref type="bibr">Fisher et al. (1943)</ref>. A more recent line of research pursued over the last decade <ref type="bibr">(Raskhodnikova et al., 2009;</ref><ref type="bibr">Valiant &amp; Valiant, 2011;</ref><ref type="bibr">2013;</ref><ref type="bibr">Wu &amp; Yang, 2019)</ref> focused on the following formulation of the problem: given access to independent samples from a distribution P over a discrete domain {0, . . . , n -1} whose minimum non-zero mass<ref type="foot">foot_0</ref> is at least 1/n, estimate the support size of P up to &#177;&#949;n. The state of the art estimator, due to <ref type="bibr">Valiant &amp; Valiant (2011)</ref>; <ref type="bibr">Wu &amp; Yang (2019)</ref>, solves this problem using only O(n/ log n) samples (for a constant &#949;). Both papers also show that this bound is tight.</p><p>A more straightforward linear-time algorithm exists, which reports the number of distinct elements seen in a sample of size N = O(n log &#949; -1 ) (which is O(n) for constant &#949;), without accounting for the unseen items. This algorithm succeeds because each element i with non-zero mass (and thus mass at least 1/n) appears in the sample with probability at least 1 -(1 -1/n) N &gt; 1 -&#949;, so in expectation, at most &#949; &#8226; n elements with non-zero mass will not appear in the sample. Thus, in general, the number of samples required by the best possible algorithm (i.e., n/ log n) is only logarithmically smaller than the complexity of the straightforward linear-time algorithm.</p><p>A natural approach to improve over this bound is to leverage the fact that in many applications, the input distribution is not entirely unknown. Indeed, one can often obtain rough approximations of the element frequencies by analyzing different but related distributions. For example, in genomics, frequency estimates can be obtained from the frequencies of genome regions of different species; in linguistics they can be inferred from the statistical properties of the language (e.g., long words are rare), or from a corpus of writings of a different but related author, etc. More generally, such estimates can be learned using modern machine learning techniques, given the true element frequencies in related data sets. The question then becomes whether one can utilize such predictors for use in support size estimation procedures in order to improve the estimation accuracy.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Our results</head><p>In this paper we initiate the study of such "learning-based" methods for support size estimation. Our contributions are both theoretical and empirical. On the theory side, we show that given a "good enough" predictor of the distribution P, one can solve the problem using much fewer than n/ log n samples. Specifically, suppose that in the input distribution P the probability of element i is p i , and that we have access to a predictor &#928;(i) such that &#928;(i) &#8804; p i &#8804; b &#8226; &#928;(i) for some constant approximation factor b &#8805; 1.<ref type="foot">foot_1</ref> Then we give an algorithm that estimates the support size up to &#177;&#949;n using only</p><p>samples, assuming the approximation factor b is a constant (see Theorem 1 for a more detailed bound). This improves over the bound of <ref type="bibr">Wu &amp; Yang (2019)</ref> for any fixed values of the accuracy parameter &#949; and predictor quality factor b. Furthermore, we show that this bound is almost tight.</p><p>Our algorithm is presented in Algorithm 1. On a high level, it partitions the range of probability values into geometrically increasing intervals. We then use the predictor to assign the elements observed in the sample to these intervals, and produce a Wu-Yang-like estimate within each interval. Specifically, our estimator is based on Chebyshev polynomials (as in <ref type="bibr">Valiant &amp; Valiant (2011)</ref>; <ref type="bibr">Wu &amp; Yang (2019)</ref>), but the finer partitioning into intervals allows us to use polynomials with different, carefully chosen parameters. This leads to significantly improved sample complexity if the predictor is sufficiently accurate.</p><p>On the empirical side, we evaluate the proposed algorithms on a collection of real and synthetic data sets. For the real data sets (network traffic data and AOL query log data) we use neural-network based predictors from <ref type="bibr">Hsu et al. (2019)</ref>. Although those predictors do not always approximate the true distribution probabilities up to a small factor, our experiments nevertheless demonstrate that the new algorithm offers substantial improvements (up to 3x reduction in relative error) in the estimation accuracy compared to the state of the art algorithm of <ref type="bibr">Wu &amp; Yang (2019)</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1.1">RELATED WORK</head><p>Estimating support size As described in the introduction, the problem has been studied extensively in statistics and theoretical computer science.  <ref type="bibr">Onak &amp; Sun (2018)</ref> proved that Canonne and Rubinfeld's algorithm works as long as the probabilities accessed are accurate up to a (1 &#177; &#949; 3 )-multiplicative factor. However, this algorithm strongly relies on the probabilities being extremely accurate, and the predicted probabilities even being off by a small constant factor can cause the support size estimate to become massively incorrect. As a result, their algorithm is not robust to mispredicted probabilities, as our experiments show.</p><p>A different line of research studied streaming algorithms for estimating the number of distinct elements. Such algorithms have access to the whole data set, but must read it in a single pass using limited memory. The best known algorithms for this problem compute a (1 + &#949;)-approximate estimation to the number of distinct elements using O(1/&#949; 2 + log n) bits of storage <ref type="bibr">(Kane et al., 2010)</ref>. See the discussion in that paper for a history of the problem and further references.</p><p>Learning-based algorithms Over the last few years, there has been a growing interest in using machine learning techniques to improve the performance of "classical" algorithms. This methodology found applications in similarity search <ref type="bibr">(Wang et al., 2016;</ref><ref type="bibr">Sablayrolles et al., 2019;</ref><ref type="bibr">Dong et al., 2020)</ref>, graph optimization <ref type="bibr">(Khalil et al., 2017;</ref><ref type="bibr">Balcan et al., 2018)</ref>, data structures <ref type="bibr">(Kraska et al., 2018;</ref><ref type="bibr">Mitzenmacher, 2018)</ref>, online algorithms <ref type="bibr">(Lykouris &amp; Vassilvitskii, 2018;</ref><ref type="bibr">Purohit et al., 2018)</ref>, compressed sensing <ref type="bibr">(Mousavi et al., 2015;</ref><ref type="bibr">Baldassarre et al., 2016;</ref><ref type="bibr">Bora et al., 2017)</ref> and streaming algorithms <ref type="bibr">(Hsu et al., 2019;</ref><ref type="bibr">Jiang et al., 2019)</ref>. The last two papers are closest to our work, as they solve various computational problems over data streams, including distinct elements estimation in <ref type="bibr">Jiang et al. (2019)</ref> using frequency predictors. Furthermore, in our experiments we are using the neural-network-based predictors developed in <ref type="bibr">Hsu et al. (2019)</ref>. However, our algorithm operates in a fundamentally different model, using a sublinear (in n) number of samples of the input, as opposed to accessing the full input via a linear scan. Thus, our algorithms run in sublinear time, in contrast to streaming algorithms that use sublinear space.</p><p>Distribution property testing This work can be seen more broadly in the context of testing properties of distributions over large discrete domains. Such questions are studied at the crossroads of social networks, statistics, information theory, database algorithms, and machine learning algorithms. Examples of specific properties that have been extensively considered include testing whether the distribution is uniform, Gaussian, high entropy, independent or monotone increasing (see e.g. <ref type="bibr">Rubinfeld (2012)</ref>; <ref type="bibr">Canonne (2015)</ref>; <ref type="bibr">Goldreich (2017)</ref> for surveys on the topic).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2">LEARNING-BASED ALGORITHM</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.1">PRELIMINARIES</head><p>Problem setting and notation. The support estimation problem is formally defined as follows. We are given sample access to an unknown distribution P over a discrete domain of size n. For simplicity, we identify the domain with [n] = {1, . . . , n}. Let p i denote the probability of element i. Let S(P) = {i : p i &gt; 0} be the support of P. Our goal is to estimate the support size S = |S(P)| using as few samples as possible. In particular, given &#949; &gt; 0, the goal is to output an estimate S that satisfies S &#8712; [S -&#949;n, S + &#949;n].</p><p>We assume that the minimal non-zero mass of any element is at least 1/n, namely, that p i &#8805; 1/n for every i &#8712; S(P). This is a standard promise in the support estimation problem (see, e.g., <ref type="bibr">Raskhodnikova et al. (2009)</ref>; <ref type="bibr">Valiant &amp; Valiant (2011)</ref>; <ref type="bibr">Wu &amp; Yang (2019)</ref>), and as mentioned earlier, it naturally holds in the context of counting distinct elements, where p i is defined as the count of element i in the sample divided by n. Furthermore, a lower bound on the minimum non-zero probability is a necessary assumption without which no estimation algorithm is possible, even if the number of samples is allowed to be an arbitrarily large function of n, i.e., not just sublinear algorithms. The reason is that there could be arbitrarily many elements with exceedingly small probabilities that would never be observed. See for example the discussion in the supplementary Section 5 of <ref type="bibr">Orlitsky et al. (2016)</ref>.</p><p>In the learning-based setting, we furthermore assume we have a predictor &#928; that can provide information about p i . In our analysis, we will assume that &#928;(i) is a constant factor approximation of each p i . In order to bound the running time of our algorithms, we assume we are given access to a ready-made predictor and (as in <ref type="bibr">Canonne &amp; Rubinfeld (2014)</ref>) that evaluating &#928;(i) takes unit time. In our experiments, we use neural network based predictors from <ref type="bibr">Hsu et al. (2019)</ref>. In general, predictors need to be trained (or otherwise produced) in advance. This happens in a preprocessing stage, before the input distribution is given to the algorithm, and this stage is not accounted for in the sublinear running time. We also note that training the predictor needs to be done only once for all future inputs (not once per input).</p><p>The <ref type="bibr">Wu &amp; Yang (2019)</ref> estimator. In the classical setting (without access to a predictor), <ref type="bibr">Wu &amp; Yang (2019)</ref> gave a sample-optimal algorithm based on Chebyshev polynomials. We now describe it briefly, as it forms the basis for our learning-based algorithm.</p><p>Suppose we draw N samples, and let N i be the number of times element i is observed. The output estimate of <ref type="bibr">Wu &amp; Yang (2019)</ref> is of the form</p><p>where f (N i ) is a correction term intended to compensate for the fact that some elements in the support do not appear in the sample at all. If p i = 0, then necessarily N i = 0 (as i cannot appear in the sample). Thus, choosing f (0) = -1 ensures that unsupported elements contribute nothing to SWY . On the other hand, if p i &gt; log n N , then by standard concentration we have N i &gt; &#8486;(log n) with high probability; thus choosing f (N i ) = 0 for all N i &gt; L = &#8486;(log n) ensures that high-mass elements are only counted once in SWY . It remains to take care of elements i with</p><p>, where P L is the degree-L polynomial</p><p>To make the error as small as possible, we would like to choose f (1), . . . , f (L) so as to minimize</p><p>under the constraint P L (0) = -1 (which is equivalent to f (0) = -1). This is a well-known extremal problem, and its solution is given by Chebyshev polynomials, whose coefficients have a known explicit formula. Indeed, <ref type="bibr">Wu &amp; Yang (2019)</ref> show that choosing f (1), . . . , f (L) such that E[N ] k k! f (k) are the coefficients of an (appropriately shifted and scaled) Chebyshev polynomial leads to an optimal sample complexity of O(log 2 (1/&#949;)&#8226;n/ log n).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.2">OUR ALGORITHM</head><p>Our main result is a sample-optimal algorithm for estimating the support size of an unknown distribution, where we are given access to samples as well as approximations to the probabilities of the elements we sample. Our algorithm is presented in Algorithm 1. It partitions the interval</p><p>, where b is a fixed constant that we refer to as the base parameter (in our proofs this parameter upper bounds the approximation factor of the predictor, which is why we use the same letter to denote both; its setting in practice is studied in detail in the next section). The predictor assigns the elements observed in the sample to intervals, and the algorithm computes a Chebyshev polynomial estimate within each interval. Since the approximation quality of Chebyshev polynomials is governed by the ratio between the interval endpoints (as well as the polynomial degree), this assignment can be leveraged to get more accurate estimates, improving the overall sample complexity. Our main theoretical result is the following. Theorem 1. Let b &gt; 1 be a fixed constant. Suppose we have a predictor that given i &#8712; [n] sampled from the input distribution, outputs </p><p>Let a 0 , a 1 , . . . , a L be the coefficient of the Chebyshev polynomial P L (x) from Equation (1) (Note that a k = 0 for all k &gt; L)</p><p>Draw N random samples N i = # of times we see element i in samples for every interval</p><p>samples, we can approximate the support size S up to an additive error of &#949; &#8730; nS, with probability at least 9/10. Note that sample complexity of <ref type="bibr">Wu &amp; Yang (2019)</ref> (which is optimal without access to a predictor) is nearly linear in n, while Theorem 1 gives a bound that is polynomially smaller than n for every fixed &#949; &gt; 0. Also, note that &#8730; nS &#8804; n, so our estimate S is also within &#949; &#8226; n of the support size S.</p><p>We also prove a corresponding lower bound, proving that the above theorem is essentially tight. Theorem 2. Suppose we have access to a predictor that returns</p><p>for all sampled i. Then any algorithm that estimates the support size up to an &#949;n additive error with probability at least 9/10 needs &#8486;(n 1-&#920;(1/ log(1/&#949;)) ) samples.</p><p>We prove Theorems 1 and 2 in Appendix A. We note that while our upper bound proof follows a similar approach to Wu &amp; Yang (2019), our lower bound follows a combinatorial approach differing from their linear programming arguments.</p><p>The Chebyshev polynomial. For completeness, we explicitly write the polynomial coefficients used by Algorithm 1. The standard Chebyshev polynomial of degree L on the interval</p><p>For Algorithm 1, we want a polynomial as follows:</p><p>This is achieved by shifting and scaling Q L , namely, this polynomial can be written as</p><p>where</p><p>, which decays as e -&#920;(L) if b is a constant. Thus it suffices to choose L = O(log(1/&#949;)) in Theorem 1.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.3">ASSUMPTIONS ON THE PREDICTOR'S ACCURACY</head><p>In Theorems 1 and 2, we assume that the predictor &#928; is always correct within a constant factor for each element i. As we will discuss in the experimental section, the predictor that we use does not always satisfy this property. Hence, perhaps other models of the accuracy of &#928; are better suited, such as a promised upper bound on T V (&#928;, P), i.e., the total variation distance between &#928; and P. However, it turns out that if we are promised that T V (&#928;, P) &#8804; &#949;, then the algorithm of <ref type="bibr">Canonne &amp; Rubinfeld (2014)</ref> can in fact approximate the support size of P up to error O(&#949;) &#8226; n using only O(&#949; -2 ) samples. Conversely, if we are only promised that T V (&#928;, P) &#8804; &#947; for some &#947; &#949;, the algorithm of <ref type="bibr">Wu &amp; Yang (2019)</ref>, which requires &#920;(n/ log n) samples to approximate the support size of P, is optimal. We formally state and prove both of these results in Appendix A.3.</p><p>Our experimental results demonstrate that our algorithm can perform better than both the algorithms of <ref type="bibr">Canonne &amp; Rubinfeld (2014)</ref> and <ref type="bibr">Wu &amp; Yang (2019)</ref>. This suggests that our assumption (a pointwise approximation guarantee, but with an arbitrary constant multiplicative approximation factor), even if not fully accurate, is better suited for our application than a total variation distance bound.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3">EXPERIMENTS</head><p>In this section we evaluate our algorithm empirically on real and synthetic data.</p><p>Datasets. We use two real and one synthetic datasets:</p><p>&#8226; AOL: 21 million search queries from 650 thousand users over 90 days. The queries are keywords for the AOL search engine. Each day is treated as a separate input distribution.</p><p>The goal is to estimate the number of distinct keywords.</p><p>&#8226; IP: Packets collected at a backbone link of a Tier1 ISP between Chicago and Seattle in 2016 over 60 minutes. <ref type="foot">5</ref> Each packet is annotated with the sender IP address, and the goal is to estimate the number of distinct addresses. Each minute is treated as a separate distribution.</p><p>&#8226; Zipfian: Synthetic dataset of samples drawn from a finite Zipfian distribution over {1, . . . , 10 5 } with the probability of each element i proportional to i -0.5 .</p><p>The AOL and IP datasets were used in <ref type="bibr">Hsu et al. (2019)</ref>, who trained a recurrent neural network (RNN) to predict the frequency of a given element for each of those datasets. We use their trained RNNs as predictors. For the Zipfian dataset we use the empirical counts of an independent sample as predictions. A more detailed account of each predictor is given later in this section. The properties of the datasets are summarized in Table <ref type="table">1</ref>.</p><p>Baselines. We compare Algorithm 1 with two existing baselines:</p><p>&#8226; The algorithm of <ref type="bibr">Wu &amp; Yang (2019)</ref>, which is the state of the art for algorithms without predictor access. We abbreviate its name as WY.<ref type="foot">foot_4</ref> </p><p>&#8226; The algorithm of <ref type="bibr">Canonne &amp; Rubinfeld (2014)</ref>, which is the state of the art for algorithms with access to a perfect predictor. We abbreviate its name as CR.</p><p>Error measurement. We measure accuracy in terms of the relative error |1 -S/S|, where S is the true support size and S is the estimate returned by the algorithm. We report median errors over 50 independent executions of each experiment, &#177; one standard deviation. Summary of results. Our experiments show that on one hand, our algorithm can indeed leverage the predictor to get significantly improved accuracy compared to WY. On the other hand, our algorithm is robust to different predictors: while the CR algorithm performs extremely well on one dataset (AOL), it performs poorly on the other two (IP and Zipfian), whereas our algorithm is able to leverage the predictors in those cases too and obtain significant improvement over both baselines.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1">BASE PARAMETER SELECTION</head><p>Algorithm 1 uses two parameters that need to be set: The polynomial degree L, and the base parameter b. The performance of the algorithm is not very sensitive to L, and for simplicity we use the same setting as <ref type="bibr">Wu &amp; Yang (2019)</ref>, L = 0.45 log n . The setting of b requires more care.</p><p>Recall that b is a constant used as the ratio between the maximum and minimum endpoint of each interval I j in Algorithm 1. There are two reasons why b cannot be chosen too small. One is that the algorithm is designed to accommodate a predictor that provides a b-approximation of the true probabilities, so larger b makes the algorithm more robust to imperfect predictors. The other reason is that small b means using many small intervals, and thus a smaller number of samples assigned to each interval. This leads to higher noise in the Chebyshev polynomial estimators invoked within each interval (even if the assignment of elements to intervals is correct), and empirically impedes performance. On the other hand, if we set b to be too large (resulting in one large interval the covers almost the whole range of p i 's), we are essentially not using information from the predictor, and thus do not expect to improve over WY.</p><p>To resolve this issue, we introduce a sanity check in each interval I j , whose goal is to rule out bases that are too small. The sanity check passes if Sj &#8712; [0, 1/l j ], where l j is the left endpoint of I j (i.e., I j = [l j , r j ]), and Sj is as defined in Algorithm 1. The reasoning is as follows. On one hand, the Chebyshev polynomial estimator which we use to compute Sj can in fact return negative numbers, leading to failure modes with Sj &lt; 0. On the other hand, since all element probabilities in I j are lower bounded by l j , it can contain at most 1/l j elements. Therefore, any estimate Sj of the number of elements in I j which is outside [0, 1/l j ] is obviously incorrect.</p><p>In our implementation, we start by running Algorithm 1 with b = 2. If any interval fails the sanity check, we increment b and repeat the algorithm (with the same set of samples). The final base we use is twice the minimal one such that all intervals pass the sanity check, where the final doubling is to ensure we are indeed past the point where all checks succeed.</p><p>The effect of this base selection procedure on each of our datasets is depicted in Figures <ref type="figure">1, 3,</ref> and<ref type="figure">5</ref>. <ref type="foot">7</ref>For a fixed sample size, we plot the performance of our algorithm (dotted blue) as the base increases compared to WY (solid orange, independent of base), as well as the fraction of intervals that failed the sanity check (dashed green). The plots show that for very small bases, the sanity check fails on some intervals, and the error is large. When the base is sufficiently large, all intervals pass the sanity check, and we see a sudden plunge in the error. Then, as the base continues to grow, our algorithm continues to perform well, but gradually degrades and converges to WY due to having a single dominating interval. This affirms the reasoning above and justifies our base selection procedure.  </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>AOL data.</head><p>As the predictor, we use the RNN trained by <ref type="bibr">Hsu et al. (2019)</ref> to predict the frequency of a given keyword. Their predictor is trained on the first 5 days and the 6th day is used for validation.</p><p>The results for day #10 are shown in Figure <ref type="figure">2</ref>. (The results across all days are similar; see more below.) They show that our algorithm performs significantly better than WY. Nonetheless, CR (which relies on access to a perfect predictor) achieves better performance on a much smaller sample size. This is apparently due to highly specific traits of the predictor; as we will see presently, the performance of CR is considerably degraded on the other datasets.</p><p>IP data. Here too we use the trained RNN of <ref type="bibr">Hsu et al. (2019)</ref>. It is trained on the first 7 minutes and the 8th minute is used for validation. However, unlike AOL, <ref type="bibr">Hsu et al. (2019)</ref> trained the RNN to predict the log of the frequency of the given IP address, rather than the frequency itself, due to training stability considerations. To use it as a predictor, we exponentiate the RNN output. This inevitably leads to less accurate predictions. The results for minute 59 are shown in. Figure <ref type="figure">4</ref>. (As in the AOL data, the results across all minutes are similar; see more below). Again we see a significant advantage to our algorithm over WY for small sample sizes. Here, unlike the AOL dataset, CR does not produce good results.</p><p>Zipfian data. To form a predictor for this synthetic distribution, we drew a random sample of size 10% of n, and used the empirical count of each element in this fixed sample as the prediction for its frequency. If the predictor is queried for an element that did not appear in the sample, its predicted probability is reported as the minimum 1/n. We use this fixed predictor in all repetitions of the experiment (which were run on fresh independent samples). The results are reported in Figure <ref type="figure">6</ref>.</p><p>As with the IP data, our algorithm significantly improves over WY for small sample sizes, and both algorithms outperform CR by a large margin.</p><p>AOL and IP results over time. Finally, we present accuracy results over the days/minutes of the AOL/IP datasets (respectively). The purpose is to demonstrate that the performance of our algorithm remains consistent over time, even when the data has moved away from the initial training period and the predictor may become 'stale'. The results for AOL are shown in Figures <ref type="figure">7a,</ref><ref type="figure">7b</ref>, yielding a median 2.2-fold and 3.0-fold improvement over WY (for sample sizes 5% &#8226; n and 10% &#8226; n, respectively). The results for IP are shown in Figures <ref type="figure">8a</ref> and<ref type="figure">8b</ref>, yielding a median 1.7-fold and 3.0fold improvement over WY (for sample sizes 1% &#8226; n and 2.5% &#8226; n, respectively). As before, CR performs better than either algorithm on AOL, but fails by a large margin on IP.</p><p>b j i n &#8804; 0.5 log n N , then Var( S(i)) &#8804; E[( S(i) -1) 2 ] and we can write (again with j = j i )</p><p>where for the last inequality we noted that k! &#8804; k k , p i &#8226; n b j &#8804; b 2 , and b j &#8805; 1. Now, it is a well known consequence of the Markov Brothers' inequality that all the coefficients of the standard degree L Chebyshev polynomial Q L (x) are bounded by e O(L) <ref type="bibr">(Markov, 1892)</ref>.</p><p>, we have that for any fixed b = O(1), the coefficients a k are all bounded by e O(L) as well. Therefore, for</p><p>for some other constant C . In summary, if p i = 0, we have that E[ S(i)] &#8712; [1 -&#949;, 1 + &#949;] and Var( S(i)) &#8804; &#949; 2 n if we choose C to be a sufficiently large constant, since &#949; = e -&#920;(L) for a constant 1 &lt; b &#8804; O(1). This is true even for b j i n &gt; 0.5 log n N since &#949; 2 n &gt; 1. However, we know that S = Remark. We note that our analysis actually works (and becomes somewhat simpler) even if the algorithm is modified to define Sj = i&#8712;[n]:</p><p>for all intervals, as opposed to Sj = #{i &#8712; [n] : N i &#8805; 1, &#928;(i) &#8712; I j } for the intervals I j with b j n &gt; 0.5 log n N . However, because we can decrease the bias as well as the variance for these larger intervals, we modify the algorithm accordingly. While this does not affect the theoretical guarantees, it demonstrated an improvement in practice. This threshold was also used in <ref type="bibr">Wu &amp; Yang (2019)</ref> (the choice of leading constant 0.5 in the threshold term 0.5 log n N is arbitrary, and for simplicity we have adopted the value they used).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A.2 ANALYSIS OF THE LOWER BOUND</head><p>In this subsection, we prove Theorem 2, which proves that the sample complexity of Algorithm 1 is essentially tight.</p><p>Proof of Theorem 2. In order to prove the lower bound, we shall define two distributions P and Q for which the first k moments are matching, but their support size differs on at least &#949;n elements. Furthermore, both distributions will be supported on {0} &#8746; k n , k+1 n , . . . , 2k n , so that a 2-factor approximation predictor does not provide any useful information to an algorithm trying to distinguish the two distributions.</p><p>We start with an overview of the definition of the two distributions and then explain how to formalize the arguments, following the Poissonnization and rounding techniques detailed in <ref type="bibr">Raskhodnikova et al. (2009)</ref>.</p><p>for some integer k &#8805; 1. Note that &#949; = e -&#920;(k) . In order to define the distributions, we define k + 1 real numbers a 0 , . . . , a k as a</p><p>for every i &#8712; {0, . . . , k}. Suppose for now that n is a multiple of the least common multiple of 2 k-1 , k, . . . , 2k, so that a i &#8226; n is an integer for every i. We define P and Q as follows:</p><p>&#8226; The distribution P : For every a i such that a i &gt; 0, the support of P contains a i &#8226;n elements j that have probability p j = a i &#8226; k+i n each. &#8226; The distribution Q: For every a i such that a i &lt; 0, the support of Q contains -a i &#8226; n elements j that have probability q j = -a i &#8226; k+i n each.</p><p>First we prove that P and Q are valid distributions and that all of their non-zero probabilities are greater than 1/n.</p><p>Claim A.1. P and Q as defined above are distributions. Furthermore, their probability values are either 0 or greater than 1/n.</p><p>Proof. The second part of the claim follows directly from the definition of P and Q. We continue to prove the first part, that P and Q are indeed distributions. It holds for P that ai|ai&gt;0</p><p>We continue to prove that the first k moments of P and Q are matching, and that their support size differs by &#949;n.</p><p>Claim A.2. Let a 1 , . . . , a k be defined as above. Then</p><p>&#8226; For any r &#8712; {1, . . . , k}, it holds that</p><p>Proof. By plugging the a i 's as defined above,</p><p>Hence, letting r = r -1, it suffices to prove that k i=0 (-1) i k i (k +i) r = 0 for all 0 &#8804; r &#8804; k -1. For any fixed k, note that since (k + i) r is a degree r polynomial in i, (k + i) r can be written as a linear combination of i s for 0 &#8804; s &#8804; r with coefficients b 0 , . . . , b r . Therefore, we would like to prove that: </p><p>where the last equality is since k = k -s &#8805; 1. This concludes the proof of the first item.</p><p>We continue to prove the second item in the claim:</p><p>Recall that a i =</p><p>, so plugging these into Equation ( <ref type="formula">4</ref>) and multiplying both sides by 2 k-1 &#8226; 2k k , this is equivalent to proving</p><p>, the right-hand side of Equation ( <ref type="formula">5</ref>) equals</p><p>Multiplying by k, it suffices to show that</p><p>To do this, let j = k + i. Then, note that k+i-1 k-1 = j-1 k-1 = (j-1)&#8226;&#8226;&#8226;(j-k+1) (k-1)!</p><p>which is a degree k -1 polynomial in j. For 1 &#8804; j &#8804; k -1 the polynomial equals 0, but for j = 0 the polynomial equals (-1) k-1 . Therefore, the right hand side of Equation ( <ref type="formula">6</ref>) equals</p><p>As proven in the first part of this proof, for any P (j) of degree 0 &#8804; r &#8804; 2k -1, 2k j=0 (-1) j 2k j P (j) = 0. Therefore, the summation on the right hand side is 0, so this simplifies to 1, as required.</p><p>The following corollary follows directly from the definition of P and Q and the previous claim.</p><p>Corollary A.1. The following two items hold for P and Q as defined above.</p><p>&#8226; E[P r ] = E[Q r ] for all r &#8712; {1, . . . , k}.</p><p>&#8226; T V (P, Q) = &#949;n.</p><p>The above corollary states that indeed P and Q as defined above have matching moments for r = 1 to k, and that they differ by &#949;n in their support size. This concludes the high level view of the construction of the distributions P and Q. In order to finalize the proof we rely on the standard Possionization and rounding techniques. First, by Theorem 5.3 in <ref type="bibr">Raskhodnikova et al. (2009)</ref>, any s-samples algorithm can be simulated by an O(s)-Poisson algorithm. Hence, we can assume that the algorithm takes P oi(s) samples, rather than an arbitrary number s. Second, we can alleviate the assumption that the a i &#8226; n values (similarly</p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_0"><p>This constraint is naturally satisfied e.g., if the distribution P is an empirical distribution over a data set of n items. In fact, in this case all probabilities are multiples of 1/n so the support size is equal to the number of distinct elements in the data set.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="3" xml:id="foot_1"><p>Our results hold without change if we modify the assumption to r &#8226; &#928;(i) &#8804; pi &#8804; r &#8226; b &#8226; &#928;(i), for any r &gt; 0. We use r = 1 for simplicity.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="4" xml:id="foot_2"><p>The fact this is indeed a polynomial is proven in standard textbooks, e.g.,<ref type="bibr">Timan et al. (1963)</ref>.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="5" xml:id="foot_3"><p>From CAIDA internet traces 2016, https://www.caida.org/data/monitors/ passive-equinix-chicago.xml.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="6" xml:id="foot_4"><p>Apart from their tight analysis,<ref type="bibr">Wu &amp; Yang (2019)</ref> also report experimental results showing their algorithm is empirically superior to previous baselines.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="7" xml:id="foot_5"><p>In those plots, for visualization, in order to compute the error whenever a sanity check fails in Ij, we replace Sj with a na&#239;ve estimate, defined as the number of distinct sample elements assigned to Ij. Note that our implementation never actually uses those na&#239;ve estimates, since it only uses bases that pass all sanity checks.</p></note>
		</body>
		</text>
</TEI>
