<<

Hierarchical Beta Processes and the Indian Buffet Process

Romain Thibaux Michael I. Jordan Dept. of EECS Dept. of EECS and Dept. of University of California, Berkeley University of California, Berkeley Berkeley, CA 94720 Berkeley, CA 94720

Abstract variables. The factorial representation has several ad- vantages. First, the Bernoulli variables may have a natural interpretation as “featural” descriptions of ob- We show that the beta process is the de jects. Second, the representation of objects in terms Finetti distribution underlying the In- of sets of Bernoulli variables provides a natural way dian buffet process of [2]. This result shows to define interesting topologies on clusters (e.g., as the that the beta process plays the role for the number of features that two clusters have in common). Indian buffet process that the Dirichlet pro- Third, the number of clusters representable with m cess plays for the Chinese restaurant process, features is 2m, and thus the factorial approach may be a parallel that guides us in deriving analogs appropriate for situations involving large numbers of for the beta process of the many known ex- clusters. tensions of the . In partic- ular we define Bayesian hierarchies of beta As in the setting, it is desirable to con- processes and use the connection to the beta sider nonparametric Bayesian approaches to factorial process to develop posterior inference algo- modeling that remove the assumption that the car- rithms for the Indian buffet process. We also dinality of the set of features is known a priori. An present an application to document classifi- important first step in this direction has been pro- cation, exploring a relationship between the vided by Griffiths and Ghahramani [2], who defined hierarchical beta process and smoothed naive a on features that can be viewed Bayes models. as a factorial analog of the Chinese restaurant pro- cess. This process, referred to as the Indian buffet process, involves the metaphor of a sequence of cus- 1 Introduction tomers tasting dishes in an infinite buffet. Let Zi be a binary vector where Zi,k = 1 if customer i tastes dish k. Customer i tastes dish k with m /i, Mixture models provide a well-known probabilistic ap- k where m is the number of customers that have previ- proach to clustering in which the data are assumed k ously tasted dish k; that is, Z ∼ Ber(m /i). Having to arise from an exchangeable set of choices among i,k k sampled from the dishes previously sampled by other a finite set of mixture components. Dirichlet process customers, customer i then goes on to taste an ad- mixture models provide a nonparametric Bayesian ap- ditional number of new dishes determined by a draw proach to mixture modeling that does not require the from a Poisson(α/i) distribution. Modulo a reordering number of mixture components to be known in ad- of the features, the Indian buffet process can be shown vance [1]. The basic idea is that the Dirichlet process to generate an exchangeable distribution over binary induces a prior distribution over partitions of the data, matrices (that is, P (Z ,...Z ) = P (Z ,...Z ) a distribution that is readily combined with a prior dis- 1 n σ(1) σ(n) for any permutation σ). tribution over parameters and a likelihood. The distri- bution over partitions can be generated incrementally Given such an exchangeability result, it is natural to using a simple scheme known as the Chinese restaurant inquire as to the underlying distribution that renders process. the sequence conditionally independent. Indeed, De Finetti’s theorem states that the distribution of any As an alternative to the multinomial representation underlying classical mixture models, factorial models associate to each data point a set of latent Bernoulli infinitely exchangeable sequence can be written " # 2 Z Yn P (Z1,...Zn) = P (Zi|B) dP (B), 1 i=1 where B is the random element that renders the vari- 0 0 1 ables {Zi} conditionally independent and where we will refer to the distribution P (B) as the “de Finetti 50 mixing distribution.” For the Chinese restaurant pro- cess, the underlying de Finetti mixing distribution is known—it is the Dirichlet process. As this result sug- Draw gests, identifying the de Finetti mixing distribution 0 behind a given exchangeable sequence is important; it 0 1 greatly extends the range of statistical applications of the exchangeable sequence. Figure 1: Top. A B sampled from a beta In this paper we make the following three contribu- process (blue), along with its corresponding cumula- tions: tive distribution function (red). The horizontal axis is Ω, here [0, 1]. The tips of the blue segments are 1. We identify the de Finetti mixing distribution be- drawn from a Poisson process with base measure the hind the Indian buffet process. In particular, in L´evymeasure. Bottom. 100 samples from a Bernoulli Sec. 4 we show that this distribution is the beta process with base measure B, one per line. Samples process. We also show that this connection mo- are sets of points, obtained by including each point ω tivates a two-parameter generalization of the In- independently with probability B({ω}). dian buffet process proposed in [3]. While the beta process has been previously studied for its subsets S ,...S of Ω are independent1. The L´evy- applications in survival analysis, this result shows 1 k Khinchine theorem [5, 8] implies that a positive L´evy that it is also the natural object of study in non- process is uniquely characterized by its L´evymeasure parametric Bayesian factorial modeling. (or compensator), a measure on Ω × R+. 2. In Sec. 5 we exploit the link between the beta Definition. A beta process B ∼ BP(c, B ) is a pos- process and the Indian buffet process to provide 0 itive L´evyprocess whose L´evymeasure depends on a new algorithm to sample beta processes. two parameters: c is a positive function over Ω that 3. In Sec. 6 we define the hierarchical beta process, we call the concentration function, and B0 is a fixed an analog for factorial modeling of the hierarchical measure on Ω, called the base measure. In the special Dirichlet process [11]. The hierarchical beta pro- case where c is a constant it will be called the concen- cess makes it possible to specify models in which tration parameter. We also call γ = B0(Ω) the mass features are shared among a number of groups. parameter. We present an example of such a model in an If B is continuous, the L´evymeasure of the beta pro- application to document classification in Sec. 7, 0 cess is where we also explore the relationship of the hi- erarchical beta process to naive Bayes models. −1 c(ω)−1 ν(dω, dp) = c(ω)p (1 − p) dpB0(dω) (1) 2 The beta process on Ω×[0, 1]. As a function of p, it is a degenerate , justifying the name. ν has the following The beta process was defined by Hjort [4] for appli- elegant interpretation. To draw B ∼ BP(c, B0), draw cations in survival analysis. In those applications, a set of points (ωi, pi) ∈ Ω × [0, 1] from a Poisson pro- the beta process plays the role of a distribution on cess with base measure ν (see Fig. 1), and let: functions (cumulative hazard functions) defined on the X positive real line. In our applications, the sample paths B = piδωi (2) of the beta process need to be defined on more general i spaces. We thus develop a nomenclature that is more where δ is a unit point mass (or atom) at ω. This suited to these more general applications. ω 1Positivity is not required to define L´evyprocesses but A positive random measure B on a space Ω (e.g., greatly simplifies their study, and positive L´evyprocesses R) is a L´evyprocess, or independent increment pro- are sufficient here. On Ω = R, positive L´evyprocesses are cess, if the masses B(S1),...B(Sk) assigned to disjoint also called subordinators. X implies B(S) = pi for all S ⊂ Ω. a beta process with modified parameters: i:ωi∈S Ã ! c 1 Xn As this representation shows, B is discrete and the B|X ∼ BP c + n, B + X . (5) 1...n c + n 0 c + n i pairs (ωi, pi) correspond to the location ωi ∈ Ω and i=1 weight pi ∈ [0, 1] of its atoms. Since ν(Ω × [0, 1]) = ∞ the Poisson process generates infinitely many points, That is, the beta process is conjugate to the Bernoulli making (2) a countably infinite sum. Nonetheless, as process. This result can also be derived from Corol- shown in the appendix, its expectation is finite if B0 lary 4.1 of Hjort [4]. is finite. P 2 4 Connection to the Indian buffet If B0 is discrete , of the form B0 = qiδω , then B Pi i process has atoms at the same locations B = i piδωi with

