Beyond the Chinese Restaurant and Pitman-Yor processes: Statistical Models with double power-law behavior

Fadhel Ayed * 1 Juho Lee * 1 2 Franc¸ois Caron 1

Abstract by a power-law distribution, an observation attributed to Zipf (1935). That is, the frequency f of the kth most frequent Bayesian nonparametric approaches, in particular (k) word in a corpus satisfies, within some range the Pitman-Yor process and the associated two- parameter Chinese Restaurant process, have been −ξ f(k) ' Ck successfully used in applications where the data exhibit a power-law behavior. Examples include where C is some constant and ξ > 0 is the power-law natural language processing, natural images or exponent which is typically close to 1 for natural languages. networks. There is also growing empirical evi- These empirical findings have motivated the development of dence suggesting that some datasets exhibit a two- numerous generative models that can reproduce this power- regime power-law behavior: one regime for small law behavior; see the reviews of (Mitzenmacher, 2004) and frequencies, and a second regime, with a different (Newman, 2005). exponent, for high frequencies. In this paper, we Amongst these generative models, Bayesian nonparamet- introduce a class of completely random measures ric hierarchical models based on infinite-dimensional ran- which are doubly regularly-varying. Contrary to dom measures have been successfully used to capture the the Pitman-Yor process, we show that when com- power-law behavior of various datasets. Applications in- pletely random measures in this class are normal- clude natural language processing (Goldwater et al., 2006; ized to obtain random measures and Teh, 2006; Wood et al., 2009; Mochihashi et al., 2009; Sato associated random partitions, such partitions ex- & Nakagawa, 2010), natural image segmentation (Sudderth hibit a double power-law behavior. We present & Jordan, 2009) or network analysis (Caron, 2012; Caron two general constructions and discuss in particular & Fox, 2017; Crane & Dempsey, 2018; Cai et al., 2016). two models within this class: the beta prime pro- A very popular model is the Pitman-Yor (PY) process (Pit- cess (Broderick et al. (2015, 2018) and a novel man, 1995; Pitman & Yor, 1997; Pitman, 2006), an infinite- process called generalized BFRY process. We dimensional random probability whose properties derive efficient Monte Carlo algo- induce a power-law behavior. It admits two parameters rithms to estimate the parameters of these models. (0 ≤ α < 1, θ > −α). The PY random Finally, we show that the proposed models pro- is almost surely discrete, with weights π ≥ π ≥,... vide a better fit than the Pitman-Yor process on (1) (2) following the so-called two-parameter Poisson-Dirichlet dis- various datasets. tribution PD(α, θ) (Pitman & Yor, 1997). For α > 0, the random weights satisfy

−1/α 1. Introduction π(k) ∼ k S almost surely as k → ∞ Power-law distributions appear to arise in a wide range of where S is a . That is, small weights asymp- contexts, including natural languages, natural images or totically follow a power-law distribution whose exponent is networks. For example, the empirical distribution of the controlled by the parameter α. The PY process also enjoys word frequencies in natural languages is well approximated tractable alternative constructions via the two-parameter *Equal contribution 1Department of , University Chinese restaurant process or the stick-breaking construc- of Oxford, Oxford, United Kingdom 2AITRICS, Seoul, Re- tion which explains its great popularity amongst models public of Korea. Correspondence to: Fadhel Ayed . random measures that have been used for their similar Proceedings of the 36 th International Conference on Machine power-law properties include the stable Indian buffet pro- Learning, Long Beach, California, PMLR 97, 2019. Copyright cess (Teh & Gorur, 2009) or the generalized gamma pro- 2019 by the author(s). cess (Hougaard, 1986; Brix, 1999). Models with double power-law behavior

where τ > 0, α ∈ (0, 1) and C1,C2 > 0. The above statement is made mathematically accurate later in the arti- cle. We describe two general constructions to obtain doubly regularly varying CRMs, and consider two specific models within this class: the beta prime process of Broderick et al. (2015; 2018) and a novel process named generalized BFRY process. We show how these two CRMs can be obtained from transformations of the generalized gamma and sta- ble beta processes. We derive Markov chain Monte Carlo inference algorithms for these models, and show that such models provide a good fit compared to a Pitman-Yor process on text and network datasets.

2. Background on (normalized) completely random measures CRMs, introduced by Kingman (1967), are important build- ing blocks of Bayesian nonparametric models (Lijoi & Prunster,¨ 2010). A homogeneous CRM on a Polish space Θ, without deterministic component nor fixed atoms, is almost Figure 1. (Top) Ranked word frequencies from the American Na- surely (a.s.) discrete and takes the form tional Corpus (circles) and power-law fit (straight lines). (Bottom) Proportion of words with a given number of occurences for the X W = w δ (2) same dataset (circles) and power-law fit (straight lines). k θk k≥1

