{'fraction_non_alphanumeric': 0.05199042202933254, 'fraction_numerical': 0.00796168811733014, 'mean_word_length': 3.893950490698696, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Canonical Estimation in a Rare-Events Regime

We propose a general methodology for performing statistical inference within a `rare-events regime' that was recently suggested by Wagner, Viswanath and Kulkarni. Our approach allows one to easily establish consistent estimators for a very large class of canonical estimation problems, in a large alphabet setting. These include the problems studied in the original paper, such as entropy and probability estimation, in addition to many other interesting ones. We particularly illustrate this approach by consistently estimating the size of the alphabet and the range of the probabilities. We start by proposing an abstract methodology based on constructing a probability measure with the desired asymptotic properties. We then demonstrate two concrete constructions by casting the Good-Turing estimator as a pseudo-empirical measure, and by using the theory of mixture model estimation.


I. INTRODUCTION
We propose a general methodology for performing statistical inference within the 'rare-events regime' suggested by Wagner, Viswanath and Kulkarni in [1], referred to as WVK hereafter. This regime is a scaling statistical model that strives to capture large alphabet settings, and is characterized by the following notion of a rare-events source. Definition 1. Let {(A n , p n )} n∈N be a sequence of pairs where each A n is an alphabet of finite symbols, and p n is a probability mass function over A n . Let X n be a single sample from p n , and use it to define a 'shadow' sequence Z n = np n (X n ). Let P n denote the distribution of Z n . We call {(A n , p n )} n∈N a rare-events source, if the following conditions hold.
(i) There exists an interval C = [č,ĉ], 0 <č ≤ĉ < ∞, such that for all n ∈ N we haveč n ≤ p n (a) ≤ĉ n for all a ∈ A n , or equivalently, P n is supported on C. (ii) There exists a random variable Z, such that Z n → Z in distribution. Equivalently, there exists a distribution P , such that P n ⇒ P weakly.
To complete the model, we adopt the following sampling scheme. For each n, we draw n independent samples from p n , and we denote them by X n,1 , · · · , X n,n . Using these samples, we are interested in estimating various quantities. WVK consider, among a few others, the following: • The total (Good-Turing) probabilities of all symbols appearing exactly k times, for each k ∈ N 0 . • The normalized log-probability of the observed sequence.
• The normalized entropy of the source. • The relative entropy between the true and empirical distributions. They also consider two-sequence problems and hypothesis testing, but we focus here on single sequence estimation.
It is striking that many of these quantities can be estimated in such a harsh scaling model, where one cannot hope for the empirical distribution to converge in any traditional sense. However, WVK's estimators have some drawbacks. For example, since they are based on series expansions of the quantities to be estimated, one has to carefully choose the growth rate of partial sums, in order to control convergence properties. More importantly, they are specifically tailored to each individual task. Their consistency is established on a case-by-case basis. What is desirable, and what this paper contributes to, is a methodology for performing more general statistical inference within this regime. Ideally such a framework would allow one to tackle a very large class of canonical estimation problems, and establish consistency more easily.
We may summarize the fundamental ideas behind our approach and the organization of this paper as follows. First, in Section II, we isolate the class of estimation problems that we are interested in as those that asymptotically converge to an integral against P . The quantities studied by WVK fall in this category, and so do other interesting problems such as estimating the size of the alphabet. Other problems, such as estimating the range of the probabilities given by the support interval C, can also be studied in this framework.
Next, in Section III, we propose an abstract solution methodology. At its core, we construct a (random) distri-butionP n that converges weakly to P for almost every observation sample. This construction immediately establishes the consistency of natural estimators for the abovementioned quantities, if bounds on C are known. If in addition the rate of the convergence ofP n is established, the framework gives consistent estimators even without bounds on C.
To make this methodology concrete, we build on a core result of WVK that establishes the strong consistency of the Good-Turing estimator. In particular, since the role of the empirical measure is lost, we show in Section IV that we can treat the Good-Turing estimator as a pseudo-empirical measure. Once this is established, we can borrow heavily from the theory of mixture models, where inference is done using i.i.d. samples, and adapt it to our framework. In Section V, we suggest two approaches for constructingP n : one that is based on maximum likelihood, and another that is based on minimum distance. Both constructions guarantee the almost sure weak convergence ofP n to P , but the latter, under some conditions, also provides the desirable convergence rates.
In Section VI we illustrate the methodology with some examples. In particular, we show how one can consistently estimate the entropy of the source and the probability of the sequence as studied by WVK, but we also propose consistent estimators for the size of the alphabet and for the support interval C.
Notation: Throughout, we use F (.; .) to denote the cumulative distribution of the second argument (which is a probability measure on the real line or on the integers) evaluated at the first argument (which is a point on the real line or an integer).

A. Definitions
Given i.i.d. samples X n,1 , · · · , X n,n from the rare-events source (A n , p n ), we can pose a host of different estimation problems. Since the alphabet is changing, quantities that depend on explicit symbol labels are not meaningful. Therefore, one ought to only consider estimands that are invariant under re-labeling of the symbols in A n . In particular, we consider the following class of general estimation problems.

Definition 2.
Consider the problem of estimating a sequence {Y n } n∈N of real-valued random variables using, for every n, the samples X n,1 , · · · , X n,n . We call this a canonical estimation problem if, for every rare-events source, we have: for some sequence {f n } of continuous real-valued functions on R + that converge pointwise to a continuous function f .
It is worth noting that it follows that {f n } and f are also bounded on every closed interval [a, b], 0 < a ≤ b < ∞. Observe that this definition corresponds indeed to estimands that are invariant under re-labeling, in expectation. The following lemma characterizes the limit.

Lemma 1. For any canonical estimation problem,
Proof: Since P n ⇒ P , we can apply Skorokhod's theorem ( [2], p. 333), to construct a convergent sequence of random variables ξ n → a.s. ξ, where ξ n ∼ P n and ξ ∼ P . By continuity, it follows that f n (ξ n ) → a.s. f (ξ). By the bounded convergence theorem, we then have It is often more interesting to consider the subclass of canonical problems where there is strong concentration around the mean, and where the Borel-Cantelli lemma applies to give almost sure convergence to the mean. Definition 3. If a canonical estimation problem further satisfies |Y n − E[Y n ]| → a.s. 0, then call it a strong canonical problem. It follows that for strong canonical problems, Using these definitions, a reasonable estimator will at least agree with the limit set forth in Lemma 1. Other modes of convergence may be reasonable, but we would like to exhibit a statistic that almost surely converges to that limit. We make this precise in the following definition. Definition 4. Given a canonical problem as in Definition 2, a corresponding estimator is a sequence {Ŷ n } n∈N such that, for each n,Ŷ n (a 1 , · · · , a n ) is a real-valued function on (A n ) n , to be evaluated on the sample sequence X n,1 , · · · , X n,n . A consistent estimator is one that obeyŝ Y n (X n,1 , · · · , X n,n ) → a.s.
For canonical estimation problems that are not necessarily strong, this approach produces an asymptotically unbiased estimator, with asymptotic mean squared error that is no more than the asymptotic variance of the estimand itself. For strong canonical estimation problems, this approach establishes strong consistency, in the sense that the estimator converges to the estimand, almost surely.

B. Examples
To motivate the setting we have just described, we first note that all of the quantities studied by WVK are strong canonical estimation problems. For each quantity, WVK propose an estimator, and individually establish its consistency by showing almost sure convergence to the limit in Lemma 1. In contrast, what we emphasize here is that this can potentially be done universally over all strong canonical problems.
To highlight the usefulness of this generalization, we illustrate two important quantities that fall within this framework. We will revisit these in more detail in Section VI. The first quantity is the normalized size of the alphabet: |A n |/n. For this, one can show (see, for example, [3]), that |A n |/n = C 1 x dP n (x). Therefore we can take f n (x) = f (x) = 1 x , and since the estimand is deterministic, we have a strong canonical estimation problem.
The second quantity of interest is the interval C, or equivalently its endpointsč andĉ. Note that, by construction, P is supported on C. Without loss of generality, we may assume thatč andĉ are respectively the essential infimum and essential supremum of Z ∼ P . Therefore, note that x ±q dP (x) 1/q converges to the essential infimum (−) or supremum (+) as q → ∞. We can therefore consider, for fixed q ≥ 1, the strong canonical problems that ensue from the choices f n (x) = f (x) = x −q and f n (x) = f (x) = x q . These, by themselves, are not sufficient to provide estimates forč and c. However if, in addition to consistency, we establish the convergence rates of their estimators, then we can apply our framework to estimate C, as we show in Section VI.
III. SOLUTION METHODOLOGY Our task now is to exhibit consistent estimators to canonical problems. We present here our abstract methodology, which we demonstrate concretely in Section V. The core of our approach consists of using the samples X n,1 , · · · , X n,n to construct a random measureP n over R + , such that for almost every sample sequence, the sequence of measures {P n } converges weakly to P . We write: as n → ∞ P n ⇒ a.s. P.
If we accomplish this, we can immediately suggest a consistent estimator under certain conditions, as expressed by Lemma 2. We will be interested in integrating functions against the measureP n . However, since the support C of P is unknown, we first introduce the notion of a tapered function as a convenient way to control the region of integration. Given a real-valued function g(x) on R + , for every D ≥ 1 define its D-tapered version as: x > D If g is continuous on (0, +∞), then we can think of g D (x) as a bounded continuous extension of the restriction of g on [D −1 , D] to all of R + .

Lemma 2. Consider a canonical problem characterized by some f . Let the support C of a rare-events source be known up to an interval
is a consistent estimator.
Furthermore, if f is bounded everywhere, we can make the uninformative choice D = ∞.
Proof: Since the tapered function f D is continuous and bounded on R + , the almost sure weak convergence ofP n to P implies that R + f D dP n → a.s. R + f D dP . But since P is supported on C and f D agrees with f on C, we have In general, however, we will be interested in problems where we do not have an a priori knowledge about the endpoints of C, and where an uninformative choice cannot be made because f is not bounded on R + , such as f (x) = log x, 1/x, or x q . For these problems, we can apply our methodology of integrating againstP n by first establishing a rate for the convergence of equation (5). We characterize such a rate using a sequence K n → ∞, such that: where d W denotes the Wasserstein distance, which can be expressed in its dual forms: In the remainder of the paper we will particularly focus on K n of the form n s for some s > 0.
In the following lemma, we describe how we can use convergence rates such as (7) to construct consistent estimators that work with no prior knowledge on C, for a large subclass of canonical problems.

Lemma 3. Consider a canonical problem characterized by
is a consistent estimator. The growth of D n controls the growth of the Lipschitz constant of f Dn , which should be balanced with the convergence rate K n . More precisely,Ŷ n in (9) is consitent for any D n → ∞ that additionally satisfies where Lip(g) indicates the Lipschitz constant of g.
Proof: First note that for any D ≥ (č −1 ∨ĉ), since P is supported on C and f D agrees with f on C, we have: Then, using the fact that for every D, (1), we can invoke the dual representation (8) of the Wasserstein distance to write: By combining equations (11) and (12), it follows that for any sequence D n → ∞, we have: If furthermore D n is chosen such that equation (10) is satisfied, then the factor Kn Lip(fD n ) is eventually bounded away from zero, and can be eliminated from equation (13) to lead to the convergence of the estimator.
Of course, there may be more than one way in which one could constructP n . In this paper, we focus on demonstrating the validity and usefulness of the methodology by providing two possible constructions. The results would remain valid regardless to the specific construction, and other constructions boasting more appealing properties, such as rates of convergence under more lenient assumptions, are welcome future contributions to this framework.

A. Definitions and Properties
The platform on which we build our estimation scheme is the Good-Turing estimator, and in particular its strong consistency established by WVK. In this section, we review the main definition and properties relevant to the rest of the development. Let B n,k be the subset of symbols of A n that appear exactly k times in the samples X n,1 , · · · , X n,n . The Good-Turing estimation problem, in reference to the pioneering work of Good in [4], is the estimation of the quantities γ n,k = p n (B n,k ), for each k = 0, 1, · · · , n, that is the total probability of all symbols that appear exactly k times. We can group these with the notation γ n ≡ {γ n,k } k∈N0 , which we pad with zeros for k > n. In particular, Good suggests the following estimator.
Definition 5. Let ϕ n,k = |B n,k | be the number of symbols of A n that appear k times in X n,1 , · · · , X n,n . The Good-Turing estimator φ n ≡ {φ n,k } k∈N0 of γ n , for each k ∈ N 0 , is WVK establish a host of convergence properties for the Good-Turing estimation problem and the Good-Turing estimator. We group these in the following theorem.

B. Empirical Measure Analogy
The analogy that we would like to make in this section is the following. Assuming λ is given, one could take n i.i.d. samples from it, and form the empirical measure or the type, call it λ n ≡ {λ n,k } k∈N0 . Such an empirical measure would satisfy well-known statistical properties, in particular the strong law of large numbers would apply, and we would haveλ n,k → a.s. λ k . By Scheffé's theorem, L 1 convergence would also follow. It is evident from Theorem 1 that despite the fact that we do not have such a true empirical measure, the Good-Turing estimator φ n behaves as one, and we may be justified to call it a pseudo-empirical measure. Now observe that since, for discrete distributions, the total variation distance is related to the L 1 distance by sup B⊂N0 |λ n (B) − λ(B)| = 1 2 λ n − λ 1 , the true empirical measure also converges in total variation. As a special case, the Glivenko-Cantelli theorem applies in that sup k |F (k; λ) − F (k;λ n )| → a.s. 0. Recall that F (.; .) denotes the cumulative of the second argument (a measure) evaluated at the first argument. In light of the above, this remains valid for the pseudo-empirical measure. However, for the classical empirical measure, we also have the rate of convergence in the Glivenko-Cantelli theorem, in the form of the Kolmogorov-Smirnov theorem and its variants for discrete distributions, see for example [5]. Such results are often formulated in terms of a convergence in probability of rate 1 √ n . So we next ask whether such rates hold for the pseudo-empirical measure as well.
We first note that the rare-events source model is lenient, in the sense that it does not impose any convergence rate on P n ⇒ P . Therefore, convergence results that aim to parallel those of a true empirical measure will depend on assumptions on the rate of this core convergence. In particular, let us assume that we know something about the weak convergence rate of P n to P in terms of the Wasserstein distance, in that we assume there exists an r > 0 such that For example, in Lemma 5, we will show that this holds true for a class of rare-events sources suggested by WVK.
Next, note that Lemma 11 in WVK gives the following useful concentration rate for the pseudo-empirical measure around its mean.

Lemma 4. For any
In the following statement, we show that a Kolmogorov-Smirnov-type convergence to λ does hold for the pseudoempirical measure φ n , with a rate that is essentially the slower of that of the concentration of Lemma 4 and that of the rareevents source itself.

Theorem 2.
Let r > 0 be such that n r d W (P n , P ) → 0. Then for any δ > 0, we have: Proof: For convenience, define B k ≡ {0, · · · , k}. The proof requires three approximations. The first is to approximate φ n with E[φ n ]. This is already achieved using Lemma 4. Since the L 1 distance is twice the total variation distance, and specializing to the subsets B k , we have that for all δ > 0: The next two approximations are (a) to approximate E[φ n ] with a Poisson P n -mixture (using the theory of Poisson approximation), and (b) to approximate the latter with λ, which is a Poisson P -mixture (using the convergence in d W (P n , P )).
Part (a) -For convenience, let π n be a Poisson(x) P nmixture, and let η n be a Binomial x n , n P n -mixture. One can show, as in the proof of Lemma 7 of WVK, that E[φ n ] is a Binomial x n , n − 1 P n -mixture. We first relate E[φ n ] to η n which is the natural candidate for Poisson approximation. We then use Le Cam's theorem to relate η n to π n .
We start with a general observation. Let F = {f (·; x) : x ∈ C} and G = {g(·; x) : x ∈ C} be two parametric classes of probability mass functions over N 0 , e.g. Poisson and Binomial, and let Q be a mixing distribution supported on C. Say that for some subset B ⊂ N 0 , we have the pointwise bound |f (B; x) − g(B; x)| ≤ ℓ(x). It follows that the mixture of the bound is also a bound on the mixture. More precisely: (18) Note that if the pointwise bound above holds uniformly over B, then the same is true for the mixture bound. We will use this particularly with the subsets B k , to bound the difference of cumulative distribution functions. Now let g n (k; x) be the c.d.f. of a Binomial x n , n random variable, and letg n (k; x) be the c.d.f. of a Binomial x n , n − 1 random variable. For any given k, we have the following: Using the facts that the sum is no larger than the mean and thatg n (k; x) ≤ 1, it follows that for any given k we have: x n Note that C g n (k; x) dP n = F (k; η n ), the c.d.f. of η n , and Using Le Cam's theorem (see, for example, [6]), we know that the total variation distance, and hence the difference of probabilities assigned to any subset B ⊂ N 0 by a Poisson(x) distribution and a Binomial x n , n distribution is upper-bounded by x 2 n . We apply this to the subsets B k , and use the observation leading to equation (18) once again to extend this result to the respective P n -mixtures: By combining equations (19) and (20), we deduce that for all δ > 0: Part (b) -Now let h(k; x) be the c.d.f. of a Poisson(x) random variable. Observe that: Therefore, when viewed as a function of x, h(k; x) is a Lipschitz(1) function on C for all k. Using the dual representation of the Wasserstein distance, we then have: Using the assumption of the convergence rate of P n to P , it follows that for all δ > 0 we have: The statement of the theorem follows by combining equations (17), (21), and (22). In a practical situation, one would expect that the rareevents source is well-behaved enough that r > 1/2, and that the bottleneck of Theorem 2 is given by the 1/2 rate, and therefore we have a behavior that more closely parallels a true empirical measure. Indeed, some natural constructions obey this principle. Most trivially, for a sequence of uniform sources, e.g. if p n (a) = 1/n, we have P n = P , and therefore r = ∞. More generally, consider the following class of rareevents sources suggested by WVK.

Definition 6.
Let g be a density on [0, 1] that is continuous Lebesgue almost everywhere, and such thatč ≤ g(w) ≤ĉ for all w ∈ [0, 1]. Let A n = {1, · · · , ⌊αn⌋} for some α > 0, and for every a ∈ A n let p n (a) = a/⌊αn⌋ (a−1)/⌊αn⌋ g(w) dw. One can then verify that {(A n , p n )} is indeed a rare-events source, with P being the law of g(W ), where W ∼ g. We call such a construction a rare-events source obtained by quantizing g.

Lemma 5.
Let g be a density as in Definition 6, and let {(A n , p n )} be a rare-events source obtained by quantizing g. If g has finitely many discontinuities, and is Lipschitz within each interval of continuity, then for all r < 1: n r d W (P n , P ) → 0 Proof: Without loss of generality, assume α = 1, and that the largest Lipschitz constant is 1. Consider the quantized density on [0, 1]: where the integral is against the Lebesgue measure. Then it follows that P n is the law of g n (W n ), where W n ∼ g n .
Say g has L discontinuities, and let D n be the union of the L intervals of the form [(a − 1)/n, a/n] which contain these discontinuities. In all other intervals, we have that |g(w) − g n (w)| ≤ 1/n, using Lipschitz continuity and the intermediate value theorem. It follows that For any particular x ∈ C, let B x = {w ∈ [0, 1] : g(w) < x}. We then have By integrating over all x: Therefore the lemma follows. We end by remarking that the rare-events sources covered by Lemma 5 are rather general in nature. For example, all of the illustrative and numerical examples offered by WVK are special cases (more precisely, they have piecewise-constant g).

V. CONSTRUCTINGP n VIA MIXING DENSITY ESTIMATION
We would now like to address the task of using X n,1 , · · · , X n,n to construct a sequence of probability mea-suresP n that, for almost every sample sequence, converges weakly to P , as outlined in Section III. Since we have established the Good-Turing estimator as a pseudo-empirical measure issued from a Poisson P -mixture, in both consistency and rate, this is analogous to a mixture density estimation problem, with the true empirical measure replaced with the Good-Turing estimator φ n .
We start by noting that the task is reasonable, because the mixing distribution in a Poisson mixture is identifiable from the mixture itself. This observation can be traced back to [7] and [8]. Then, the first natural approach is to use nonparametric maximum likelihood estimation. In Section V-A, we use Simar's work in [9] to construct a valid estimator in this framework. Unfortunately, to the best of the authors' knowledge, the maximum likelihood estimator does not have a well-studied rate of convergence on the recovered mixing distribution. In Section V-B we consider instead a minimum distance estimator, with which Chen gives optimal rates of convergence in [10], albeit by assuming finite support for P .

A. Maximum Likelihood Estimator
We first define the maximum likelihood estimator in our setting. Despite the fact that it is not, strictly speaking, maximizing a true likelihood, we keep this terminology in light of the origin of the construction.

Definition 7.
Given the pseudo-empirical measure (Good-Turing estimator) φ n the maximum likelihood estimator of the mixing distribution is a probability measureP ML n on R + which maximizes the pseudo-likelihood as follows: It is not immediately clear whetherP ML n exists or is unique. These questions were answered in the affirmative in [9]. On close examination, it is clear that these properties do not depend on whether we are using a pseudo-empirical measure instead of a true empirical measure. Hence they remain valid in our context. Next, we establish the main consistency statement.

Theorem 3. For almost every sample sequence, the sequence {P ML
n } converges weakly to P as n → ∞. We write this as P ML n ⇒ a.s. P . Proof: The main burden of proof is addressed by Theorem 1 in establishing the strong law of large numbers for the pseudo-empirical measure, and which is originally given in WVK's Proposition 7. Indeed, in Simar's proof ( [9], Section 3.3, pp. 1203-1204), we only use the fact that φ n,k → a.s. λ k for every k ∈ N 0 . The rest of the proof carries over, and the current theorem follows.
It is worth noting that the consistency of the maximum likelihood estimator does not even require that condition (i) in the Definition 1 of the rare-events source to hold, since Theorem 1 in fact holds without that condition. In that sense, it is very general. However, when every neighborhood of 0 or ∞ has positive probability under P , it limits the types of functions that we can allow in the canonical problems, including sequence probabilities and entropies as discussed in WVK. When P is not compactly supported, it is also difficult to establish the rates of convergence.

B. Minimum Distance Estimator
We now define a minimum distance estimator for our setting. The reason that we suggest this alternate construction ofP n is that it is useful to quantify the convergence rate to P , and the minimum distance estimator provides such a rate. However, it does so with the further assumption that P has a finite support, whose size is bounded by a known number m.
Also note that the definition of the estimator circumvents questions of existence by allowing for a margin of ǫ from the infimum, and does not necessarily call for uniqueness.

Definition 8.
For a probability measure Q on R + , let π(Q) denote the Poisson Q-mixture. Then, given the pseudo-empirical measure φ n , a minimum distance estimator with precision ǫ is any probability measureP MD,m,ǫ n on R + that satisfies where the infimum is taken on probability measures supported on at most m points, on R + .
We now provide the main consistency and rate results associated with such estimators. Theorem 4. Let r > 0 be such that n r d W (P n , P ) → 0, and assume that it is known that P is supported on at most m points. LetP MD,m,ǫn n be a sequence of minimum distance estimators chosen such that ǫ n < n − min{r,1/2} . Then as n → ∞, we have that for any δ > 0: n min{r/2,1/4}−δ d W P MD,m,ǫn n , P → a.s. 0.
Remark: Since d W induces the weak convergence topology, it also follows thatP MD,m,ǫn n ⇒ a.s. P . Proof: To derive rate results in [10], Chen establishes a bound on the Wasserstein distance between mixing distributions, using the Kolmogorov-Smirnov distance between the c.d.f.s of the resulting mixtures. For this, he first introduces a notion of strong identifiability (Definition 2, p. 225), and shows that Poisson mixtures satisfy it (Section 4, p. 228). He then shows (in Lemma 2, p. 225) that if we have strongly identifiable mixtures and if two mixing distributions have a support of at most m points within a fixed compact set, such as C, then we can find a constant M (which depends nonconstructively on m and C), such that for any two such mixing distributions Q 1 and Q 2 , we have: The main burden of proof therefore falls on our Theorem 2 in establishing a Kolmogorov-Smirnov-type convergence for the pseudo-empirical measure. The argument we present next is based on Chen's proof (Theorem 2, p. 226). We have: where the final inequality is due to the definition ofP MD,m,ǫn n . By Theorem 2, and by our choice of ǫ n , it follows that for all δ > 0, we have: n min{r,1/2}−2δ sup k F (k; π(P MD,m,ǫn n )) − F (k; φ n ) → a.s. 0.
(26) By combining (25) and (26), the theorem follows . Note that Chen's result can be used to show more. In particular, if we think of the true mixing distribution as residing in some neighborhood of a fixed distribution, then the convergence holds uniformly over that neighborhood. This may be interpreted as a form of robustness, but we do not dwell on it here.

VI. APPLICATIONS
To solve canonical problems in the setting of Lemma 2, when an a priori bound on C is known or when f is bounded on R + , it suffices to construct a sequence of probability measuresP n that weakly converges to P for almost every sample sequence. Since Theorem 3 provides such a sequence, we need not go further than that.
However, to work within the more general setting of Lemma 3, where no knowledge of C is assumed and f can be any locally Lipschitz function, we can use the result of Theorem 4. In this section, we start by illustrating this for some of the quantities considered by WVK. We then suggest two new applications: alphabet size and support interval estimation. We conclude by remarking on some algorithmic considerations.

A. Estimating Entropies and Probabilities
First consider the entropy of the source H(p n ), and the associated problem, in normalized form, of estimating Y H n ≡ H(p n ) − log n. One can then write: and therefore, by comparing to equation (1) with f n (x) = f (x) = −log(x), we have a canonical estimation problem, and since Y H n is deterministic, it is also strong. If we have a bound on C, we can use Lemma 2. Otherwise, note that on intervals of the form [D −1 , D], log x is D-Lipshitz. Therefore if for some s > 0, n s d W (P n , P ) → a.s. 0, as given by Theorem 4 for example, then we can apply Lemma 3 using D n = n s . If s exists but is unknown, we can still apply Lemma 3 using any sequence that is o(n s ), such as D n = e log ǫ n , for some ǫ > 0. The consistent estimator becomes: Next consider the probability of the sequence p n (X n,1 , · · · , X n,n ), and the associated normalized problem of estimating Y p n ≡ 1 n log p n (X n,1 , · · · , X n,n ) + log n. We have (WVK, Lemma 5): and therefore we also have a canonical estimation problem. Using McDiarmid's theorem, one can also show that (WVK, Lemma 6) |E[Y p n ] − Y p n | → a.s. 0, and therefore we once again have a strong canonical estimation problem, and we can construct a consistent estimator as in the case of entropy. Referring to equation (27), we haveŶ p n ≡ −Ŷ H n .

B. Estimating the Alphabet Size
Consider the size of the alphabet |A n |. Since the model describes large, asymptotically infinite, alphabets, we look at the normalized problem of estimating Y A n = |A n |/n. We have (cf. x dP n (x).
Once again, having a deterministic sequence of the form of (1) with f n (x) = f (x) = 1/x, it follows that {Y A n } n∈N is a strong canonical problem. If we have a bound on C, we can use Lemma 2. Otherwise, note that on intervals of the form [D −1 , D], 1/x is D 2 -Lipshitz. Therefore if for some s > 0, n s d W (P n , P ) → a.s. 0, as given by Theorem 4 for example, then we can apply Lemma 3 using D n = n s/2 . As in Section VI-A, if s exists but is unknown, we can still apply Lemma 3 using any sequence that is o(n s ), such as D n = e log ǫ n , for some ǫ > 0. The consistent estimator becomes:

C. Estimating the Support Interval
As discussed in Section II-B, estimating the support interval is not a canonical problem per se. However, we show here that we can extend the framework in a straightforward fashion to provide consistent estimators of bothč andĉ. Lemma 6. LetP n ⇒ a.s. P such that for some s > 0, we have n s d W (P n , P ) → a.s. 0. This is particularly true under the conditions of Theorem 4. Given q = 0 and D ≥ 1, let x q D denote the D-tapered version of x q .
If q n = log n/ log log n and D n = n s/(2qn) , then we have: as n → ∞, Dn dP n (x) Proof: For conciseness, let us drop the argument of the probability measures, and write dP for dP (x). We provide the proof only forč, since the argument is analogous forĉ. Recall thatč is the essential infimum of a random variable Z ∼ P . Therefore, for any D ≥ (č −1 ∨ĉ), we have: In the absence of a rate of convergence, we cannot simply plug inP n . But since we know that n s d W (P n , P ) → a.s. 0, we can use the dual representation of the Wasserstein distance and the fact that for every q and D the function 1 q D −1−q x −q D is Lipschitz(1) over R + to state: as n → ∞, We now want to relate this to the difference of the q th roots. Note that each of the integrals in (30) is bounded from below by D −q . Using this and the fact that for any a and b > 0 we have a 1/q − b 1/q ≤ 1 q (a ∧ b) 1 q −1 |a − b|, we can write: The choices q n = log n/ log log n and D n = n s/(2qn) , allow us to have D 2qn n = n s , and yet guarantee that as n → ∞ both q n and D n → ∞. With this, we can use the convergence of equation (30), to state: as n → ∞,