pi ∼ Beta(c(ωi)qi, c(ωi)(1 − qi)). (3) We now present the connection between the beta pro- cess and the Indian buffet process. The first step is to This requires qi ∈ [0, 1]. If B0 is mixed discrete- marginalize out B to obtain the continuous, B is the sum of the two independent con- of X1. Independence of X1 on disjoint intervals is pre- tributions. served, so X1 is a L´evyprocess. Since it gives mass 0 or 1 to singletons its L´evymeasure is of the form 3 The (4), so X1 is still a Bernoulli process. Its expectation is E(X1) = E(E(X1|B)) = E(B) = B0, so its hazard measure is B .3 Definition. Let B be a measure on Ω. We define 0 a Bernoulli process with hazard measure B, written Combining this with Eq. (5) and using X ∼ BeP(B), as the L´evyprocess with L´evymeasure P (Xn+1|X1...n) = EB|X1...n P (Xn+1|B) gives us the following formula, which we rewrite using the µ(dp, dω) = δ1(dp)B(dω). (4) notation mn,j, the number of customers among X1...n having tried dish ωj: If B is continuous, X is simply a Poisson process with P Ã ! intensity B: X = N δ where N ∼ Poi(B(Ω)) n i=1 ωi c 1 X and ω are independent draws from the distribution Xn+1|X1...n ∼ BeP B0 + Xi i P c + n c + n B/B(Ω). If B is discrete, of the form B = p δ , i=1 P i i ωi   then X = b δ where the b are independent i i ωi i c X m Bernoulli variables with the probability that b = 1 = BeP  B + n,j δ  .(6) i c + n 0 c + n ωj equal to pi. If B is mixed discrete-continuous, X is j the sum of the two independent contributions. To make the connection to the Indian buffet process In summary, a Bernoulli process is similar to a Poisson let us first assume that c is a constant and B0 is contin- process, except that it can give weight at most 1 to uous with finite total mass B0(Ω) = γ. Observe what singletons, even if the base measure B is discontinuous, happens when we generate X1...n sequentially using for instance if B is itself drawn from a beta process. Eq. (6). Since X1 ∼ BeP(B0) and B0 is continuous, X1 We can intuitively think of Ω as a space of potential is a Poisson process with intensity B0. In particular, “features,” and X as an object defined by the features the total number of features of X1 is X1(Ω) ∼ Poi(γ). it possesses. The random measure B encodes the prob- This corresponds to the first customer trying a Poi(γ) ability that X possesses each particular feature. In the number of dishes. Indian buffet metaphor, X is a customer and its fea- Separating the base measure of Eq. (6) into its contin- tures are the dishes it tastes. uous and discrete parts, we see that Xn+1 is the sum of Conjugacy. Let B ∼ BP(c, B0), and let Xi|B ∼ two independent Bernoulli processes: Xn+1 = U + V P mn,j BeP(B) for i = 1, . . . n be n independent Bernoulli where U ∼ BeP( j c+n δωj ) has an atom at ωj mn,j process draws from B. Let X1...n denote the set (tastes dish j) with independent probability and of observations {X ,...,X }. Applying theorem 3.3 c + n 1 n V ∼ BeP( c B ) is a Poisson process with intensity of Kim [6] to the beta and Bernoulli processes, the c+n 0 µ ¶ cγ posterior distribution of B after observing X1...n is still c B , generating a Poi number of new fea- c+n 0 c + n 2The L´evy measure still exists, but is not as tures (new dishes). useful as in the continuous case. ν(dp, dω) = P 3 i Beta(c(ωi)qi, c(ωi)(1 − qi))(dp)δωi (dω). We show that E(B) = B0 in the Appendix. F2 and G2. By induction we get, for any n