where (wk, θk)k≥1 are the points of a Poisson Double power-law in empirical data. There is a grow- with mean measure ρ(dw)H(dθ). H is some probability ing empirical evidence that some datasets may exhibit a distribution on Θ, and ρ is a Levy´ measure on (0, ∞). We double power-law regime when the sample size is large write W ∼ CRM(ρ, H). A popular CRM is the generalized enough. Examples include word frequencies in natural lan- (GGP) (Hougaard, 1986; Brix, 1999) with guages (Ferrer i Cancho & Sole,´ 2001; Montemurro, 2001; Levy´ measure Gerlach & Altmann, 2013; Font-Clos et al., 2013), Twit- ter rates and retweet distributions (Bild et al., 2015), or 1 ρ (dw; σ, ζ) = w−1−σe−ζwdw (3) degree distributions in social (Csanyi´ & Szendroi,˝ 2004), GGP Γ(1 − σ) communication (Seshadri et al., 2008) or transportation net- works (Paleari et al., 2010). In the case of word frequencies where σ ∈ (0, 1) and ζ ≥ 0 or σ ≤ 0 and ζ > 0. The GGP for example, it is conjectured that high frequency words admits as special case the gamma process (σ = 0, ζ > 0) approximately follow a power-law with Zipfian exponent and the (σ ∈ (0, 1), ζ = 0). If approximately equal to 1, while the low frequency words Z ∞ follow a power-law with a higher exponent. An illustration ρ(dw) = ∞ (4) is given in Figure 1, which shows the word frequencies of 0 about 300,000 words from the American National Corpus1. then the CRM is said to be infinite-activity: it has an infinite In this paper, we introduce a class of completely random number of atoms and the weights satisfy 0 < W (Θ) = measures (CRMs), named doubly regularly-varying CRMs. P∞ k=1 wk < ∞ a.s. We can therefore construct a random We show that, when a random measure in this class is nor- probability measure P by normalizing the CRM (Regazzini malized to obtain a random probability measure P , and one et al., 2003; Lijoi et al., 2007) repeatedly samples from P , the resulting frequencies ex- hibit a double power-law behavior. Informally, the ranked W P = . (5) frequencies satisfy W (Θ)

 −1/τ We call P a normalized CRM (NCRM) and write P ∼ C1k for small rank k f(k) ' −1/α (1) NCRM(ρ, H). The Pitman-Yor process with parame- C2k for large rank k ters θ ≥ 0 and α ∈ [0, 1) and distribution H, written 1http://www.anc.org/data/anc-second-release/frequency-data/ P ∼ PY(α, θ, H) admits a representation as a (mixture of) Models with double power-law behavior

CRMs (Pitman & Yor, 1997, Proposition 21). If θ, α > 0 it 3.2. Properties is a mixture of normalized generalized gamma processes In the following, let w(1) ≥ w(2) ≥ ... denote the ordered  θ 1  η ∼ Gamma , (6) weights of the CRM. The first proposition states that, if α α the CRM is regularly varying at 0 with exponent α > 0, the small weights asymptotically scale as a power-law (up P | η ∼ NCRM(η ρGGP(·; α, 1),H) (7) to a slowly varying function). Its proof is given in the and for θ = 0, it is a normalized stable process Supplementary material. P ∼ NCRM(ρ (·; α, 0),H). (8) GGP Proposition 1 A CRM, regularly varying at 0 with exponent Although this representation is more complicated than the α > 0, satisfies usual stick-breaking or urn constructions of the PY, it will w ∼ k−1/α`∗(k) as k → ∞ (11) be useful later on when we will discuss its asymptotic prop- (k) 1 ∗ erties. The above construction essentially tells us that the where `1 is a slowly varying function whose expression, PY has the same asymptotic properties as the normalized which depends on `1 and α, is given in the supplementary GGP for θ > 0 and the stable process for θ = 0. material. The next proposition states that, if the CRM is regularly 3. Doubly regularly varying CRMs varying at infinity with τ > 0 and the scaling factor of the 3.1. General definition Levy´ measure is large, the CRM has a power-law behavior for large weights. We first introduce a few definitions on regularly varying functions (Bingham et al., 1989). Proposition 2 [Kevei & Mason (2014, Theorem 1.2)] Consider a CRM with mean measure ηρ(dw)H(dθ), regu- Definition 3.1 (Slowly varying function) A positive func- larly varying at ∞ with τ > 0. Then, for any k1, k2 ≥ 1 tion ` on (0, ∞) is slowly varying at infinity if for all c > 0 wτ `(ct)/`(t) → 1 as t → +∞ Examples of slowly varying (k1+k2) →d Beta(k , k ) as η → ∞. (12) wτ 1 2 functions are constant functions, functions converging to a (k1) strictly positive constant, (log t)a for any real a, etc. Note that Equation (12) indicates a power-law behavior with −1/τ Definition 3.2 (Regularly varying function) A positive exponent 1/τ, as for large η and k  1, w(k) ' w(1)k . function f on (0, ∞) is said to be regularly varying at infinity with exponent ξ ∈ R if f(x) = xξ`(x) where ` is GGP and stable process. The GGP with parameter ζ > 0 a slowly varying function. Similarly, a function f is said is regularly varying at 0 with exponent α = max(0, σ). to be regularly varying at 0 if f(1/x) is regularly varying Hence, it satisfies Proposition (1). However, the exponential at infinity, that is f(x) = x−ξ`(1/x) for some ξ ∈ R and decay of the tails of the Levy´ measure implies that it is some slowly varying function `. not regularly varying at ∞. Large weights therefore decay exponentially fast. The stable process, which is a GGP with Informally, regularly varying functions with exponent ξ 6= parameter ζ = 0 and σ ∈ (0, 1), is doubly regularly-varying 0 behave asymptotically similarly to a “pure” power-law with the same power-law exponent σ at 0 and ∞. Hence, it function g(x) = xξ. satisfies Proposition 1. Additionally, Pitman & Yor (1997, A homogeneous CRM W on Θ with mean measure Proposition 8) showed that the result of Proposition 2 holds ρ(dw)H(dθ) is said to be doubly regularly varying if its non-asymptotically for the stable process. In particular, for tail Levy´ intensity all k ≥ 1, w(k+1)/w(k) ∼ Beta(kσ, 1). Z ∞ In Section 3.3, we describe two general constructions for ob- ρ(x) = ρ(dw) (9) taining doubly regularly varying CRMs. Then we describe x two specific processes with doubly regularly varying tail is regularly varying at 0 and ∞, that is Levy´ measure where one can flexibly tune both exponents.  −α x `1(1/x) as x → 0 In the rest of the paper, we assume that the Levy´ measure ρ is ρ(x) ∼ −τ (10) x `2(x) as x → ∞ absolutely continuous with respect to the , and use the same notation for its density ρ(dw) = ρ(w)dw. where α ∈ [0, 1], τ ≥ 0 and `1 and `2 are slowly varying functions. The CRM is said to be doubly power-law if 3.3. Construction of doubly regularly varying CRMs it is doubly regularly varying with exponents α > 0 and τ > 0. Note that in this case, the CRM necessarily satisfies Scaled-CRM. A first way of constructing a doubly regu- condition (4) and is therefore infinite activity. larly varying CRMs is to consider a CRM, regularly varying Models with double power-law behavior at 0, and to divide its weights by independent and identically If we additionally assume that ρ0(x) has light tails at infinity distributed (iid) random variables, whose cumulative density (e.g. exponentially decaying tails), then the resulting CRM ρ function (cdf) is also regularly varying at 0. More precisely, is then doubly regularly varying and satisfies Equation (10). let For example, one can take for ρ0 the Levy´ density (3) of a GGP, and for f the pdf of a Pareto, generalized Pareto or X w0k W = δθk (13) inverse . zk k≥1 3.4. Generalized BFRY process where (z1, z2,...) are strictly positive, continuous and iid random variables with cumulative density function FZ (z) Consider the Levy´ density and locally bounded probability density function fz(z), and 1 X ρ(w) = w−1−τ γ(τ − σ, cw) (17) W0 = w0kδθk ∼ CRM(ρ0,H) Γ(1 − σ) k≥1 R x κ−1 −u where γ(κ, x) = 0 u e du is the lower incomplete where ρ0(x) and FZ (z) are both regularly varying functions gamma function and the parameters satisfy σ ∈ (−∞, 1), at 0, that is, for some α ∈ (0, 1) and τ > α, τ > max(0, σ) and c > 0. We have

−α ρ0(x) ∼ x `1(1/x) (14) Γ(τ − σ) −τ τ ρ(x) ∼ x (18) FZ (z) ∼ z `2(1/z). (15) τΓ(1 − σ)

The random measure W is a CRM W ∼ CRM(ρ, H) where as x tends to infinity and, for σ > 0, Z ∞ τ−σ c −σ ρ(w) = zfZ (z)ρ0(wz)dz. ρ(x) ∼ x (19) 0 σ(τ − σ)Γ(1 − σ) The next proposition shows that W is doubly regularly vary- as x tends to 0. When σ ≤ 0, ρ(x) is a slowly vary- ing. ing function, with limx→0 ρ(x) = ∞ if σ = 0 and limx→0 ρ(x) < ∞ if σ < 0. ρ(x) therefore satisfies Equa- Proposition 3 Assume that ρ0 and FZ verify Equa- tion (10) with α = max(σ, 0). When σ > 0, it is doubly tions (14) and (15). Additionally, suppose xρ(x) and fz power-law with exponent σ ∈ (0, 1) and τ > 0. are ultimately bounded and that there exists β > τ, such R ∞ β The Levy´ density (17) admits the following latent construc- that µβ = 0 w ρ0(w)dw < ∞. Then the CRM W de- fined by Equation (13) is doubly regularly varying, with tion as a scaled-GGP. Note that τ−σ 1  −α −α c Z (Z )x `1(1/x) as x → 0 E ρ(w) = z ρGGP(wz; σ, c)fZ (z)dz ρ(x) ∼ −τ . µτ x `2(x) as x → ∞ τ 0