n d X B = Bˆn + Gn where Bˆn = Fi i=1

d Since limn→∞ Bˆn = B, we can use Bˆn as an approx- imation of B. The following iterative algorithm con- structs Bˆn starting with Bˆ0 = 0. At each step n ≥ 1:

cγ • sample Kn ∼ Poi( c+n−1 ), 1 • sample Kn new locations ωj from γ B0 indepen- dently,

• sample their weight pj ∼ Beta(1, c + n − 1) inde- Figure 2: Draws from a beta process with concentra- pendently, tion c and uniform base measure with mass γ, as we P • Bˆ = Bˆ + Kn p δ . vary c and γ. For each draw, 20 samples are shown n n−1 j=1 j ωj from the corresponding Bernoulli process, one per line. The expected mass added at step n is E(Fn(Ω)) = cγ (c+n)(c+n−1) and the expected remaining mass after This is a two-parameter (c, γ) generalization of the cγ step n is E(Gn(Ω)) = . Indian buffet process, which we recover when we let c+n (c, γ) = (1, α). Griffiths and Ghahramani propose Other algorithms exist to build approximations of beta such an extension in [3]. The customers together try processes. The Inverse Levy Measure algorithm of a Poi(nγ) number of dishes, but because they tend to Wolpert and Ickstadt [12] is very general and can gen- erate atoms in decreasing order of weight, but requires try³ the same dishes´ the number of unique dishes is only Pn−1 inverting the incomplete beta function at each step, Poi γ c , roughly i=0 c+i which is computationally intensive. The algorithm of µ µ ¶¶ Lee and Kim [7] bypasses this difficulty by approximat- c + n Poi γ + γc log . (7) ing the beta process by a c + 1 but requires a fixed approximation level. This means that their algorithm only converges in distribution. This quantity becomes Poi(γ) if c → 0 (all customers share the same dishes) or Poi(nγ) if c → ∞ (no shar- Our algorithm is a simple and efficient alternative. It ing), justifying the names for is closely related to the stick-breaking construction of c and mass parameter for γ. The effect of c and γ is Dirichlet processes [10], in that it generates the atoms illustrated in Fig. 2. of B in a size-biased order.