τ−1 where Z is a random variable with cdf FZ . where fZ (z) = τz is the probability density function of a Beta(τ, 1) random variable. We therefore have the In Sections 3.4 and 3.5 we present two specific models hierarchical construction. For k ≥ 1, constructed via a scaled GGP. w w = 0k , β ∼ Beta(τ, 1). k β k Discrete Mixture. An alternative to the scaled-CRM con- k struction is to consider that the CRM is the sum of two where (w0k)k≥1 are the points of a Poisson process with CRMs, one regularly varying at 0 (hence infinite activity), τ−σ mean measure c /τ ρGGP(w0; σ, c)dw0. the second one regularly varying at infinity. More precisely, consider the Levy´ density The process is somewhat related to, and can be seen as a natural generalization of the BFRY distribution (Pitman & ρ(w) = ρ0(w) + βf(w) (16) Yor, 1997; Winkel, 2005; Bertoin et al., 2006). The name was coined by Devroye & James (2014) after the work where ρ0 is a Levy´ measure, regularly varying at 0, and f is of Bertoin, Fujita, Roynette and Yor. This distribution has the probability density function of a random variable with recently found various applications in (Lee power-law tails. That is ρ0 satisfies (14) and et al., 2016; 2017). Taking c = 1, τ ∈ (0, 1) and σ = Z ∞ τ − 1 < 0, we have f(t)dt ∼ x−τ ` (x) as x → ∞. 2 −τ−1 −w x ρ(w) ∝ w (1 − e ) Models with double power-law behavior which corresponds to the unnormalized pdf of a BFRY ran- 4. Normalized CRMs with double power-law dom variable. The BFRY random variable admits a repre- sentation as the ratio of a gamma and beta random variable, For some H,Levy´ measure ρ satis- and the introduced in this section, which fying Equation (4) and η > 0, let admits a similar construction, can be seen as a natural gener- W P = where W ∼ CRM(ηρ, H) alization of the BFRY distribution, and we call this process W (Θ) a generalized BFRY (GBFRY) process. In Section 4 of the supplementary material, we provide more details on the i.i.d. and for i = 1, . . . , n, Xi | P ∼ P. As P is a.s. dis- BFRY distribution and its generalization. crete, there will be repeated values within the sequence (Xi)i≥1. Let Kn ≤ n be the number of unique values 3.5. Beta prime process in (X1,...,Xn), and mn,(1) ≥ mn,(2) ≥ ... ≥ mn,(Kn) Consider the Levy´ density their ranked multiplicities. For k = 1,...,Kn, denote mn,(k) fn,(k) = n the ranked frequencies. Γ(τ − σ) ρ(w) = w−1−σ(c + w)σ−τ (20) Γ(1 − σ) 4.1. Double power-law properties where σ ∈ (−∞, 1), τ > 0 and c > 0. This density is an The following theorem provides a precise formulation of extension of the beta prime (BP) process, with an additional Equation (1) and shows that the ranked frequencies have a tuning parameter. This process was introduced by Broderick double power-law regime when the CRM is doubly regularly et al. (2015) and generalized by Broderick et al. (2018), as varying with stricly positive exponents. a conjugate prior for odds . We have Theorem 1 The ranked frequencies satisfy Γ(τ − σ) ρ(x) ∼ x−τ (21)  w w  τΓ(1 − σ) f , f ,... → (1) , (2) ,... (23) n,(1) n,(2) W (Θ) W (Θ) as x tends to infinity and, for σ > 0, almost surely as n tends to infinity. If the CRM is regularly cσ−τ Γ(τ − σ) varying at 0 with exponent α > 0 we have ρ(x) ∼ x−σ (22) σΓ(1 − σ) w(k) −1 −1/α ∗ ∼ W (Θ) k `1(k) as k → ∞. (24) as x tends to 0. When σ ≤ 0, ρ(x) is a slowly vary- W (Θ) ing function, with lim ρ(x) = ∞ if σ = 0 and x→0 If the CRM is regularly varying at ∞ with exponent τ > 0 lim ρ(x) < ∞ if σ < 0. ρ(x) therefore satisfies Equa- x→0 we have, for any k , k ≥ 1 tion (10) with α = max(σ, 0). When σ > 0, it is doubly 1 2 power-law with exponent σ ∈ (0, 1) and τ > 0. wτ (k1+k2) →d Beta(k , k ) as η → ∞. (25) wτ 1 2 The BP process is related to the stable beta process (Teh & (k1) Gorur, 2009) with Levy´ density Equation (23) in Theorem 1 follows from (Gnedin et al., αΓ(τ − σ) u−1−σ(1 − u)τ−11 , 2007, Proposition 26). Equations (24) and (25) follow from cτ Γ(1 − σ) u∈(0,1) Propositions 1 and 2. Instead of expressing the power-law cu properties in terms of the ranked frequencies, we can alter- via the transformation w = 1−u . Similarly to the gener- alized BFRY model, the beta prime process can also be natively look at the asymptotic behavior of the number Kn,j obtained via a scaled GGP. Note that of elements with multiplicity j ≥ 1, defined by