5 An algorithm to generate beta 6 The hierarchical beta process processes The parallel with the Dirichlet process leads us to con- sider hierarchies of beta processes in a manner akin to Eq. (5), when n = 1 and B0 is continuous, the hierarchical Dirichlet processes of [11]. To mo- shows that B|X1 is the³ sum of two´ independent 1 tivate our construction, let us consider the following beta processes F1 ∼ BP c + 1, X1 and G1 ∼ ³ ´ c+1 application to document classification (to which we re- c turn in Sec. 7). BP c + 1, c+1 B0 . In particular, this lets us sam- ple B by first sampling X1, which is a Poisson process Suppose that our training data X is a list of docu- with base measure B0, then sampling F1 and G1. ments, where each document is classified by one of n P Let X = K1 δ . Since the base measure of F categories. We model a document by the set of words 1 i=1 ωj 1 it contains. In particular we do not take the num- is discrete we can apply Eq. (3), with c(ωi) = c + 1 PK1 ber of appearances of each word into account. We and qi = 1/(c + 1). We get F1 = j=1 pjδωj where assume that document Xi,j is generated by including pj ∼ Beta(1, c). j each word ω independently with a probability pω spe- G1 has concentration c + 1 and mass cγ/(c + 1). Since cific to category j. These form a discrete its base measure is continuous, we can further decom- measure Aj over the space of words Ω, and we put a pose it via Eq. (5) into two independent beta processes beta process BP(cj,B) prior on Aj. 1 Xi,j({ω}). Let x denote the set of all xij and let a denote the set of all aj. These variables form a slice of the hierarchy of their respective processes, and they 0 0 1 have the following distributions: 1

b ∼ Beta(c0b0, c0(1 − b0))

aj ∼ Beta(cjb, cj(1 − b)) (9) 0 0 1 x ∼ Ber(a ). 20 ij j

Strictly speaking, if B0 is continuous, b0 = 0 and so the prior over b is improper. We treat this by considering 0 1 0 b0 to be non-zero and taking the limit as b0 approaches zero. This is justified under the limit construction of Figure 3: Left. Graphical model for the hierarchical the beta process (see Theorem 3.1 of [4]). beta process. Right. Example draws from this model For a fixed value of b, we can average over a using con- with c0 = cj = 1 and B0 uniform on [0, 1] with mass jugacy. To average over b, we use rejection sampling; γ = 10. From top to bottom are shown a sample for we sample b from an approximation of its conditional B0, Aj and 25 samples X1,j,...X25,j. distribution and correct for the difference by rejection.