Z ∞ K −τ n ρ(w) = Γ(τ)c y ρGGP(wy; σ, c)fY (y)dy X Kn,j = 1m =j. (26) 0 n,(k) k=1 τ τ−1 −cy f (y) = c y e Gamma(τ, c) where Y Γ(τ) is the density of a Kn,j P Let pn,j = . Note that pn,j = 1. The following random variable. We therefore have the following hierarchi- Kn j≥1 is a corollary of Equation (24). It follows from Proposition cal construction, for k ≥ 1 23 and Corollary 21 in (Gnedin et al., 2007). w0k wk = , γk ∼ Gamma(τ, c) γk Corollary 2 If the CRM is regularly varying at 0 with ex- ponent α, we have where (w0k)k≥1 are the points of a Poisson process with −τ mean measure c Γ(τ) ρGGP(w0; σ, 1)dw0. pn,j → pj a.s. as n → ∞ (27) Models with double power-law behavior where If ψ and κ have analytic forms, one can derive a MCMC sampler to approximate the posterior by successively up- σΓ(j − α) α 1 dating U and φ . Unfortunately, this is not the case for our pj = ∼ 1+α for large j. j!Γ(1 − α) Γ(1 − α) j models. For instance, in the generalized BFRY process case, we have Figure 2 shows some illustration of these empirical results η Z c for the GBFRY model. ψ(t; φ) = ((y + t)σ − yσ)yτ−σ−1dy (31) σ 0 Remark 1 The GGP with parameter σ > 0 is regularly ηΓ(m − σ) Z c yτ−σ−1 κ(m, t; φ) = m−σ dy. (32) varying at 0, but not at infinity. Hence, the normalized Γ(1 − σ) 0 (y + t) GGP with ζ > 0 and the related Pitman-Yor process with θ > 0 satisfy Equation (24) and (27) but not (25), due to We may resort to a numerical integration algorithm to ap- the exponentially decaying tails of the Levy´ measure of the proximate ψ as only one evaluation of this function is GGP. The normalized GGP with ζ = 0, which is the same needed at each iteration. We could do the same for κ. How- as the Pitman-Yor with θ = 0, satisfies both equations, but ever, this would require Kn numerical integrations at each with the same exponent σ ∈ (0, 1), lacking the flexibility of step of the MCMC sampler, which is computationally pro- the three models presented in Section 3. hibitive for large Kn. Instead, building on the construction of the generalized BFRY as a scaled generalized gamma process described in Section 4, we introduce a set of latent 4.2. Posterior Inference variables Y = (Yk)j=1,...,Kn whose conditional density is In this subsection, we briefly discuss the inference procedure written as for estimating the parameters of the normalized CRMs we in- yτ−σ−1 k 1 troduced in Section 3. Additional details are provided in the p(yk|u, (mn,(k))k=1,...,Kn ) ∝ m −σ 0 0 ranked counts. Then we can alternate between updating φ gives the same random probability measure P . In partic- and U via Metropolis-Hastings and updating Y via Hamil- ular, the normalized CRMs with Levy´ densities ρ(w) and tonian Monte-Carlo (HMC) (Duane et al., 1987; Neal et al., ρe(w) = ξρ(ξw) have the same distribution. To avoid over- 2011) to estimate the posterior. See the supplementary ma- parameterisation we set the parameter c = 1 in the GBFRY terial for more details. A similar strategy can be used for and BP processes, and estimate the parameter φ = (σ, τ, η). the beta prime process. We introduce a latent variable U | W ∼ Gamma(n, W (Θ)). Using Proposition 3 of James 5. Experiments et al. (2009) (see also Pitman (2003)) and Equation (2.2) of Pitman (2006)), the joint density is written as We run the algorithms described in Section 4.2 for the GBFRY and BP models. We fix c = 1 to avoid overpa-  p (mn,(k))k=1,...,Kn , u, φ rameterisation, as explained in Section 4.2. We use standard

Kn normal prior on log η, log τ and logit σ. The proposed mod- n−1 −ψ(u;φ) Y ∝ p(φ)u e κ(mn,(k), u; φ) (28) els are compared to the normalized GGP with the same k=1 priors on η and σ and fixed ζ = 1, and the PY process with standard normal prior on log θ and logit α. We also where the normalizing constant only depends on n and the considered the discrete mixture construction described in ranked counts, and Section 3.3 with ρ0 taken to be a GGP, and f a Pareto or gen- Z ∞ eralized Pareto distribution. While we were able to recover ψ(t; φ) = η (1 − e−tw)ρ(w; φ)dw, (29) the parameters on simulated data, this model was under- 0 performing on real data, and results are not reported. The Z ∞ κ(m, t; φ) = η wme−twρ(w; φ)dw. (30) codes to replicate our experiments can be found in https: 0 //github.com/OxCSML-BayesNP/doublepowerlaw. Models with double power-law behavior

Figure 2. Simulated data from the normalized GBFRY model. Proportion of clusters of a given size for (First) η = 4000, τ = 3, σ = 0.2 with varying n and (Second) η = 4000, τ = 3, n = 107 with varying of σ. Ordered frequencies, normalized by the largest one, for (Third) n = 106, σ = 0.2, τ = 3 with varying η and (Fourth) n = 106, σ = 0.2, η = 50000 with varying τ .

We stress that the objective is to show that the proposed Table 1. Average Kolmogorov-Smirnov divergence between the models provide a better fit than alternative models, not to data and the posterior predictive. Lower is better. test the double power-law assumption. Dataset GBFRY Beta Prime GGP PY 5.1. Synthetic data Englishbooks 0.072 0.041 0.12 0.12 Frenchbooks 0.064 0.032 0.11 0.11 We sample simulated datasets from the normalized GBFRY NIPS1000 0.041 0.081 0.08 0.059 and the BP with parameters σ = 0.1, τ = 2, c = 1 and η = ANC 0.033 0.034 0.082 0.081 4000. We run the MCMC algorithm described in Section 4.2 Twitter 0.10 0.047 0.25 0.26 with 100 000 iterations. The 95% credible intervals are σ ∈ (0.09, 0.12), τ ∈ (1.6, 2.2) for the BFRY and σ ∈ (0.08, 0.11), τ ∈ (1.8, 2.3) for the BP, indicating that the & Dempsey, 2018; Cai et al., 2016). In this case, the MCMC recovers true parameters. Trace plots are reported atoms of W represent the nodes of the graph, and each in the supplementary material. directed edge (Xi,Yi) from node Xi to node Yi is sampled independently from P × P . Note that when P is a 5.2. Real data Pitman-Yor process, the associated model corresponds We then consider five real datasets, four of which are word to the urn-based Hollywood model of Crane & Dempsey frequencies in natural languages, and the last is the out- (2018). Here, we only consider the out-degree distribution. degree distribution of a Twitter network. We first provide a Therefore, n represents the number of directed edges and description of the different datasets. X1, .., Xn the source nodes of the directed edges sampled from the normalized CRM P . mn,(k) corresponds to the Word frequencies. Each dataset is composed of n words kth largest out-degree in the network. We consider a subset X1, .., Xn, with Kn ≤ n unique words. The counts mn,(k) of 25 millions tweets of August 2009 from Twitter (Yang & represent the number of occurences of the kth most fre- Leskovec, 2011). We construct a directed multigraph by quent word in the dataset. The first dataset is the written adding an edge (Xi,Yi) whenever user Xi mentions user dataset of the American National Corpus2 (ANC), com- Yi (with @) in tweet i. The resulting graph contains about posed of about 18 million word occurences and 300 000 4 millions edges and 300 000 source nodes. unique words. The second and third datasets are the words of a collection of most popular English books and French Results books, downloaded from the Project Gutenberg3. The En- glish books dataset is composed of about 3 million words For each of the four models and each dataset, we approx- and 71 000 unique words, the French books of about 7 mil- imate the posterior distribution of the parameters φ of the lion words and around 135 000 unique words. The fourth Levy´ measure, and sample new datasets from the poste- dataset represents the words of a thousand papers from rior predictive. The 95% credible intervals of the posterior the NIPS conference. It contains about 2 million word oc- predictive for the proportion of occurences and ranked fre- curences and 68 000 unique words. quencies are reported in Figure 3 for the ANC dataset (plots for the other datasets are given in the supplementary ma- Twitter network. We consider a rank-1 edge- terial). As the results for the normalized GGP and PY are exchangeable model for directed multigraphs (Crane almost identical, we only show the plot for the PY model. 2http://www.anc.org/data/anc-second-release/frequency-data/ As can clearly be seen from the posterior predictive plots, all 3http://www.gutenberg.org/ models provide a good fit for low frequencies. However, the Models with double power-law behavior

Table 2. 95% posterior credible intervals of the power-law exponents. GBFRY Beta Prime GGP PY Dataset σ τ σ τ σ σ Englishbooks (0.351, 0.362) (0.912, 0.980) (0.345, 0.358) (0.974, 1.078) (0.416, 0.423) (0.416, 0.423) Frenchbooks (0.368, 0.375) (0.967, 1.039) (0.363, 0.371) (1.04, 1.175) (0.407, 0.412) (0.407, 0.412) NIPS1000 (0.538, 0.545) (1.338, 1.906) (0.538, 0.545) (1.541, 2.286) (0.542, 0.548) (0.542, 0.549) ANC (0.433, 0.438) (0.998, 1.055) (0.431, 0.436) (1.09, 1.17) (0.461, 0.465) (0.461, 0.465) Twitter (0.282, 0.287) (1.590, 1.600) (0.099, 0.116) (1.336, 1.411) (0.272, 0.277) (0.272, 0.277)

(a) GBFRY (b) BP (c) PY

(d) GBFRY (e) BP (f) PY

Figure 3. Results on the ANC dataset: 95% credible interval of the posterior predictive in blue, data in red. (Top) Proportion of occurences of a given size. (Bottom) Ranked occurences.

PY model (and similar the normalized GGP) fail to capture models based on exchangeable point processes (Caron & the power-law behavior for large frequencies. This behavior Fox, 2017). Building hierarchical versions of such mod- is better captured by the GBFRY and BP models. To illus- els as for the hierarchical Pitman-Yor process (Teh, 2006) trate quantitatively the comparison, we compute the average would also be of interest. Finally, it would be useful to reweighted Kolmogorov-Smirnov divergence (Clauset et al., explore the connections between the models presented here 2009) between the true data and the posterior predictive for and the two-stage urn process suggested by Gerlach & Alt- each model, and report the results in Table 1. Finally, we mann (2013) and investigate if other urn schemes could be report in Table 2 the 95% credible intervals of the param- derived that provably exhibit a double power-law behavior. eters for each model and dataset. We can remark that to the exception of the NIPS dataset, we recover the Zipfian Acknowledgments The authors thank Valerio Perrone for exponent τ = 1 for large frequencies in text datasets. providing the NIPS dataset. JL and FC’s research leading to these results has received funding from European Re- 6. Conclusion search Council under the European Unions Seventh Frame- work Programme (FP7/2007-2013) ERC grant agreement In this paper we presented a novel class of random mea- no. 617071 and from EPSRC under grant EP/P026753/1. sures with double power-law behavior. We focused on the FC acknowledges support from the Alan Turing Institute un- case of iid sampling from a normalized completely random der EPSRC grant EP/N510129/1. JL acknowledges support measure. More generally, one could build on this class of from IITP grant funded by the Korea government(MSIT) models for other CRM-based constructions. In particular, (No.2017-0-01779, XAI) and Samsung Research Funding & it would be interesting to explore the asymptotic degree Incubation Center under project number SRFC-IT1702-15. distribution when such models are used for Models with double power-law behavior

References Duane, S., Kennedy, A. D., Pendleton, B. J., and Roweth, D. Hybrid monte carlo. Physics letters B, 195(2):216–222, Bertoin, J., Fujita, T., Roynette, B., and Yor, M. On a 1987. particular class of self-decomposable random variables: the durations of Bessel excursions straddling independent Ferrer i Cancho, R. and Sole,´ R. V. Two regimes in the exponential times. 2006. frequency of words and the origins of complex lexicons: Zipf’s law revisited. Journal of Quantitative Linguistics, Bild, D. R., Liu, Y., Dick, R. P., Mao, Z. M., and Wallach, 8(3):165–173, 2001. D. S. Aggregate characterization of user behavior in Twit- ter and analysis of the retweet graph. ACM Transactions Font-Clos, F., Boleda, G., and Corral, A. A scaling law on Internet Technology (TOIT), 15(1):4, 2015. beyond Zipf’s law and its relation to Heaps’ law. New Journal of Physics, 15(9):093033, 2013. Bingham, N. H., Goldie, C. M., and Teugels, J. L. Regular Gerlach, M. and Altmann, E. G. Stochastic model for the variation, volume 27. Cambridge university press, 1989. vocabulary growth in natural languages. Physical Review Brix, A. Generalized gamma measures and shot-noise Cox X, 3(2):021006, 2013. processes. Advances in Applied Probability, 31(4):929– Gnedin, A., Hansen, B., and Pitman, J. Notes on the oc- 953, 1999. cupancy problem with infinitely many boxes: general asymptotics and power laws. Probability surveys, 4:146– Broderick, T., Mackey, L., Paisley, J., and Jordan, M. I. 171, 2007. Combinatorial clustering and the beta negative binomial process. IEEE transactions on pattern analysis and ma- Goldwater, S., Johnson, M., and Griffiths, T. L. Interpolat- chine intelligence, 37(2):290–306, 2015. ing between types and tokens by estimating power-law generators. In Advances in neural information processing Broderick, T., Wilson, A. C., and Jordan, M. I. Posteri- systems, pp. 459–466, 2006. ors, conjugacy, and exponential families for completely random measures. Bernoulli, 24(4B):3181–3221, 2018. Hougaard, P. Survival models for heterogeneous populations derived from stable distributions. Biometrika, 73(2):387– Cai, D., Campbell, T., and Broderick, T. Edge-exchangeable 396, 1986. graphs and sparsity. In Lee, D. D., Sugiyama, M., James, L. F., Lijoi, A., and Prunster,¨ I. Posterior analysis Luxburg, U. V., Guyon, I., and Garnett, R. (eds.), Ad- for normalized random measures with independent incre- vances in Neural Information Processing Systems 29, pp. ments. Scandinavian Journal of Statistics, 36(1):76–97, 4249–4257. Curran Associates, Inc., 2016. 2009. Caron, F. Bayesian nonparametric models for bipartite Kevei, P. and Mason, D. M. The limit distribution of ratios graphs. In Advances in neural information processing of jumps and sums of jumps of subordinators. ALEA, 11 systems, 2012. (2):631–642, 2014. Caron, F. and Fox, E. B. Sparse graphs using exchangeable Kingman, J. Completely random measures. Pacific Journal random measures. Journal of the Royal Statistical Soci- of Mathematics, 21(1):59–78, 1967. ety: Series B (Statistical Methodology), 79(5):1295–1366, 2017. Lee, J., James, L. F., and Choi, S. Finite-dimensional BFRY priors and variational Bayesian inference for power law Clauset, A., Shalizi, C. R., and Newman, M. E. Power- models. In Advances in Neural Information Processing law distributions in empirical data. SIAM review, 51(4): Systems, pp. 3162–3170, 2016. 661–703, 2009. Lee, J., Heaukulani, C., Ghahramani, Z., James, L. F., and Choi, S. Bayesian inference on random simple graphs Crane, H. and Dempsey, W. Edge exchangeable models for with power law degree distributions. In International interaction networks. Journal of the American Statistical Conference on Machine Learning, pp. 2004–2013, 2017. Association, 113(523):1311–1326, 2018. Lijoi, A. and Prunster,¨ I. Models beyond the Dirichlet Csanyi,´ G. and Szendroi,˝ B. Structure of a large social process. Bayesian nonparametrics, 28(80):3, 2010. network. Physical Review E, 69(3):036131, 2004. Lijoi, A., Mena, R. H., and Prunster,¨ I. Controlling the Devroye, L. and James, L. On simulation and properties of reinforcement in Bayesian non-parametric mixture mod- the stable law. Statistical methods & applications, 23(3): els. Journal of the Royal Statistical Society: Series B 307–343, 2014. (Statistical Methodology), 69(4):715–740, 2007. Models with double power-law behavior

Mitzenmacher, M. A brief history of generative models for Sudderth, E. B. and Jordan, M. I. Shared segmentation of power law and lognormal distributions. Internet mathe- natural scenes using dependent Pitman-Yor processes. In matics, 1(2):226–251, 2004. Advances in neural information processing systems, pp. 1585–1592, 2009. Mochihashi, D., Yamada, T., and Ueda, N. Bayesian un- supervised word segmentation with nested Pitman-Yor Teh, Y. W. A hierarchical Bayesian language model based language modeling. In Proceedings of the Joint Confer- on Pitman-Yor processes. In Proceedings of the 21st In- ence of the 47th Annual Meeting of the ACL and the 4th ternational Conference on Computational Linguistics and International Joint Conference on Natural Language Pro- the 44th annual meeting of the Association for Computa- cessing of the AFNLP: Volume 1-Volume 1, pp. 100–108. tional Linguistics, pp. 985–992. Association for Compu- Association for Computational Linguistics, 2009. tational Linguistics, 2006. Montemurro, M. A. Beyond the Zipf Mandelbrot law in Teh, Y. W. and Gorur, D. Indian buffet processes with quantitative linguistics. Physica A: Statistical Mechanics power-law behavior. In Advances in neural information and its Applications, 300(3-4):567–578, 2001. processing systems, pp. 1838–1846, 2009. Neal, R. M. et al. Mcmc using hamiltonian dynamics. Hand- Winkel, M. Electronic foreign-exchange markets and pas- book of Markov Chain Monte Carlo, 2(11):2, 2011. sage events of independent subordinators. Journal of applied probability, 42(1):138–152, 2005. Newman, M. E. J. Power laws, Pareto distributions and Zipf’s law. Contemporary physics, 46(5):323–351, 2005. Wood, F., Archambeau, C., Gasthaus, J., James, L., and Paleari, S., Redondi, R., and Malighetti, P. A compara- Teh, Y. W. A stochastic memoizer for sequence data. In Proceedings of the 26th Annual International Conference tive study of airport connectivity in China, Europe and on Machine Learning US: which network provides the best service to passen- , pp. 1129–1136. ACM, 2009. gers? Transportation Research Part E: Logistics and Yang, J. and Leskovec, J. Patterns of temporal variation in Transportation Review, 46(2):198–210, 2010. online media. In Proceedings of the fourth ACM inter- Pitman, J. Exchangeable and partially exchangeable random national conference on Web search and data mining, pp. partitions. and related fields, 102(2): 177–186. ACM, 2011. 145–158, 1995. Zipf, G. The psycho-biology of language: an introduction Pitman, J. Poisson-Kingman partitions. Lecture Notes- to dynamic philology. 1935. Monograph Series, pp. 1–34, 2003. Pitman, J. Combinatorial Stochastic Processes: Ecole d’Ete´ de Probabilites´ de Saint-Flour XXXII-2002. Springer, 2006. Pitman, J. and Yor, M. The two-parameter Poisson-Dirichlet distribution derived from a stable subordinator. The An- nals of Probability, pp. 855–900, 1997. Regazzini, E., Lijoi, A., and Prunster,¨ I. Distributional results for means of normalized random measures with independent increments. The Annals of Statistics, 31(2): 560–585, 2003. Sato, I. and Nakagawa, H. Topic models with power-law using pitman-yor process. In Proceedings of the 16th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 673–682. ACM, 2010. Seshadri, M., Machiraju, S., Sridharan, A., Bolot, J., Falout- sos, C., and Leskovec, J. Mobile call graphs: beyond power-law and lognormal distributions. In Proceedings of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 596–604. ACM, 2008.