Pnj Let mj = i=1 xij. Marginalizing out a in Eq. (9) and If B is a continuous measure, implying that Ω is infi- using Γ(x + 1) = xΓ(x), the log posterior distribution nite, with probability one the Aj’s will share no atoms, of b given x is (up to a constant): an undesirable result in the practical application to documents. For categories to share words, B must be f(b) = (c0b0 − 1) log(b) + (c0(1 − b0) − 1) log(1 − b) discrete. On the other hand, B is unknown a priori, so Xn mXj −1 it must be random. This suggests that B should itself + log(cjb + i) be generated as a realization of a beta process. We j=1 i=0 thus put a beta process prior BP(c ,B ) on B. This 0 0 Xn nj −Xmj −1 allows sharing of statistical strength among categories. + log(cj(1 − b) + i). (10) In summary we have the following model, whose j=1 i=0 graphical representation is shown in Fig. 3. This posterior is log concave and has a maximum at ∗ Baseline B ∼ BP(c0,B0) b ∈ (0, 1) which we can obtain by binary search. Us-

Categories Aj ∼ BP(cj,B) ∀ j ≤ n (8) ing the concavity of log(cjb+i) for i > 0, log(cj(1−b)+ ∗ Documents X ∼ BeP(A ) ∀ i ≤ n i) for i ≥ 0 and log(1 − b) tangentially at b we obtain i,j j j the following upper bound on f (up to a constant): To classify a new document Y we need to compare its g(b) = (α − 1) log(b) − b/β probability under each category: P (Xn +1,j = Y |X) j n where X is a new document in category j. The X nj +1,j where α = c b + 1 next two subsections give a Monte Carlo inference al- 0 0 mj >0 gorithm to do this for hierarchies of arbitrarily many j=1 m −1 levels. 1 c (1 − b ) − 1 Xn Xj c and = 0 0 − j β 1 − b∗ c b∗ + i j=1 i=1 j 6.1 The discrete part n −m −1 Xn j Xj c + j . Since all elements of our model are L´evyprocesses, we c (1 − b∗) + i can partition the space Ω and perform inference sep- j=1 i=0 j arately on each part. We choose the partition that g is, up to a constant, the log density of a Gamma(α, β) has cells {ω} for each of the features ω that have been variable, which we can use as a rejection sampling pro- observed at least once, and has a single (large) cell posal distribution. Setting u = 1 − b in Eq. (10) main- containing the rest of the space. We first consider in- tains the form of f, only exchanging the coefficients. ference over the singletons {ω}, and return to inference Therefore we can choose instead to approximate 1 − b over the remaining cell in the following subsection. by a gamma variable. Among these two possible ap- Inference for {ω} deals only with the values b0 = proximations we choose the one with the lowest vari- 2 B0({ω}), b = B({ω}), aj = Aj({ω}) and xij = ance αβ . In the experiments of Sec. 7 the acceptance rate was above 90%, showing that g is a good approx- Xnj +1,j from level k imation of f. µ ¶ µ ¶ c0γ pk c0γ This algorithm gives us samples from P (b|x). In par- Dk ∼ Poi qk = Poi pk . c0 + k − 1 qk c0 + k − 1 ticular, with T samples, b1, . . . bT , we can compute the following approximation: Adding the contributions of all levels we get the fol- lowing result (which is exact for N = ∞): P (x = 1|x) = E(E(a |b, x)|x) nj +1,j j à ! N cjE(b|x) + mj X c γ = 0 Xnj +1,j (Ω) ∼ Poi pk . cj + nj c0 + k − 1 k=1 1 X where E(b|x) ≈ bt. T Using T samples bk,1, . . . bk,T from Eq. (11) we can t compute pk: µ ¯ ¶ In the end if we want samples of a we can obtain them Y ¯ nj0 ¯ easily. We can sample from the conditional distribu- Let r(b) = Ek ajt (1 − aj0t) ¯b j0 tion of aj which is, by conjugacy: Yn cjb Γ(cj0 )Γ(cj0 (1 − b) + nj0 ) aj|b, x ∼ Beta (cjb + mj, cj(1 − b) + nj − mj) . = cj + nj Γ(cj0 (1 − b))Γ(cj0 + nj0 ) j0=1 6.2 The continuous part 1 XT then p = E [r(b)] ≈ r(b ). (12) k k T k,t Let’s now look at the rest of the space, where all obser- t=1 vations are equal to zero. We approximate B on that part of the space by BˆN obtained after N steps of the 6.3 Larger hierarchies ˆ cγ algorithm of Sec. 5. BN consists of Kk ∼ Poi( c+k−1 ) atoms at each level k = 1,...N. For each atom (ω, b) We now extend model Eq. (8) to larger hierarchies such out of the Kk atoms of level k, we have the following as: hierarchy. It is similar to Eq. (9) except that it refers Baseline B ∼ BP(c ,B ) to a random location ω chosen in size-biased order. 0 0 Categories Aj ∼ BP(cj,B) ∀ j ≤ n b ∼ Beta(1, c0 + k − 1)) Subcategories Sl,j ∼ BP(cl,j ,Aj) ∀ l ≤ nj aj ∼ Beta(cjb, cj(1 − b)) (11) Documents Xi,l,j ∼ BeP(Sl,j) ∀ i ≤ nl,j xij ∼ Ber(aj) To extend the algorithm of Sec. 6.2 we draw samples We want to infer the distribution of the next observa- of a from Eq. (11) and replace b by a in Eq. (12). tion Xnj +1,j from group (or category) j, given that all Extending the algorithm of Sec. 6.1 is less immediate other observations from all other groups are zero, that since we can no longer use conjugacy to integrate out is X = 0. The locations of the atoms of Xnj +1,j will a. The must now instantiate a and b. be B0/γ distributed so we only need to know the dis- Sec. 6.1 lets us sample a|b, x, leaving us with the task of tribution of Xnj +1,j (Ω), the number of atoms. X = 0 sampling b|b0, a. Up to a constant the log conditional implies that all levels k have generated zero observa- probability of b is tions. Since each level is independent, we can reason on each level separately, where we want the posterior f2(b) = (c0b0 − 1) log(b) + (c0(1 − b0) − 1) log(1 − b) n distribution of Kk and of the variables in Eq. (11). X − [log(Γ(cjb)) + log(Γ(cj(1 − b)))] Let x = {xij|j ≤ n, i ≤ nj} and a = {aj|j ≤ n}. j=1 Let P be the probability over b, a and x defined by k Xn Eq. (11) and let q = P (x = 0). The posterior distri- k k + cjb log(aj/(1 − aj)). (13) bution of Kk is j=1 µ ¶ m c0γ Let s(x) = − log(Γ(x)) − log x. Since s is concave, f P (Kk = m|X = 0) ∝ q Poi (m) 2 k c + k − 1 ∗ µ 0 ¶ itself is concave with a maximum b in (0, 1) which we c0γ can obtain by binary search. Bounding s and log(1−b) so Kk|X = 0 ∼ Poi qk . c0 + k − 1 by their tangent yields the following upper bound g2 of f2 (omitting the constant): Let pk = Pk(xnj +1,j = 1, x = 0), then Pk(xnj +1,j = 1|x = 0) = pk/qk. Let Dk be the number of atoms of g2(b) = (α − 1) log(b) − b/β where a ities towards each other rather than towards a+b . α = c0b0 + n µ ¶ 1 c (1 − b ) − n − 1 n Xn a Such an effect could in principle be achieved using a = 0 0 + − c log j finite model with a hierarchical beta prior; however, β 1 − b∗ b∗ j 1 − a j=1 j such an approach would not permit new features that Xn do not appear in the training data. The model in ∗ ∗ + [cjψ(cjb ) − cjψ(cj(1 − b ))] . Eq. (8) allows the number of known features to grow j=1 with data, and the number of unknown features to serve as evidence for belonging to a poorly known cat- We can use this Gamma(α, β) variable, or the one ob- egory, one for which we have little training data. A tained by setting u = 1 − b in Eq. (13) as a proposal hBP gives a consistent prior for varying amounts of distribution as in Sec. 6.1. The case of b|b , a is the 0 data, whereas Laplace smoothing amounts to chang- general case for nodes of large hierarchies, so this al- ing the prior every time a new feature appears. gorithm can handle hierarchies of arbitrary depth. We compared the performance of hBP and naive 4 7 Application to document Bayes on 1000 posts from the 20 Newsgroups dataset , grouped into 20 categories. We chose an unbalanced classification dataset, with the number of documents per category decreasing linearly from 100 to 2. We randomly se- Naive Bayes is a very simple yet powerful probabilistic lected 40% of these papers as a test set for a classifi- model used for classification. It models documents as cation task. We encoded the documents Xij as a set lists of features, and assumes that features are inde- of binary features representing the presence of words. pendent given the category. Bayes’ rule can then be All words were used without any pruning or feature used on new documents to infer their category. This selection. method has been used successfully in many domains despite its simplistic assumptions. We used the model in Eq. (8), setting the parame- ters c0, γ and cj a priori in the following way. Since Naive Bayes does suffer however from several known we expect a lot of commonalities between categories, shortcomings. Consider a binary feature ω and let pj,ω with differences concentrated on a few words only, be the probability that a document from category j has we take cj to be small. Therefore documents drawn feature ω. Estimating pj,ω as its maximum likelihood from Eq. (8) are close to being drawn from a common mj,ω/nj,ω leads to many features having probability 0 BP(c0, γ) prior, under which the expected number of or 1, making inference impossible. To prevent such ex- features per document is γ. Estimating this value from treme values, pj,ω is generally estimated with Laplace the data gives γ = 150. Knowing γ we can solve for c0 smoothing, which can be interpreted as placing a com- by matching the expectation of Eq. (7) to the number mj,ω + a mon Beta(a, b) prior on pj,ω:p ˆj,ω = . of unique features N in the data. This can be done by n + a + b j,ω interpreting Eq. (7) as a fixed point equation: Laplace smoothing also corrects for unbalanced train- F − γ ing data by imposing greater smoothing on the proba- c ←− (log ((c + n)/ + 1)))−1 bilities of small categories, for which we have low con- 0 γ 0 0 fidence. Nonetheless, Laplace smoothing can lead to paradoxes with unbalanced data [9]. Consider the situ- leading to c0 = 70. Finally we selected the value of cj by cross-validation on a held-out portion of the train- tation where most categories u have enough data to −4 ing set, giving us cj = 10 . show with confidence that pu,ω is close to a very small valuep ¯. The impact on classification of pj,ω is relative We then ran our Monte Carlo inference procedure and to pu,ω for u 6= j so if category j has little data, we classified each document Y of the test set by finding expect p to be close top ¯ for it to have little im- j,ω the class for which P (Xnj +1,j = Y |X) was highest, pact. Laplace smoothing however brings it close to obtaining 58% accuracy. a a+b , very far fromp ¯, where it will have an enormous impact. This inconsistency makes rare features hurt By comparison, we performed a grid search over performance, and leads to the practice of combining the space of Laplace smoothing parameters a, b ∈ [10−11, 107] for the best naive Bayes model. For a = naive Bayes with feature selection, potentially wasting −8 7 information. 10 and b = 10 , naive Bayes reached 50% accuracy. We propose instead to use a hierarchical beta process The classification of documents is often tackled with a multinomial models under the bag-of-words assump- (hBP) as a prior over the probabilities pj,ω. Such a hi- erarchical Bayesian model allows sharing among cate- 4The data are available at gories by shrinking the maximum likelihood probabil- http://people.csail.mit.edu/jrennie/20Newsgroups/. tion. The advantage of a feature-based model is that Thus despite being discrete, B can be viewed as an it becomes natural to add other non-text features such approximation of B0, with fluctuations going to zero as “presence of a header,” “the text is right-justified,” as c → ∞. etc. Since the hBP handles rare features appropriately, we can safely include a much larger set of features than References would be possible for a naive Bayes model. [1] C. Antoniak. Mixtures of Dirichlet processes with 8 Conclusions applications to Bayesian nonparametric problems. The Annals of Statistics, 2(6):1152–1174, 1974. In this paper we have shown that the beta process— [2] T. Griffiths and Z. Ghahramani. Infinite latent originally developed for applications in survival feature models and the Indian buffet process. In analysis—is the natural object of study for nonpara- Advances in Neural Information Processing Sys- metric Bayesian factorial modeling. Representing data tems (NIPS) 18, 2005. points in terms of sets of features, factorial models provide substantial flexibility relative to the multino- [3] T. Griffiths and Z. Ghahramani. Infinite la- mial representations associated with classical mixture tent feature models and the Indian buffet pro- models. We have shown that the beta process is the cess. Technical Report 2005-001, Gatsby Com- de Finetti mixing distribution underlying the Indian putational Neuroscience Unit, 2005. buffet process, a distribution on sparse binary matri- ces. This result parallels the relationship between the [4] N. L. Hjort. Nonparametric Bayes estimators Dirichlet process and the Chinese restaurant process. based on Beta processes in models for life history data. The Annals of Statistics, 18(3):1259–1294, We have also shown that the beta process can be ex- 1990. tended to a recursively-defined hierarchy of beta pro- cesses. This representation makes it possible to de- [5] A. Y. Khinchine. Korrelationstheorie der sta- velop nonparametric Bayesian models in which un- tion¨arenstochastiscen prozesse. Mathematische bounded sets of features can be shared among multiple Annalen, 109:604–615, 1934. nested groups of data. [6] Y. Kim. Nonparametric Bayesian estimators for Compared to the Dirichlet process, the beta process counting processes. The Annals of Statistics, has the advantage of being an independent increments 27(2):562–588, 1999. process (Brownian motion is another example of an [7] J. Lee and Y. Kim. A new algorithm to gener- independent increments process). However, some of ate beta processes. Computational Statistics and the simplifying features of the Dirichlet process do Data Analysis, 47:441–453, 2004. not carry over to the beta process, and in particu- lar we have needed to design new inference algorithms [8] P. L´evy. Th´eorie de l’addition des variables for beta process and hierarchical beta process mixture al´eatoires.Gauthiers-Villars, Paris, 1937. models rather than simply borrowing from Dirichlet process methods. Our inference methods are elemen- [9] J. Rennie, L. Shih, J. Teevan, and D. Karger. tary and additional work on inference algorithms will Tackling the poor assumptions of na¨ıve Bayes text be necessary to fully exploit beta process models. classifiers. In International Conference on Ma- chine Learning (ICML) 20, 2003. 9 Appendix [10] J. Sethuraman. A constructive definition of Dirichlet priors. Statistica Sinica, 4:639–650, Hjort [4] derives the following moments for any set 1994. S ⊂ Ω. If B is continuous, 0 [11] Y. W. Teh, M. I. Jordan, M. Beal, and D. M. Blei. Z Hierarchical Dirichlet processes. Journal of the EB(S) = bν(dω, db) = B0(S). American Statistical Association, 101:1566–1581, S×[0,1] 2006. If B is discrete: 0 [12] R. Wolpert and K. Ickstadt. Simulation of L´evy X X random fields. In D. Dey, P. Muller, and D. Sinha, EB(S) = E(b )δ = b δ = B (S) i ωi 0 ωi 0 editors, Practical Nonparametric and Semipara- i:ωi∈S i:ωi∈S Z metric Bayesian Statistics. Springer-Verlag, New B0(dω)(1 − B0(dω)) York, 1998. and V ar B(S) = . S c(ω) + 1