This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
If dining at Planet Hollywood made you keel like a movie star, now you can spend money like Arnold Schwarzenegger with a new credit card from the themed restaurant chain.
Partial representation of tf for dj baseball
0
culture
1
Planet
2
.......
These include preferential seating in the restaurants, ... Planet Hollywod joins other pop culture companies such as Rolling Stone magazine that are issuing branded credit cards that make going into bebt more fun than usual.
fun
1
information
0
.........
Fig. 3. Representation of document term frequencies in the training without more complicated representation as it is recommanded in [9]. Indeed, authors found that the simplest document representation (using individual words delimited by white spaces with no stemming) was at least as good as representations involving more complicated syntactic and morphological analysis. And, representing documents as binary vectors of words, chosen using a mutual information criterion for each category, was as good as finer-grained coding. Stemming can be avoided as shown in [19]. Consequently, the case of characters has only been lowered. Several techniques are possible to select category-dependent terms. We have chosen to ranking the training corpus words and selecting the first K words of this ordered list. For this purpose, words like numbers or determinants are not good candidates. These words have been identified and placed into a stop-list (318 stop-words for the examples described in this paper). For each category, the ranked words according to their frequency in a training corpus are selected only if they are not in the stop-list. Thus, the text categorization methods make use of sets of K words automatically selected by frequency order. The category parameters are then estimated as: − → → − dj ci = → − dj ∈Ci → − where dj = (tf (w1 , dj ), tf (w2 , dj ), ..., tf (wN , dj )) and wn are words of training documents, as described in the figure 3. When a category is too small (i.e. less than K words), it is ignored in the evaluation (but these categories can appear in the test corpus). Our aim is to apply the KLD method (using probabilities term weighting) to a text categorization task and to compare the results obtained using the well-known similarity based method (using tf idf term weighting). To do so, we conducted a set of 3 experiments resulting from 3 different term selections: 1. In the first experiment, we use all words of the documents not in the stop-list, not numbers or punctuations. 2. The second experiment uses the same as the previous one and adds a lexicon to select words. This lexicon is composed of 86,000 entries.
Using Kullback-Leibler Distance for Text Categorization
315
3. The third experiment use the same filter as the first one and add a term selection at the document-level. We select a maximum of 50 words by document with the mutual information measure [20]. These measures allow to compute the association degree between a word in the document dj compared to this word in the corpus and then to make up lists of the most important words for this document. This average mutual information (MI) measure between A and B can be evaluated as: P (a, b) P (a, b)log M I(A : B) = P (a).P (b) a,b
A value of MI is computed for each word of a document. These values are then ranked, and the 50 best MI are selected as terms for the document. These features are used as input to learn categories, with a term frequency of 1 for each word by document. In these 3 experiments, the KLD method uses probabilities from the learned categories as defined previously in Section 3. The tf idf method assigns wkj for a term tk in a category ci as defined in Section 2, i.e. as follows: |ci | wkj = tf (tk , cj ) × log df (tk , ci ) 4.3
Evaluation Criteria
For each category, the categorization goal is viewed as a binary classification problem. Given a category, the categorization methods decide whether each document is in or not in this category. With a single category as the focus, let: – M A be the number of documents assigned to the category both manually and automatically, – A be the number of documents assigned to the category automatically but not manually, – M be the number of documents assigned to the category manually but not automatically. Then the two common measures of Recall (R) and Precision (P ) can be defined as: MA R = MA+M MA P = MA+A Now, theses measures are adapted to the categorization decisions. Given a document and a category, a categorization decision is made to determine whether or not to assign this category to the document. When automatic categorization is conducted, a number of these decisions are made. Out of these decisions, some may match with the manual ones, while others may not. We want to compare the various automated decisions with the manual ones. An ”assignment” is defined as the positive decision to assign a category to a document. Let:
316
Brigitte Bigi
– c be the number of correct assignments made automatically, – a be the number of assignments made automatically, – m be the number of assignments made manually. Then, we can define the recall (r) and precision (p) measures as follows: r= p=
c m c a
Recall r is the proportion of correctly predicted YESes by the system among the true YESes for all the document category pairs given a dataset. Precision p is the proportion of correctly YESes among all the system predicted YESes. These values consider that the model give a single solution and the notion of precision can be extanded. The precision-at-N is the proportion of correctly YESes in the N first solutions of the model among all the system predicted YESes. 4.4
Overall Performance
Table 1 summarizes our results obtained for the test set. The vocabulary selection of terms for each category is a subset of K = 2, 000 terms of the category vocabulary. We have not rigorously explore the optimum number of terms for this problem, but this number provided goog results. As we said above, the vocabulary V is the union of all terms of all categories. With this size by category we obtain a vocabulary size |V | of 101,276 in the first experiment, 11,281 in the second experiment and 22,056 in the third experiment. We can see in table 1 that KLD method performs best among the conventional method. Compared to the tf idf method, all KLD results perform best independently of the choice of category selection features. It is well known that the feature selection is an important goal, and we observe the same in these experiments: the third experiment is significantly better than the first and the second one. Finally, only for comparison, we carried out some experiments on the wellknown Reuters-21578 corpus. We do not detail these experiments in this paper
Table 1. Results of text categorization for the tf idf and KLDmethods tf idf First experiment Second experiment Third experiment
Recall Precision-at-1 Precision-at-5 Precision-at-10 0.449 0.145 0.475 0.606 0.480 0.155 0.552 0.726 0.613 0.198 0.635 0.783
KLD First experiment Second experiment Third experiment
Recall Precision-at-1 Precision-at-5 Precision-at-10 0.624 0.221 0.535 0.601 0.649 0.210 0.630 0.790 0.731 0.236 0.734 0.874
Using Kullback-Leibler Distance for Text Categorization
317
Table 2. Preliminary results on Reuters-21578 tf idf First experiment Third experiment Third experiment
Recall Precision K 0.731 0.545 200 0.755 0.564 200 0.723 0.538 50
KLD First experiment Third experiment Third experiment
Recall Precision K 0.785 0.585 200 0.799 0.597 200 0.749 0.557 50
because this work is still in hand. Some results are also available. The corpus consists of a set of 21,578 Reuters newswire stories from 1987 which have been indexed manually using 135 financial topics to support document routing and retrieval for Reuters customers. We divided this corpus into a training set containing 16,300 stories and a test set containing all the other 5,278 stories. Several thousand documents in the data set have no topic assignments and we have chosen to ignore them as we cannot possibly learn from them. The resulting test set is composed of 2,475 stories. The results presented in table 2 refer to experiments made in the same conditions as the previous ones excepted for the K value because the categories are too small. The results remain favorable to KLD. At last, comparing time of the two methods, the training time is the same for the two methods since we used the same category learning! The time to estimate the appropriate categories for a document is around 20% to 400% faster for KLD.
5
Conclusion and Future Works
This paper introduces a new effective method to perform text categorization. It provides that KLD based method is well suited for this task even in the following conditions: high number of documents and high dimentional feature space. The experimental results show that KLD consistently achieve good performance on text categorization task, outperforming the reference method substantially and significantly. All this makes KLD a very promising and easy-to-use method for text categorization. We think that our research directions are experimental ones. We want to continue to validate the KLD method. We will initially test other solutions issued from the literature to learn categories. We will investigate the role of document length in this step, looking for correspondence between variations in document length and the comparative performances of KLD and tf idf . An other solution we want to experiment is proposed in [21] ; learning is achieved by combining → document vectors into a prototype vector − ci for each category. As described in [6], the vector is calculated as a weighted difference between the normalized document vectors of the positive examples for a category and the normalized document vectors of the negative examples, as follow:
318
Brigitte Bigi
→ − → − 1 d d
−β
→
→
−
− |T − c | r i
d
d
→ − d ∈(Tr −ci )
→
− where |ci | is the number of documents assigned to ci ; d denotes the Euclidian → − length of a vector d ; α and β are parameters that adjust the relative impact of positive and negative training examples. Because we think it is difficult to use SVMs on our large corpus, after these experiments we will validate the KLD method with the Reuters-21578 dataset even if our method was imagined for larger corpora. Finally, we are motivated to attempt to build a better ”metaclassifier” (as for example in [22]) resulting from the combination of KLD and SVMs because they are qualitatively different. We also plan experiments with varying amounts of training data because we hypothesize that the optimal vocabulary size may change with the size of the training set. 1 − → ci = α |ci | − → d ∈ci
References [1] Sebastiani, F.: Machine learning in automated text categorization. ACM Computing Surveys 34 (2002) 1–47 306 [2] Yang, Y.: Expert network: Effective and efficient learning from human decisions in text categorization and retrieval. In: Proceedings of the 17th Annual International ACM SIGIR Conference on Research and Development in Information Retrieval. (1994) 13–22 306 [3] Lewis, D., Ringuette, M.: A comparison of two learning algorithms for text categorization. In: Proceedings of the Third Annual Symposium on Document Analsysis and Information Retrieval. (1994) 81–93 306 [4] Wiener, E., Pedersen, J., Weigend, A.: A neural network approach to topic spotting. In: Proceedings of the Fourth Annual Symposium on Document Analsysis and Information Retrieval. (1995) 306 [5] Salton, G., McGill, M.: The smart and sire experimental retrieval systems, McGraw-Hill, New York (1983) 118–155 306, 307 [6] Joachims, T.: A probabilistic analysis of the Rocchio algorithm with TFIDF for text categorization. In Fisher, D. H., ed.: Proceedings of ICML-97, 14th International Conference on Machine Learning, Nashville, US, Morgan Kaufmann Publishers, San Francisco, US (1997) 143–151 306, 317 [7] Yang, Y., Liu, X.: A re-examination of text categorization methods. In: Proceedings of ACM Conference on Research and Development in Information Retrieval. (1999) 42–49 306 [8] Joachims, T.: Text categorization with support vector machines: Learning with many relevant features. In: Proceedings of the European Conference on Machine Learning, Springer (1998) 306 [9] Dumais, S., Platt, J., Heckerman, D., Sahami, M.: Inductive learning algorithms and representations for text categorization. In: Proceedings of ACM-CIKM98. (1998) 148–155 306, 314
Using Kullback-Leibler Distance for Text Categorization
319
[10] Kindermann, J., Paass, G., Leopold, E.: Error correcting codes with optimized kullback-leibler distances for text categorization. In Raedt, L., ed.: Principles of data mining and knowledge discovery. (2001) 133–137 306 [11] Cover, T., Thomas, J.: Elements of Information Theory. Wiley (1991) 306 [12] Carpineto, C., De Mori, R., Romano, G., Bigi, B.: An information theoretic approach to automatic query expansion. ACM Transactions On Information Systems 19 (2001) 1–27 306, 309 [13] Salton, G.: Developments in automatic text retrieval. Science 253 (1991) 974–980 307 [14] Kullback, S., Leibler, R.: On information and sufficiency. 22 (1951) 79–86 308 [15] Dagan, I., Lee, L., Pereira, F.: Similarity-based models of word cooccurrence probabilities. Machine Learning 34 (1999) 43–69 309 [16] Bigi, B., De Mori, R., El-B`eze, M., Spriet, T.: A fuzzy decision strategy for topic identification and dynamic selection of language models. Special Issue on Fuzzy Logic in Signal Processing, Signal Processing Journal 80 (2000) 309 [17] Xu, J., Croft, B.: Cluster-based language models for distributed retrieval. In: Proceedings of the 22nd Annual International ACM SIGIR Conference on Research and Development in Information Retrieval, Berkeley, CA (1999) 254–261 309 [18] De Mori, R.: SPOKEN DIALOGUES WITH COMPUTERS. Academic Press (1998) 309 [19] Leopold, E., Kindermann, J.: Text categorization with support vector machines: How to represent texts in input spaces? Machine Learning 46 (2002) 423–444 314 [20] Rosenfeld, R.: A maximum entropy approach to adaptive statistical language modeling. Computer, Speech and Language 10 (1996) 187–228 315 [21] Buckley, C., Salton, G., Allan, J.: The effect of adding relevance information in a relevance feedback environment. In: Proceedings of the seventeenth annual international ACM-SIGIR conference on research and development in information retrieval, Springer-Verlag (1994) 317 [22] Bennett, P., Dumais, S., Horvitz, E.: Probabilistic combination of text classifiers using reliability indicators: Models and results. In: Proceedings of ACM International Conference on Research and Development in Information Retrieval. (2002) 207–214 318
Discretizing Continuous Attributes in AdaBoost for Text Categorization Pio Nardiello1 , Fabrizio Sebastiani2 , and Alessandro Sperduti3 1
MercurioWeb SNC, Via Appia 85054 Muro Lucano (PZ), Italy pionardiello@mercurioweb.net 2 Istituto di Scienza e Tecnologie dell’Informazione Consiglio Nazionale delle Ricerche 56124 Pisa, Italy fabrizio@iei.pi.cnr.it 3 Dipartimento di Matematica Pura ed Applicata Universit` a di Padova 35131 Padova, Italy sperduti@math.unipd.it
Abstract. We focus on two recently proposed algorithms in the family of “boosting”-based learners for automated text classification, AdaBoost.MH and AdaBoost.MHKR . While the former is a realization of the well-known AdaBoost algorithm specifically aimed at multi-label text categorization, the latter is a generalization of the former based on the idea of learning a committee of classifier sub-committees. Both algorithms have been among the best performers in text categorization experiments so far. A problem in the use of both algorithms is that they require documents to be represented by binary vectors, indicating presence or absence of the terms in the document. As a consequence, these algorithms cannot take full advantage of the “weighted” representations (consisting of vectors of continuous attributes) that are customary in information retrieval tasks, and that provide a much more significant rendition of the document’s content than binary representations. In this paper we address the problem of exploiting the potential of weighted representations in the context of AdaBoost-like algorithms by discretizing the continuous attributes through the application of entropybased discretization methods. We present experimental results on the Reuters-21578 text categorization collection, showing that for both algorithms the version with discretized continuous attributes outperforms the version with traditional binary representations.
1
Introduction
In the last ten years an impressive array of learning techniques have been used in text categorization (TC) research, including probabilistic methods, regression methods, decision tree and decision rule learners, neural networks, batch and F. Sebastiani (Ed.): ECIR 2003, LNCS 2633, pp. 320–334, 2003. c Springer-Verlag Berlin Heidelberg 2003
Discretizing Continuous Attributes in AdaBoost for Text Categorization
321
incremental learners of linear classifiers, example-based methods, genetic algorithms, hidden Markov models, support vector machines, and classifier committees (see [16] for a review). Among these, the two classes of methods that most seem to have caught the attention of TC researchers are boosting (a subclass of the classifier committees class) and support vector machines. The reasons for this attention are twofold, in the sense that both classes exhibit strong justifications in terms of computational learning theory and superior effectiveness once tested on TC benchmarks of realistic size and difficulty. It is on the former class of methods that this paper focuses. Classifier committees (aka ensembles) are based on the idea that, given a task that requires expert knowledge to perform, k experts may be better than one if their individual judgments are appropriately combined. In TC, this means applying k different classifiers Φ1 , . . . , Φk to the same task of deciding whether a document dj belongs or not to category ci , and then combining their outcome appropriately. Boosting is a method for generating a highly accurate classifier (also called final hypothesis) by combining a set of moderately accurate classifiers (also called weak hypotheses). In this paper we will make use of two algorithms, called AdaBoost.MH [15] and AdaBoost.MHKR [17], which are based on the notion of adaptive boosting, a version of boosting in which members of the committee can be sequentially generated after learning from the classification mistakes of previously generated members of the same committee. AdaBoost.MH [15] is a realization of the well-known AdaBoost algorithm, which is specifically aimed at multi-label TC1 , and which uses decision stumps (i.e. decisions trees composed of a root and two leaves only) as weak hypotheses. AdaBoost.MHKR [17] is instead a generalization of AdaBoost.MH based on the idea of learning a committee of classifier sub-committees; in other words, AdaBoost.MHKR weak hypotheses are themselves committees of decision stumps. So far, both algorithms have been among the best performers in text categorization experiments run on standard benchmarks. A problem in the use of both algorithms is that they require documents to be represented by binary vectors, indicating presence or absence of the terms in the document. As a consequence, these algorithms cannot take full advantage of the “weighted” representations (consisting of vectors of continuous attributes) that are customary in information retrieval tasks, and that provide a much more significant rendition of the document’s content than binary representations. In this paper we address the problem of exploiting the potential of weighted representations in the context of AdaBoost-like algorithms by discretizing the continuous attributes through the application of entropy-based discretization methods. These algorithms attempt to optimally split the interval on which these attributes range into a sequence of disjoint subintervals. This split engenders a new vector (binary) representation for documents, in which a binary term indicates that the original non-binary weight belongs or does not belong to a given sub-interval. We present experimental results on the Reuters-21578 1
Given a set of categories C = {c1 , . . . , c|C| }, multilabel text categorization is the task in which any number 0 ≤ nj ≤ |C| of categories may be assigned to each dj ∈ D.
322
Pio Nardiello et al.
text categorization collection, showing that for both algorithms the version with discretized continuous attributes outperforms the version with traditional binary representations. The paper is organized as follows. In Section 2 we briefly introduce AdaBoost.MH and AdaBoost.MHKR , while in Section 3 we describe the modified, improved version of AdaBoost.MHKR that we have used in all the experiments described in this paper. In Section 4 we introduce the issue of discretizing continuous attributes, and we propose two discretization algorithms based on information-theoretic intuitions. In Section 5 we describe the experimental results we have obtained by applying both discretization algorithms to both AdaBoost.MH and AdaBoost.MHKR; the benchmark used is Reuters21578, the standard benchmark of text categorization research. In Section 6 we give our concluding remarks.
2
Boosting Algorithms for Text Categorization
In the following we briefly recall AdaBoost.MH and AdaBoost.MHKR, two boosting algorithms that have been specially developed for text categorization applications2 . For more details on both algorithms, see [17]. 2.1
AdaBoost.MH
AdaBoost.MH is a boosting algorithm proposed by Schapire and Singer [15] for multilabel text categorization applications and derived from AdaBoost, Freund and Schapire’s general purpose boosting algorithm [3]. The input to the algorithm is a training set T r = {d1 , C1 , . . . , d|T r| , C|T r| }, where Cj ⊆ C is the set of categories to each of which dj belongs. AdaBoost.MH works by iteratively calling a weak learner to generate a sequence Φ1 , . . . , ΦS of weak hypotheses; at the end of the iteration the final hypothesis Φ is obtained by a summation Φ(dj , ci ) =
S
Φs (dj , ci )
(1)
s=1
of these weak hypotheses. A weak hypothesis is a function Φs : D × C → IR, where D is the set of all possible documents. We interpret the sign of Φs (dj , ci ) as the decision of Φs on whether dj belongs to ci (i.e. Φs (dj , ci ) > 0 means that dj is believed to belong to ci while Φs (dj , ci ) < 0 means it is believed not 2
In this paper we concentrate on AdaBoost.MH with real-valued predictions, one of three variants of AdaBoost.MH discussed in [15], since it is the one that, in the experiments of [15], has been experimented most thoroughly and has given the best results, and since it is the one used in the AdaBoost.MHKR system of [17]. The methods that we discuss in Section 4 straightforwardly apply also to the other two variants.
Discretizing Continuous Attributes in AdaBoost for Text Categorization
323
to belong to ci ), and the absolute value of Φs (dj , ci ) (indicated by |Φs (dj , ci )|) as the strength of this belief. At each iteration s AdaBoost.MH applies the newly generated weak hypothesis Φs to the training set and uses the results to update a distribution Ds of weights on the training pairs dj , ci . The weight Ds+1 (dj , ci ) is meant to capture how effective Φ1 , . . . , Φs were in correctly deciding whether the training document dj belongs to category ci or not. By passing (together with the training set T r) this distribution to the weak learner, AdaBoost.MH forces this latter to generate a new weak hypothesis Φs+1 that concentrates on the pairs with the highest weight, i.e. those that had proven harder to classify for the previous weak hypotheses. The initial distribution D1 is uniform. At each iteration s all the weights Ds (dj , ci ) are updated to Ds+1 (dj , ci ) according to the rule Ds+1 (dj , ci ) =
Ds (dj , ci ) exp(−Cj [ci ] · Φs (dj , ci )) Zs
(2)
where Cj [ci ] is defined to be 1 if ci ∈ Cj and -1 otherwise, and Zs =
|C| |T r|
Ds (dj , ci ) exp(−Cj [ci ] · Φs (dj , ci ))
(3)
i=1 j=1
is a normalization factor. Each document dj is represented by a vector w1j , . . . , w|T |j of |T | binary weights, where T = {t1 , . . . , t|T | } is the set of terms. The weak hypotheses AdaBoost.MH uses are real-valued decision stumps, i.e. functions of the form a0i if wkj = 0 Φs (dj , ci ) = (4) a1i if wkj = 1 where tk ∈ T , a0i and a1i are real-valued constants. The choices for tk , a0i and a1i are in general different for each iteration, and are made according to a policy that attempts to minimize Zs , since this is known to be an error-minimization policy (although not an optimal one) [14]. AdaBoost.MHR chooses weak hypotheses of the form described in Equation 4 by a two step-process: 1. For each term tk ∈ T it pre-selects, among all weak hypotheses that have tk as the “pivot term”, the one (indicated by Φkbest ) for which Zs is minimum. From a computational point of view this is the easier step, since Schapire and Singer [14] provide the provably optimal values for Φkbest as a function of Dt (dj , ci ), wkj and Cj [ci ]. |T | 2. Among all the hypotheses Φ1best , . . . , Φbest pre-selected for the |T | different terms, it selects the one (indicated by Φs ) for which Zs is minimum. From a computational point of view this is the harder step, since this is O(|T |), which in text categorization applications is typically in the tens of thousands.
324
Pio Nardiello et al.
2.2
AdaBoost.MHKR
In [17] a variant of AdaBoost.MHR , called AdaBoost.MHKR (for AdaBoost.MH with K-fold real-valued predictions), has been proposed. This algorithm differs from AdaBoost.MHR in the policy according to which weak hypotheses are chosen, since it is based on the construction, at each iteration s of the boosting process, of a complex weak hypothesis (CWH) consisting of a subK(s) committee of simple weak hypotheses (SWHs) Φ1s , . . . , Φs , each of which has the form described in Equation 4. These are generated by means of the same process described in Section 2.1, but for the fact that at iteration s, instead of selecting and using only the best term tk (i.e. the one which brings about the smallest Zs ), it selects the best K(s) terms and use them in order to generate K(s) K(s) K(s) SWHs Φ1s , . . . , Φs . The CWH is then produced by grouping Φ1s , . . . , Φs into a sub-committee Φs (dj , ci ) =
K(s) 1 q Φ (dj , ci ) K(s) q=1 s
(5)
that uses the simple arithmetic mean as the combination rule. For updating the distribution it still applies Equations 2 and 3, where Φs is now defined by Equation 5. The final hypothesis is computed by plugging Equation 5 into Equation 1, thus obtaining Φ(dj , ci ) =
S s=1
αs
K(s) 1 q Φ (dj , ci ) K(s) q=1 s
(6)
The number K(s) of SWHs to include in the sub-committee is obtained using a simple heuristics which adds a constant C to K every N iterations, using a fixed value for N and using a value of 1 for K(1), i.e. K(s) = 1 + C s−1 N .
3
An Improved Version of AdaBoost.MHKR
In this work we have implemented and experimented a new version of AdaBoost.MHKR in which each SWH in a sub-committee is weighted by a value which is inversely proportional to its score. This means replacing Equation 5 with K(s) Zq−1 1 q (7) Φs (dj , ci ) = K(s) −1 · Φs (dj , ci ) K(s) q=1 Z j=1
j
The rationale of this choice is that the weight associated to a SWH that contributes more to maximizing effectiveness should be higher. This is especially important in the first iterations since, as noted in [17], it is here that the variance of the Zs values of members of the same sub-committee is higher. In experiments that we do not report for reasons of space we have observed that this new version consistently improves the performance of the basic version of AdaBoost.MHKR of more than 1%. From now on when referring to AdaBoost.MHKR we thus mean this improved version.
Discretizing Continuous Attributes in AdaBoost for Text Categorization
4
325
Term Discretization
The aim of this section is to define a discretization procedure that allows to exploit the rich information conveyed by the non-binary term weights produced by traditional IR weighting techniques (such as tf ∗ idf or others) while at the same time allowing the use of algorithms derived by the original BoosTexter algorithm [15](such as AdaBoost.MH and AdaBoost.MHKR ) that requires discrete (in this case: binary) input. An alternative way to directly exploit non-binary term weights would have been to use the traditional AdaBoost algorithm in conjunction with weak hypotheses able to deal with continuous features. We preferred to avoid this more direct solution since it would have been computationally more onerous. In machine learning, the basic idea that underlies a discretization procedure is that of segmenting the continuous interval [α, β] on which an attribute (in our case: a term) tk ranges on, into an ordered sequence I = [α = γ0 , γ1 ], (γ1 , γ2 ], . . . , (γ|I|−1 , γ|I| = β] of disjoint sub-intervals such that – in the vector representation term tk is replaced by |I| different terms {tk1 , tk2 , . . . , tk|I| }, where wkrj (the weight that term tkr has in document dj ) is computed as 1 if wkj ∈ (γr−1 , γr ] wkrj = (8) 0 otherwise – among all the possible replacements, the one chosen maximizes effectiveness. Different techniques for discretizing a continuous attribute have been proposed in the field of machine learning. These include 1R [5], ChiMerge and Chi2 [6], plus several entropy-based algorithms [1, 2, 7, 10, 11, 12]. In this paper, we adopt a very simple discretization algorithm based on (multiclass) information gain, which is defined in terms of the well-known (multiclass) entropy measure [9]; for reasons discussed later in this section, we take |I| to be equal to 2. This approach is based on the following rationale. Given a term tk which can take values from a continuous interval [α, β], we look for a value γ k (which we call the split value, or simply split ) that partitions [α, β] into two sub-intervals [α, γ k ] and (γ k , β] such that the dichotomy induced on the training set (i.e. the dichotomy between the examples for which tk ∈ [α, γ k ] and the examples for which tk ∈ (γ k , β]) generates two training subsets which are expected to be globally easier to classify (and thus lead to better classifiers) by just using the membership of tk in the two subintervals as discriminant. Specifically, information gain is a measure that quantifies how easier it is to classify the examples when using the split γ k (i.e. how well the two newly generated terms separate the positive from the negative examples), and selecting the split that maximizes information gain thus means selecting the split that maximizes separability.
326
4.1
Pio Nardiello et al.
Algorithm A
Let us fix some notation: if tk is the term under consideration, - Let α > 0 and β be the upper and lower bounds of the range of values (except 0) that all the terms in T can take (which we assume to be equal for all terms), and let γ k be a split. - Let T rin be the set of training examples dj for which wkj ∈ [α, β]. c be the set of training examples belonging to category c for which - Let T rin wkj ∈ [α, β]. - Let T rin1 (γ k ) and T rin2 (γ k ) be the sets of training examples dj for which wkj ∈ [α, γ k ] and wkj ∈ (γ k , β], respectively. Definition 1. The (multiclass) entropy of T r with respect to an interval [α, β] is defined as c |T rc | |T rin | in log2 (9) H(T r, α, β) = − |T rin | |T rin | c∈C
The (multiclass) information gain of a value with respect to T r is defined as IG(T r, α, β, γ k ) = H(T r, α, β) − k
(10) k
|T rin1 (γ )| |T rin2 (γ )| H(T r, α, γ k ) − H(T r, γ k , β) |T r| |T r| ✷ The basic idea of our discretization process is to find, for each term tk and among all possible splits γ k , the split γˆ k that maximizes the information gain. On the basis of this split, a term tk is replaced by two new terms tk0 and tk1 , and the weights they have in the training documents are computed according to Equation 8. The fact that these weights are binary will allow us to work with both AdaBoost.MH and AdaBoost.MHKR while at the same time exploiting the rich information present in the non-binary weights of the term tk which has originated the (binary-weighted) terms tk0 and tk1 . It should be stressed that, because of α > 0, if term tk is not present in a document, both tk0 and tk1 will assume zero value. In general, the application of this discretization strategy to all the terms will r| double the number of terms. This may not be advisable if the ratio |T |T | between the number |T r| of training documents and the number |T | of terms used to represent the documents is not high enough. In fact, it is well known that a low such ratio will in general give rise to overfitting, since in the classifier each term corresponds to a free parameter of the learning problem, and this parameter is set by the training algorithm based on the training examples available, which r| correspond to constraints on the problem. Therefore, if the |T |T | ratio is low the learning problem is underconstrained, and the probability that an overspecialized classifier is learnt is high. This is the reason why we have limited the number of intervals into which a term is discretized to two.
Discretizing Continuous Attributes in AdaBoost for Text Categorization
327
———————————————————————————————————– Input: T r = {d1 , C1 , . . . , d|T r| , C|T r| }, the training set of documents T = {t1 , . . . , t|T | }, the set of terms C = {c1 , . . . , c|C| }, the set of categories p, the percentage of computed splits to be actually selected Body: 1. Optimal splits ← ∅ 2. For each tk ∈ T do - Sort the values that term tk actually takes in T r into an ordered sequence v1 , v2 , . . . and compute the set of possible splits (see [2]) Splitsk = {γrk |γrk = - Let
γˆ k = arg
max
γqk ∈Splitsk
vr + vr+1 } 2
IG(T r, α, β, γqk )
- Optimal splits ← Optimal splits ∪ {(tk , γˆ k )} Output: Return the p% splits (tk , γˆ k ) in Optimal splits with highest IG(T r, α, β, γˆ k ) ———————————————————————————————————-
Fig. 1. Algorithm A
For pretty much the same reason, we also introduce a selection procedure γ k ) generated by our on the terms to be discretized: among all the pairs (tk ,ˆ algorithm, we select for discretization only the p% with the highest information gain. Thus, after this selection, terms which have not been selected will not be discretized and, for input to our learners, will be considered as binary-valued (i.e. only presence/absence of the term in the document will be considered). Each selected term will instead be replaced by two new terms, as previously described. A full description of this algorithm, that in the following we will refer to as Algorithm A, is given in Figure 1. 4.2
Algorithm B
Given a term tk , a variant of Algorithm A can instead be obtained by first of all computing the best split with respect to a single category ci . This is done by computing the information gain over a training set in which a document belonging to ci is considered positive, otherwise it is considered negative. Then, again, we select the p% splits with highest information gain. A full description of the algorithm, that in the following we will refer to as Algorithm B, is given in Figure 2.
328
Pio Nardiello et al.
———————————————————————————————————– Input: T r = {d1 , C1 , . . . , d|T r| , C|T r| }, the training set of documents T = {t1 , . . . , t|T | }, the set of terms C, the set of categories p, the percentage of computed splits to be actually selected Body: 1. For each ci ∈ C define a training set T ri in which documents belonging to category ci are positive examples and documents not belonging to category ci are negative examples 2. Optimal splits ← ∅ 3. For each tk ∈ T do – Sort the values that term tk actually takes in T r into an ordered sequence v1 , v2 , . . . and compute the set of possible splits (see [2]) Splitsk = {γrk |γrk =
vr + vr+1 } 2
– Candidate splitsk ← ∅ – For each category ci ∈ C that has at least one positive training example dj such that wkj > 0 do - compute γˆik = arg
max
γqk ∈Splitsk
IG(T ri , α, β, γqk )
ˆik )} - Candidate splitsk ← Candidate splitsk ∪ {(tk , γ k – Let (tk , γˆ ) ∈ Candidate splitsk be the split with highest IG for tk – Optimal splits ← Optimal splits ∪ {(tk , γˆ k )} ˆk ) 4. For each (tk , γˆk ) ∈ Optimal splits compute IG(T r, α, β, γ Output: Return the best p% splits (tk , γˆ k ) in Optimal splits ———————————————————————————————————–
Fig. 2. Algorithm B
5
Experimental Results
5.1
Experimental Setting
We have conducted a number of experiments to test the validity of the two algorithms proposed in Section 4. For these experiments we have used the wellknown “Reuters-21578, Distribution 1.0” corpus3 , which consists of a set of 12,902 news stories, partitioned (according to the “ModApt´e” split we have adopted) into a training set of 9,603 documents and a test set of 3,299 documents. The documents have an average length of 211 words (that become 117 after stop word removal). We have run our experiments on the set of 115 categories that 3
The Reuters-21578 corpus is freely available for experimentation purposes from http://www.daviddlewis.com/resources/testcollections/~reuters21578/
Discretizing Continuous Attributes in AdaBoost for Text Categorization
329
have at least 1 positive training example; the average number of categories per document is 1.08, ranging from a minimum of 0 to a maximum of 16. The number of positive training examples per category ranges from a minimum of 1 to a maximum of 3964. As the set of terms T we use the set of words occurring at least once in the training set. This set is identified by previously removing punctuation and then removing stop words. Neither stemming nor explicit number removal have been performed. As a result, the number of different terms is 17,439. Starting from this set of terms, term space reduction has been applied using χ2max as term selection function and a reduction factor of 90%, since this proved one among the best choices in the thorough experiments of [18]. Classification effectiveness has been measured in terms of the classic IR notions of precision (π) and recall (ρ) adapted to the case of text categorization. In our experiments we have evaluated both the “microaveraged” and the “macroaveraged” versions of π and ρ. As a measure of effectiveness that combines the contributions of both π and ρ, we have used the well-known F1 function [8], in both the microaveraged and the macroaveraged versions. 5.2
The Experiments
We have tested our discretization algorithms on the implementations of both AdaBoost.MH and AdaBoost.MHKR described in [17], running them in the same experimental conditions in experiments with or without discretization. An alternative method might have been to just run the experiments with discretization and compare the results with the ones of the experiments without discretization published in [15] and [17]. We decided to avoid this latter method because of a number of reasons that would have made this comparison difficult: – [15] uses an older version of the Reuters benchmark, called Reuters22173. This benchmark is known to suffer from a number of problems that make its results difficult to interpret, and the research community universally prefers the better version Reuters-21578. No experiments using both collections have been reported in the literature, so there is no indication as to how results obtained on these two different collections might be compared. – Apart from single words, [15] uses also bigrams (i.e. statistical phrases of length 2) as terms, while we use unigrams (i.e. single words) only. – The experiments presented in [17] were run with a suboptimal version of the text preprocessing algorithm4 , which would make the comparison unfair towards [17]. – The experiments presented here use the optimized version of AdaBoost. MHKR described in Section 3, and not the original one described in [17]. 4
Among other things, that version of the text preprocessing algorithm mistakenly did not make use of the TITLE field and of part of the BODY field of Reuters-21578 articles, which means that information important for the categorization task went unused.
330
Pio Nardiello et al.
Our experiments were conducted by applying both AdaBoost.MH and AdaBoost.MHKR to the data: – data1: original binary representations, i.e. obtained without discretization by just checking the presence/absence of a term in the document; – data2: binary representations obtained by discretizing previously obtained non-binary representations by means Algorithm A; – data3: same as data2, but with Algorithm B in place of Algorithm A. The non-binary representations used in data2 and data3 were obtained by means of the tf idf function in its standard “ltc” variant [13], i.e. tf idf (tk , dj ) = tf (tk , dj ) · log
|T r| #T r (tk )
(11)
where #T r (tk ) denotes the number of documents in T r in which tk occurs at least once and 1 + log #(tk , dj ) if #(tk , dj ) > 0 tf (tk , dj ) = 0 otherwise where #(tk , dj ) denotes the number of times tk occurs in dj . Weights obtained by Equation 11 are normalized by cosine normalization to yield the final weights, i.e. tf idf (tk , dj ) wkj = |T | 2 s=1 tf idf (ts , dj )
(12)
In all the experiments with AdaBoost.MHKR we have used the parameter settings C = 1 and N = 20, since in [17] these choices had been empirically found to give the best results. Preliminary experiments involving the application of both AdaBoost.MH and AdaBoost.MHKR to data preprocessed by methods data2 and data3 with different values for the p parameter had shown that, for both learners, the best performance is obtained for p = 20 5 . In Figure 3 we have thus reported both the microaveraged F1 (top) and the macroaveraged F1 (bottom) curves obtained by AdaBoost.MH when applied for 5,000 iterations to data1, data2, and data3 (with p = 20 used for obtaining data2 and data3). From the results it is clear that – The use of discretization algorithms (either A or B) brings about an improvement in both microaveraged and macroaveraged F1 with respect to the application of AdaBoost.MH without discretization. This is relevant, since AdaBoost.MH has been shown to be one of the top performers in text categorization experiments so far. 5
The values we have tested for parameter p are 10, 20, 35, 50, 75, 100. For values of p higher than 20 we observed overfitting, while the performance obtained for p = 10 was intermediate between the one obtained without discretization and the one obtained for p = 20.
Microaveraged F1
Discretizing Continuous Attributes in AdaBoost for Text Categorization
0.84 0.83 0.82 0.81 0.8 0.79 0.78 0.77 0.76 0.75 0.74 0.73 0.72 0.71 0.7 0.69 0.68 0.67 0.66
AdaBoost.MH without discr. AdaBoost.MH with A discr. 20% AdaBoost.MH with B discr. 20%
0
Macroaveraged F1
331
0.66 0.65 0.64 0.63 0.62 0.61 0.6 0.59 0.58 0.57 0.56 0.55 0.54 0.53 0.52 0.51 0.5
500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Number of iterations
AdaBoost.MH without discr. AdaBoost.MH with A discr. 20% AdaBoost.MH with B discr. 20%
0
500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Number of iterations
Fig. 3. F1 curves for AdaBoost.MH applied to data without discretization and with p = 20% discretization (by both Algorithm A and Algorithm B)
– The improvement obtained by Algorithm B is more significant than that of Algorithm A on microaveraged F1 , while on macroaveraged F1 the performances of the two algorithms are comparable. This indicates that Algorithm A performs well also on scarcely populated categories, while Algorithm B is more at home with densely populated ones.
Microaveraged F1
332
Pio Nardiello et al.
0.84 0.83 0.82 0.81 0.8 0.79 0.78 0.77 0.76 0.75 0.74 0.73 0.72 0.71 0.7
KR
AdaBoost.MH without discr. AdaBoost.MHKR with A discr. 20% KR
AdaBoost.MH
0
with B discr. 20%
500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Number of iterations
0.67 0.66
Macroaveraged F1
0.65 0.64 0.63 0.62 0.61 KR
0.6
AdaBoost.MH without discr. AdaBoost.MHKR with A discr. 20% AdaBoost.MHKR with B discr. 20%
0.59 0.58 0.57 0.56 0
500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Number of iterations
Fig. 4. F1 curves for AdaBoost.MHKR applied to data without discretization and with p = 20% discretization (by both Algorithm A and Algorithm B) The results of analogous experiments for the AdaBoost.MHKR learner are shown in Figure 4. Even in this case we may observe that the representations obtained by the discretization algorithms (either Algorithm A or B) consistently outperform the original binary representations. This time, however, Algorithm B is superior to Algorithm A both in terms of microaveraged and
Discretizing Continuous Attributes in AdaBoost for Text Categorization
333
macroaveraged F1 , but the differential between the two is smaller than with AdaBoost.MH. Finally, we note that AdaBoost.MHKR proves superior to AdaBoost.MH also with representations obtained by discretization (either Algorithm A or B), and for both microaveraged and macroaveraged F1 , thus confirming the results obtained in [17] in which the two learners had been experimentally compared on binary representations obtained without any discretization.
6
Conclusion
We have presented two algorithms for the discretization of non-binary term weights, a task that addresses the problem of exploiting the rich information contained in the non-binary weights produced by standard statistical or probabilistic term weighting techniques, in the context of high performance learners requiring binary input. Although these algorithms can also be used in connection with learners not belonging to the “boosting” family, we have focused on experimenting them with two boosting-based learners, AdaBoost.MH and AdaBoost.MHKR , since these had delivered top-notch performance in previous text categorization experiments. These experiments have shown that binary representations obtained by discretizing previously obtained non-binary (tf ∗ idf ) representations by means of any of our two algorithms, outperform the original binary representations. This improvement is especially significant in the case of microaveraged F1 , for which an improvement of more than 3% was observed for AdaBoost.MH. This is significant, since AdaBoost.MH is in the restricted lot of the peak text categorization performers nowadays, a lot where the margins for performance improvement are slimmer and slimmer.
Acknowledgements We thank Luigi Galavotti for making available his RealCAT text classification software environment [4], which greatly simplified our experimental work. We also thank Marco Danelutto for giving us access to the Backus cluster of PCs.
References [1] J. Dougherty, R. Kohavi, and M. Sahami. Supervised and unsupervised discretization of continuous features. In Proceeding of ICML-95, 12th International Conference on Machine Learning, pages 194–202, Lake Tahoe, US, 1995. 325 [2] U. Fayyad and K. Irani. Multi-interval discretization of continuous-valued attributes for classification learning. In Proceedings of IJCAI-93, 13th International Joint Conference on Artificial Intelligence, pages 1022–1027, Sidney, AU, 1993. 325, 327, 328 [3] Y. Freund and R. E. Schapire. A decision-theoretic generalization of on-line learning and an application to boosting. Journal of Computer and System Sciences, 55(1):119–139, 1997. 322
334
Pio Nardiello et al.
[4] L. Galavotti, F. Sebastiani, and M. Simi. Experiments on the use of feature selection and negative evidence in automated text categorization. In J. L. Borbinha and T. Baker, editors, Proceedings of ECDL-00, 4th European Conference on Research and Advanced Technology for Digital Libraries, pages 59–68, Lisbon, PT, 2000. 333 [5] R. C. Holte. Very simple classification rules perform well on most commonly used datasets. Machine Learning, 11(1):63–90, 1993. 325 [6] R. Kerber. Chimerge: Discretization of numeric attributes. In Proceedings of AAAI-92, 10th Conference of the American Association for Artificial Intelligence, pages 123–128, San Jose, US, 1998. 325 [7] R. Kohavi and M. Sahami. Error-based and entropy-based discretization of continuous features. In Proceedings of KDD-96, 2nd International Conference on Knowledge Discovery and Data Mining, pages 114–119, Portland, US, 1996. 325 [8] D. D. Lewis. Evaluating and optimizing autonomous text classification systems. In E. A. Fox, P. Ingwersen, and R. Fidel, editors, Proceedings of SIGIR-95, 18th ACM International Conference on Research and Development in Information Retrieval, pages 246–254, Seattle, US, 1995. 329 [9] T. M. Mitchell. Machine learning. McGraw Hill, New York, US, 1996. 325 [10] L. C. Molina F´elix, S. Oliveira Rezende, M. C. Monard, and C. Wellington Caulkins. Some experiences with the discretization process: from regression to classification. In Proceedings of ASAI-99, 1st Argentinian Symposium on Artificial Intelligence, pages 155–166, Buenos Aires, AR, 1999. 325 [11] B. Pfahringer. Compression-based discretization of continuous attributes. In Proceeding of ICML-95, 12th International Conference on Machine Learning, pages 339–350, Lake Tahoe, US, 1995. 325 [12] J. R. Quinlan. Improved use of continuous attributes in C4.5. Journal of Artificial Intelligence Research, 4:77–90, 1996. 325 [13] G. Salton and C. Buckley. Term-weighting approaches in automatic text retrieval. Information Processing and Management, 24(5):513–523, 1988. 330 [14] R. E. Schapire and Y. Singer. Improved boosting algorithms using confidencerated predictions. Machine Learning, 37(3):297–336, 1999. 323 [15] R. E. Schapire and Y. Singer. BoosTexter: a boosting-based system for text categorization. Machine Learning, 39(2/3):135–168, 2000. 321, 322, 325, 329 [16] F. Sebastiani. Machine learning in automated text categorization. ACM Computing Surveys, 34(1):1–47, 2002. 321 [17] F. Sebastiani, A. Sperduti, and N. Valdambrini. An improved boosting algorithm and its application to automated text categorization. In A. Agah, J. Callan, and E. Rundensteiner, editors, Proceedings of CIKM-00, 9th ACM International Conference on Information and Knowledge Management, pages 78–85, McLean, US, 2000. 321, 322, 324, 329, 330, 333 [18] Y. Yang and J. O. Pedersen. A comparative study on feature selection in text categorization. In D. H. Fisher, editor, Proceedings of ICML-97, 14th International Conference on Machine Learning, pages 412–420, Nashville, US, 1997. 329
Combining Naive Bayes and n-Gram Language Models for Text Classification Fuchun Peng and Dale Schuurmans School of Computer Science, University of Waterloo 200 University Avenue West, Waterloo, Ontario, Canada, N2L 3G1 {f3peng,dale}@cs.uwaterloo.ca
Abstract. We augment the naive Bayes model with an n-gram language model to address two shortcomings of naive Bayes text classifiers. The chain augmented naive Bayes classifiers we propose have two advantages over standard naive Bayes classifiers. First, a chain augmented naive Bayes model relaxes some of the independence assumptions of naive Bayes—allowing a local Markov chain dependence in the observed variables—while still permitting efficient inference and learning. Second, smoothing techniques from statistical language modeling can be used to recover better estimates than the Laplace smoothing techniques usually used in naive Bayes classification. Our experimental results on three real world data sets show that we achieve substantial improvements over standard naive Bayes classification, while also achieving state of the art performance that competes with the best known methods in these cases.
1
Introduction
Naive Bayes classifiers have been proven successful in many domains, especially in text classification [12, 14, 20], despite the simplicity of the model and the restrictiveness of the independence assumptions it makes. Domingos and Pazzanni [4] point out that naive Bayes classifiers can obtain near optimal misclassification error even when the independence assumption is strongly violated. Nevertheless, it is commonly thought that relaxing the independence assumption of naive Bayes ought to allow for superior text classification [12], and it has been shown in practice that functionally dependent attributes can indeed improve classification accuracy in some cases [7, 19]. A significant amount of research has been conducted on relaxing the naive Bayes independence assumption in machine learning research. A popular extension is the Tree Augmented Naive Bayes classifier (TAN) [7] which allows for a tree-structured dependence among observed variables in addition to the traditional dependence on the hidden “root” variable. However, learning tree structured Bayesian network is not trivial [10], and this model has rarely been used in text classification applications. In this paper we investigate a convenient alternative that lies between pure naive Bayes and TAN Bayes models in the strength of its assumptions; namely, the Chain Augmented Naive Bayes (CAN) F. Sebastiani (Ed.): ECIR 2003, LNCS 2633, pp. 335–350, 2003. c Springer-Verlag Berlin Heidelberg 2003
336
Fuchun Peng and Dale Schuurmans
model. A CAN Bayes model simplifies the TAN model by restricting dependencies among observed variables to form a Markov chain instead of a tree. Interestingly, it turns out that the model that results is closely related to the n-gram language models that have been widely studied in statistical natural language modeling and speech recognition. In this paper, we augment the naive Bayes text classifier by including attribute dependencies that form a Markov chain, and use techniques from statistical n-gram language modeling to learn and apply these models. The result is a combination of naive Bayes and statistical n-gram methods that yields simple yet surprisingly effective classifiers. In addition to proposing the CAN model, we also investigate the use of advanced smoothing techniques from statistical language modeling to obtain better parameter estimates. In the standard naive Bayes approach, Laplace smoothing is commonly used to avoid zero probability estimates. However, Laplace smoothing is usually less effective than smoothing techniques from statistical language modeling. We consider four more advanced smoothing techniques that have been commonly used in n-gram language modeling to improve naive Bayes classifier. Below we first describe the naive Bayes classifier (Section 2) and then present the basic n-gram language model (Section 3). These two models form the basis of the chain augmented naive Bayes classifier we propose in Section 4. We then experimentally evaluate the proposed classifier on three real world data sets in Section 5, and conclude with a brief discussion in Section 6.
2
The Naive Bayes Text Classifier
Text classification is the problem of assigning a document D to one of a set of |C| pre-defined categories C = {c1 , c2 , ..., c|C| }. Normally a supervised learning framework is used to train a text classifier, where a learning algorithm is provided a set of N labeled training examples {(di , ci ) : i = 1, ..., N } from which it must produce a classification function F : D → C that maps documents to categories. Here di denotes the ith training document and ci is the corresponding category label of di . We use the random variables D and C to denote the document and category values respectively. A popular learning algorithm for text classification1 is based on a simple application of Bayes’ rule [5, chapter 10]: P (C = c|D = d) =
P (C = c) × P (D = d|C = c) P (D = d)
(1)
To simplify the presentation, we re-write Eq. (1) as P (c|d) = 1
P (c) × P (d|c) P (d)
(2)
Other popular learning algorithms for text classification include decision tree learning, support vector machines, regression methods, neural network, rule learning methods, and on-line learning [22].
Combining Naive Bayes and n-Gram Language Models
337
Bayes’ rule decomposes the computation of a posterior probability into the computation of a likelihood and a prior probability. In text classification, a document d is normally represented by a vector of K attributes2 d = (v1 , v2 , ....vK ). Computing p(d|c) in this case is not generally trivial, since the space of possible documents d = (v1 , v2 , ....vK ) is vast. To simplify this computation, the naive Bayes model introduces an additional assumption that all of the attribute values, vj , are independent given the category label, c. That is, for i =j, vi and vj are conditionally independent given c. This assumption greatly simplifies the computation by reducing Eq. (2) to K j=1 P (vj |c) (3) P (c|d) = P (c) × P (d) Based on Eq. (3), maximum a posterior (MAP) classifier can be constructed by seeking the optimal category which maximizes the posterior P (c|d): c∗ = arg max {P (c|d)} c∈C K = arg max c∈C
(4)
j=1
P (c) ×
P (vj |c)
P (d)
K = arg max P (c) × P (vj |c) c∈C
(5)
(6)
j=1
Note that going from Eq. (5) to Eq. (6) is valid because P (d) is a constant for every category c. A MAP classifier (Eq. (4)) is optimal in the sense of minimizing zero-one loss (misclassification error). If the independence assumption holds, then a classifier based on Eq. (6) is also optimal [5]. The prior distribution P (c) can also be used to incorporate additional assumptions. Two commonly used prior distributions are Dirichlet distribution and uniform distribution. When uniform distribution is used as the prior, the MAP classifier becomes equivalent to the maximum likelihood (ML) classifier. K (7) P (vj |c) c∗ = arg max c∈C j=1
Eq. (7) is called the maximum likelihood naive Bayes classifier. There are several variants of naive Bayes classifiers, including the binary independence model, the multinomial model, the Poisson model, and the negative binary independence model [6]. It has been shown that for text categorization applications, the multinomial model is most often the best choice [6, 14], therefore we will only consider the multinomial naive Bayes model in this paper. Fig. 1 gives a graphical representation of the multinomial naive Bayes model, showing that each attribute node is independent of the other attributes given the class label C. 2
Attributes are also called features in many papers. Feature selection is an important procedure in many classifiers [21].
338
Fuchun Peng and Dale Schuurmans
C
v
1
v
v
2
3
.......
v
n
Fig. 1. Graphical model of a naive Bayes classifier The parameters of a multinomial naive Bayes classifier are given by Θ = {θjc = P (vj |c) : j = 1, ..., K; c = 1, ..., |C|}. The likelihood of a given set of documents Dc for a given category c is given by N c ! c Njc P (Dc |Θ) = (θj ) c j Nj ! j where Njc is the frequency of attribute j occurring in Dc and N c = A maximum likelihood estimate yields the parameter estimates θjc =
Njc Nc
(8) j
Njc .
(9)
Note that Eq. (9) puts zero probability on attribute values that do not actually occur in Dc (i.e., Njc = 0). Unfortunately, a zero estimate can create significant problems when we classify a new document, for example, when we encounter a new attribute value that has not been observed in the training corpus Dc . To overcome this problem, Laplace smoothing is usually used to avoid zero probability estimates in practice: θjc =
Njc + aj Nc + a
(10)
where a = j aj . A special case of Laplace smoothing is add one smoothing [13, chapter 6] obtained by setting aj = 1. However, Laplace smoothing is not as effective in language modeling as some other smoothing techniques [2]. We will show that more advanced smoothing techniques can be used to improve naive Bayes classifiers, and therefore play an important role in developing effective text classifiers using naive Bayes models. Going back to Equ. (7), we can see that a naive Bayes classifier only considers the selected K attributes while ignoring all other attributes (OOV attributes). Although infrequent attributes contribute less information than common attributes individually, their cumulative effect of can still have an important effect on classification accuracy. Our language modeling based classifier alleviates this problem by implicitly consider all possible attributes. We will experimentally show that considering OOV attributes has notable effects on classification performance. We now describe the next main component of our models—statistical n-gram language models—which we will use to later augment naive Bayes classifiers.
Combining Naive Bayes and n-Gram Language Models
3
339
Markov n-Gram Language Modeling
Although the dominant motivation for language modeling has come from speech recognition, statistical language models have recently become more widely used in many other application areas, including information retrieval [9, 17]. The goal of language modeling is to predict the probability of natural word sequences; or more simply, to put high probability on word sequences that actually occur (and low probability on word sequences that never occur). Given a word sequence w1 w2 ...wT to be used as a test corpus, the quality of a language model can be measured by the empirical perplexity (or entropy) on this corpus
T
1 T (11) Perplexity = P (w |w i 1 ...wi−1 ) i=1 Entropy = log2 Perplexity
(12)
The goal of language modeling is to obtain a small perplexity. The simplest and most successful basis for language modeling is the n-gram model: Note that by the chain rule of probability we can write the probability of any sequence as P (w1 w2 ...wT ) =
T
P (wi |w1 ...wi−1 )
(13)
i=1
An n-gram model approximates this probability by assuming that the only words relevant to predicting P (wi |w1 ...wi−1 ) are the previous n − 1 words; that is, it assumes the Markov n-gram independence assumption P (wi |w1 ...wi−1 ) = P (wi |wi−n+1 ...wi−1 ) A straightforward maximum likelihood estimate of n-gram probabilities from a corpus is given by the observed frequency P (wi |wi−n+1 ...wi−1 ) =
#(wi−n+1 ...wi ) #(wi−n+1 ...wi−1 )
(14)
where #(.) is the number of occurrences of a specified gram in the training corpus. Unfortunately, using grams of length up to n entails estimating the probability of W n events, where W is the size of the word vocabulary. This quickly overwhelms modern computational and data resources for even modest choices of n (beyond 3 to 6). Also, because of the heavy tailed nature of language (i.e. Zipf’s law) one is likely to encounter novel n-grams that were never witnessed during training. Therefore, some mechanism for assigning non-zero probability to novel n-grams is a central and unavoidable issue. One standard approach to smoothing probability estimates to cope with sparse data problems (and to cope with potentially missing n-grams) is to use some sort of back-off estimator
340
Fuchun Peng and Dale Schuurmans
P (wi |wi−n+1 ...wi−1 )
Pˆ (wi |wi−n+1 ...wi−1 ), if #(wi−n+1 ...wi ) > 0 = β(wi−n+1 ...wi−1 ) × P (wi |wi−n+2 ...wi−1 ), otherwise
(15)
where discount #(wi−n+1 ...wi ) Pˆ (wi |wi−n+1 ...wi−1 ) = #(wi−n+1 ...wi−1 )
(16)
is the discounted probability, and β(wi−n+1 ...wi−1 ) is a normalization constant calculated to be Pˆ (x|wi−n+1 ...wi−1 ) 1− β(wi−n+1 ...wi−1 ) =
x∈(wi−n+1 ...wi−1 x)
1−
Pˆ (x|wi−n+2 ...wi−1 )
(17)
x∈(wi−n+1 ...wi−1 x)
The discounted probability (16) can be computed using different smoothing approaches including linear smoothing, absolute smoothing, Good-Turing smoothing and Witten-Bell smoothing [2]. Note that the basic unit used in the language models described above is the word. However, we can also consider text as a concatenated sequence of characters instead of words. The formulation of a character based language model is the same as above, except that the size of the vocabulary is much smaller, which greatly reduces the sparse data problem. Character level models also avoid the word segmentation problems that occur in many Asian languages such as Chinese and Japanese. To allow a comparison to Laplace smoothing (Eq. (10)), we briefly describe the standard smoothing techniques used in n-gram language modeling. Absolute Smoothing Here, the frequency of a word is subtracted by a constant b, so the discounted probability (Eq. 16) is calculated as #(wi−n+1 ...wi ) − b Pˆ (wi |wi−n+1 ...wi−1 ) = #(wi−n+1 ...wi−1 ) n1 where b is often defined as the upper bound b = n1 +2n , and ni is the number 2 of events which occur exactly i times in training data [15]. This notation also applies to other smoothing techniques. Linear Smoothing Here, the discounted probability is calculated as
#(wi−n+1 ...wi ) n1 )× Pˆ (wi |wi−n+1 ...wi−1 ) = (1 − Z #(wi−n+1 ...wi−1 ) where Z is the number of uni-grams, which corresponds to the number of words in the training data [15].
Combining Naive Bayes and n-Gram Language Models
341
Good-Turing Smoothing Good-Turing smoothing discounts the frequency of r by GTr = (r + 1) nnr+1 where the discounted probability is calculated as r Pˆ (wi |wi−n+1 ...wi−1 ) =
GT#(wi−n+1 ...wi ) #(wi−n+1 ...wi−1 )
Witten-Bell Smoothing Witten-Bell smoothing 3 is very similar to Laplace smoothing, except it reserves probability mass for OOV values, whereas Laplace smoothing does not. Here the discounted probability is calculated as Pˆ (wi |wi−n+1 ...wi−1 ) =
#(wi−n+1 ...wi ) #(wi−n+1 ...wi−1 ) + W
where W is the number of distinct words that can follow wi−n+1 ...wi−1 in the training data. In the uni-gram model, this corresponds to the size of vocabulary. We now show how naive Bayes models and statistical n-gram models can be combined to form a chain augmented naive Bayes classifier.
4
Using n-Gram Language Models as Text Classifiers
Text classifiers attempt to identify attributes which distinguish documents in different categories. Such attributes may include vocabulary terms, word average length, local n-grams, or global syntactic and semantic properties. Language models also attempt capture such regularities, and hence provide another natural avenue to constructing text classifiers. An n-gram language model can be applied to text classification in a similar manner to a naive Bayes model. In this case c∗ = arg max {P (c|d)} = arg max {P (d|c)P (c)} c∈C
c∈C
= arg max {P (d|c)} c∈C T = arg max Pc (wi |wi−n+1 ...wi−1 ) c∈C
(18) (19) (20)
i=1
where the step from Eq. (18) to Eq. (19) assumes a uniform prior over categories, and the step from Eq. 19 to Eq. (20) uses the Markov n-gram independence assumption. Likelihood is related to perplexity and entropy by Eq. (11) and Eq. (12). The principle for using an n-gram language model as a text classifier is to determine the category that makes a given document most likely to have been generated by the category model (Eq. (20)). Thus, we train a separate language model for each category, and classify a new document by evaluating its likelihood under each category, choosing the category according to Eq. (20). The parameters in the model are Θ = {θic = Pc (wi |wi−n+1 ...wi−1 ) : i = 1, ..., |T |; c = 1, ..., |C|}. 3
Witten-Bell smoothing is a misnomer since it was actually invented by Alistair Moffat, and is called method C in PPM text compression.
342
Fuchun Peng and Dale Schuurmans
C
v
1
v
2
v
3
.......
v
n
Fig. 2. Graphical model of a bi-gram chain augmented naive Bayes classifier
Different from naive Bayes classifier (Equ. (7)), Equ. (20) considers all the words during testing although some may be out of vocabulary. This is one difference between naive Bayes text classifier and language modeling based text classifier. Later we will see that this difference actually makes noticeable improvements. In a naive Bayes text classifier, attributes (words) are considered independent of each other given the category. However, in a language modeling based approach, this is enhanced by considering a Markov dependence between adjacent words. Due to this similarity, we refer the n-gram augmented naive Bayes classifier as a Chain Augmented Naive Bayes classifier (CAN). A graphical model of a bi-gram augmented naive Bayes text classifier is given in Fig. 2, where each leaf node is a word sequentially occurring in a document. We now experimentally evaluate the performance of chain augmented naive Bayes classifier on three real word data sets.
5
Empirical Evaluation
We present experimental results on different text classification problems in three different languages. First, we consider a Greek authorship attribution problem, where Greek documents must be classified as being written by one of 10 modern Greek authors. Then we consider an English newsgroup topic detection problem, where documents must be classified as belonging to one of 20 newsgroups. Finally, we consider a Chinese TREC topic detection problem, where Chinese documents must be classified into one of 6 topics. 5.1
Data Sets and Performance Measure
The Greek authorship attribution data we used has been previously investigated in [23], and can be downloaded from the WWW site of the Modern Greek weekly newspaper “TO BHMA”. The corpus consists of two document collections containing 20 works from 10 different authors (totaling 200 documents) each. In our experiments, we divided the collections into 10 training and 10 testing documents from each author. (The authors used in the data sets are shown in Table 1.) We also considered any concatenated character string delimited by white-space to be a word, which introduces some noise since many character strings are concatenated with punctuation marks. Nevertheless, we did not perform any extra
Combining Naive Bayes and n-Gram Language Models
343
Table 1. Authors in the Greek data set code 0 1 2 3 4
Author Name code Author Name S. Alaxiotis 5 D. Maronitis G. Babiniotis 6 M. Ploritis G. Dertilis 7 T. Tasios C. Kiosse 8 K. Tsoukalas A. Liakos 9 G. Vokos
Table 2. Topics in the Chinese TREC data set code 0 1 2 3 4 5
Topic Politics, Law and Society Literature and Arts Education, Science and Culture Sports Theory and Academy Economics
pre-processing to remove this noise. The number of unique words observed in the training corpus is 31,502. From these, we select the most frequent 30,000 words to form the vocabulary, which comprises 98.7% of the total word occurrences. The English 20 Newsgroup data4 we used has been investigated in research on text categorization [6, 14, 18]. It contains 19,974 non-empty documents evenly distributed across 20 newsgroups, which form our categories. We randomly select 80% of the documents to be used for training and leave the remaining 20% for testing. In our experiments, we selected the 70,000 most frequent words to form the vocabulary, which comprises 92.3% of total word occurrences. As with the Greek data set, the selected words have some noise which we did not remove. Finally, the Chinese data set we used has been previously investigated in [8]. The corpus is a subset of the TREC-5 People’s Daily news corpus published by the Linguistic Data Consortium (LDC) in 1995. The entire TREC-5 data set contains 77,733 documents on a variety of topics, including international and domestic news, sports, and culture. The corpus was originally intended for research on information retrieval. To make the data set suitable for text categorization, He et al. [8] first clustered documents into 101 groups that shared the same headline (as indicated by an SGML tag). The six most frequent groups were selected to make a Chinese text categorization data set, as shown in Table 2. In each group, 500 documents were randomly selected for training and 100 documents were reserved for testing. In our experiments, we selected the most frequent 2,000 Chinese characters to serve as the vocabulary, which comprised over 99% of the total character occurrences in the training corpus. 4
Available at http://www.ai.mit.edu/˜jrennie/20Newsgroups/
344
Fuchun Peng and Dale Schuurmans
Table 3. Results on Greek authorship attribution Considering OOV words n Adding One Absolute Good-Turing Linear Witten-Bell Acc. F-Mac Acc. F-Mac Acc. F-Mac Acc. F-Mac Acc. F-Mac 1 0.7600 0.7298 0.9600 0.9593 0.9300 0.9262 0.9600 0.9580 0.6100 0.5731 2 0.6000 0.5681 0.9600 0.9580 0.9500 0.9479 0.9500 0.9483 0.8300 0.7847 3 0.5400 0.5111 0.9600 0.9585 0.9500 0.9479 0.9500 0.9483 0.8300 0.7838 4 0.5600 0.5365 0.9600 0.9585 0.9500 0.9479 0.9500 0.9483 0.8400 0.8049 Not considering OOV words : 0.2277 OOV rate 1 0.6900 0.6769 0.9400 0.9337 0.9300 0.9239 0.9100 0.9015 0.5500 0.5178 2 0.5000 0.4674 0.9300 0.9233 0.9300 0.9235 0.8900 0.8751 0.8200 0.7760 3 0.4500 0.4050 0.9500 0.9464 0.9300 0.9235 0.8900 0.8751 0.8300 0.7847 4 0.4900 0.4557 0.9500 0.9464 0.9300 0.9235 0.8900 0.8751 0.8300 0.7847
For the sake of consistency with previous research [18, 23], we measure categorization performance by the overall accuracy, which is the number of correctly identified texts divided by the total number of texts considered. We also measure the performance with Macro F-measure, which is the average of the F-measures across all categories. F-measure is a combination of precision and recall [26]. 5.2
Experimental Results
The results of Greek authorship attribution are shown in Table 3. The upper half shows the results when considering out of vocabulary (OOV) words, and the lower half shows the results without considering OOV words. The OOV rate is the average rate of words that are out of vocabulary on all testing documents. The first column is the order of n-gram model, and each other column represents a different smoothing technique. The results of topic detection on the English 20 Newsgroup data set are shown in Table 4. Chinese topic detection is more difficult because words are not white-space delimited, as they are in English and Greek. Normally, a word segmenter is required for Chinese text classification [8]. However, we avoid the need for explicit segmentation by using a character level CAN Bayes classifier. Table 5 shows our experimental results on Chinese topic detection. For Greek and English, we can also apply character level CAN Bayes classifiers. The results of character level models on Greek and English are shown in Table 6 and Table 7 respectively. The size of the character vocabulary is 150 for Greek and 100 for English. 5.3
Discussion
The performance of a language model based text classifier depends on several factors, including order n of n-gram models, smoothing techniques, whether or
Combining Naive Bayes and n-Gram Language Models
345
Table 4. Topic detection results on the English 20 Newsgroup data with word models Considering OOV words n Adding One Absolute Good-Turing Linear Witten-Bell Acc. F-Mac Acc. F-Mac Acc. F-Mac Acc. F-Mac Acc. F-Mac 1 0.8505 0.8442 0.8664 0.8628 0.8595 0.8559 0.8720 0.8691 0.8449 0.8386 2 0.4751 0.4768 0.8796 0.8754 0.8778 0.8741 0.8796 0.8759 0.8749 0.8712 3 0.3287 0.3339 0.8751 0.8718 0.8741 0.8708 0.8733 0.8700 0.8693 0.8659 4 0.3152 0.3198 0.8757 0.8726 0.8727 0.8697 0.8743 0.8713 0.8706 0.8674 Not considering OOV words : 0.1121 OOV rate 1 0.8431 0.8344 0.8717 0.8673 0.8611 0.8562 0.8727 0.8686 0.8375 0.8287 2 0.4751 0.4752 0.8804 0.8760 0.8791 0.8748 0.8794 0.8755 0.8733 0.8690 3 0.3348 0.3388 0.8757 0.8718 0.8746 0.8707 0.8765 0.8728 0.8704 0.8663 4 0.3213 0.3251 0.8780 0.8742 0.8757 0.8718 0.8770 0.8735 0.8704 0.8665
Table 5. Topic detection results on Chinese TREC data with character models Considering OOV words n Adding One Absolute Good-Turing Linear Witten-Bell Acc. F-Mac Acc. F-Mac Acc. F-Mac Acc. F-Mac Acc. F-Mac 1 0.7650 0.7704 0.7667 0.7713 0.7600 0.7665 0.7567 0.7630 0.7667 0.7720 2 0.7217 0.7085 0.8050 0.8041 0.8050 0.8050 0.7950 0.7922 0.8017 0.7997 3 0.7033 0.6919 0.8017 0.7989 0.8133 0.8101 0.8000 0.7978 0.8000 0.7952 4 0.6967 0.6842 0.8017 0.7989 0.8117 0.8085 0.8067 0.8049 0.8000 0.7956 Not considering OOV words : 0.0514 OOV rate 1 0.7750 0.7769 0.7783 0.7799 0.7783 0.7799 0.7783 0.7799 0.7783 0.7799 2 0.6633 0.6431 0.7967 0.7950 0.7933 0.7914 0.7850 0.7811 0.7933 0.7901 3 0.6500 0.6288 0.7883 0.7843 0.7933 0.7890 0.7883 0.7845 0.7883 0.7832 4 0.6500 0.6274 0.7783 0.7722 0.7917 0.7875 0.7883 0.7851 0.7833 0.7777
Table 6. Results on Greek authorship attribution with character models (only 0.12% OOV characters encountered) n 1 2 3 4 5 6
Laplace Acc. F-Mac 0.5600 0.5051 0.8200 0.7900 0.7000 0.6348 0.4700 0.3878 0.3500 0.2869 0.1600 0.1001
Absolute Acc. F-Mac 0.5700 0.5318 0.8500 0.8395 0.9000 0.8902 0.8700 0.8507 0.8600 0.8307 0.8600 0.8326
Good-Turing Acc. F-Mac 0.5500 0.4944 0.8000 0.7536 0.7900 0.7453 0.7900 0.7221 0.7900 0.7240 0.7900 0.7250
Linear Acc. F-Mac 0.5500 0.4944 0.8400 0.8339 0.8900 0.8801 0.8500 0.8235 0.8700 0.8524 0.8700 0.8534
Witten-Bell Acc. F-Mac 0.5500 0.4944 0.8400 0.8187 0.8900 0.8742 0.8800 0.8613 0.8600 0.8309 0.8600 0.8329
346
Fuchun Peng and Dale Schuurmans
Table 7. Topic detection results on English 20 Newsgroup data with character models (no OOV characters) n 1 2 3 4 5 6 7 8 9
Laplace Acc. F-Mac 0.2216 0.2126 0.6718 0.6531 0.8417 0.8344 0.8266 0.8173 0.7359 0.7246 0.6471 0.6393 0.5740 0.5691 0.5178 0.5088 0.4616 0.4521
Absolute Acc. F-Mac 0.2214 0.2123 0.6760 0.6580 0.8645 0.8602 0.8831 0.8795 0.8863 0.8832 0.8863 0.8830 0.8855 0.8822 0.8828 0.8796 0.8796 0.8767
Good-Turing Acc. F-Mac 0.2211 0.2120 0.6861 0.6675 0.8600 0.8554 0.8757 0.8725 0.8717 0.8684 0.8791 0.8751 0.8783 0.8746 0.8730 0.8709 0.8743 0.8715
Linear Acc. F-Mac 0.2211 0.2120 0.6837 0.6650 0.8584 0.8548 0.8746 0.8719 0.8823 0.8801 0.8794 0.8773 0.8844 0.8824 0.8818 0.8798 0.8823 0.8807
Witten-Bell Acc. F-Mac 0.2211 0.2120 0.6686 0.6503 0.8629 0.8578 0.8865 0.8828 0.8897 0.8865 0.8908 0.8874 0.8900 0.8864 0.8892 0.8855 0.8897 0.8861
not considering OOV words, using character level model or word level model. We will discuss the influence of these factors below. Effects of Order n of n-Gram Models Relaxing the naive Bayes independence assumption to consider local context dependencies is one of the main motivations of the CAN Bayes model. From Table 6 and Table 7, we can obviously see the increase of classification accuracy with longer context. However, the increase stops at some point. This is due to the sparseness of data when larger n is used. That is, the additional information provided by longer context becomes compromised by data sparseness. Data sparseness also explains why the context information does not help in the Chinese data beyond 2-grams. The performance increase 3-4% from 1-gram to 2-gram, but does not increase any more. There are 3573 most commonly used characters in Chinese compared to 100 (upper case, lower case, and punctuation) in English. Data sparseness is much more serious in Chinese than in English. Also, most Chinese words consist of 1-2 characters. Bi-grams have been found very effective in Chinese IR [11]. Longer context information does not help improve classification accuracies in Greek and English at the word level (except for Witten-Bell smoothing, which may be due to its poor performance on uni-gram models), because the sparse data problem at the word level is more much serious than at the character level. Overall, relaxing independence assumptions can help in cases where there is sufficient training data to reduce the sparse data problem, such as with character level models. However, when one does not have sufficient training data, it becomes important to use short context models that avoid sparse data problems. These results may offer another explanation of why the naive Bayes classifier is preferred in practice, because normally one can not get sufficient labeled training data to train a large-context model.
Combining Naive Bayes and n-Gram Language Models
Entropy
13 12.5
0.6 0.4
Entropy
Greek authorship attribution
1 0.8
1
1.5
2
2.5 English Topic Detection
3
3.5
12 11.5
4
1
14
0.8
13.5 Entropy
Entropy
Greek authorship attribution
0.6 0.4 0.2
1.5
2
2.5 English Topic Detection
3
3.5
1
1.5
2
2.5 Chinese Topic Detection
3
3.5
4
13
1
1.5
2
2.5 Chinese Topic Detection
3
3.5
12
4
11
0.8 0.75 0.7 1
1.5
2
2.5 order n of n−gram models
3
3.5
Absolute Good−Turing Linear Witten−Bell Adding−One 4
Fig. 3. Classification performance curves
Entropy
Accuracy
1
12.5
0.85
0.65
347
4 Absolute Good−Turing Linear Witten−Bell Adding−One
10 9 8
1
1.5
2
2.5 order n of n−gram models
3
3.5
4
Fig. 4. Entropy curves
Effect of Smoothing Technique To make the results more comprehensible, we illustrate the upper parts of Table 3, 4 and 5 in Figure 3. We also illustrate the corresponding entropy curves in Figure 4. The entropy is averaged across all testing documents. One obvious phenomena is that the different smoothing techniques behave quite differently in our experiments. Add-one smoothing performs much worse than other smoothing techniques (except uni-gram model on Greek dataset). A interesting consequence of add-one smoothing is that it overfits much earlier than other smoothing. Absolute smoothing and linear smoothing generally perform well. Witten-Bell smoothing (Moffat smoothing) does not perform as well on the word level model, despite the fact that it performs best in character level models (Table 7). Overall, absolute and linear smoothing performed best, and Laplace smoothing performed worst in our experiments. Effect of Considering OOV Words As mentioned in the introduction, discarding OOV words forgoes some information provided by these values. This weakness is revealed in our experiments. By comparing the upper parts with the lower parts of the tables, one can see that when the OOV rate is low (for example, Table 4 and 5), the performance obtained when ignoring OOV words is roughly the same as when considering OOV words (performance within 2%). However, when the OOV rate is high (for example as in Table 3, where the Greek data set has 22.77% OOV words), ignoring OOV words can noticeably damage performance of most smoothing techniques (up to a 7% reduction). This implies that considering OOV words is better than ignoring them when the sparse data problem is serious. Character Level versus Word Level For many Asian languages such as Chinese and Japanese, where word segmentation is a hard, our character level CAN Bayes model is well suited for text classification because it avoids the need for word segmentation. For Western languages such as Greek and English, we can work at both the word and character levels. In our experiments, we actually found that the character level models worked slightly better than the word level
348
Fuchun Peng and Dale Schuurmans
models in the English 20 Newsgroup data set (89% vs. 88%). It appears that the character level models are capturing some regularity that the word level models are missing in this case. By relaxing the context, character level models can also capture regularities at the word level, and even phrase level regularities. However, in our experiments on the Greek data, we found that the character level models performed worse than the word level models (90% vs. 96%). So far, it remains inconclusive which level is the best to use for text classification with Western languages. This suggests that perhaps combining the two levels would result in more robust and better results. Overall Performance Compared to State-of-the-Art The results we have reported here are comparable to (or much better than) the start-of-the-art results on the same data sets. Our 96% accuracy on the Greek authorship attribution is much better than 72% reported in [23] which is based on a much more complicated analysis. Our 89.08% accuracy on the 20 Newsgroups data set is better than the best results 87.5% reported in [18] which is based on a combination of SVM and error correcting output coding (ECOC). Our 81.33% accuracy on the Chinese TREC data is at the same level as the results reported in [8] which is based on SVM, word segmentation, and feature selection. Overall, the chain augmented naive Bayes classifier works very well, even though it is a much simpler technique than these other methods and it is not specialized to any particular data set. 5.4
Relationship to Other Work
Using n-gram language models for text categorization has been considered in [3]. However, this work used n-grams as features for a traditional feature selection process, and then deployed classifiers based on calculating feature vector similarities. In our CAN Bayes models, we do not perform explicit feature selection at all (although of course we have to choose a few factors, such as the order n, smoothing technique and vocabulary size). Thus, in our case, all n-grams remain in the model, and their importance is implicitly considered by their contribution to perplexity. Using language modeling techniques for text categorization is a relatively new research area in IR, although some work has already been done. Harper [24] used a PPM compression method [1] for text categorization where they seek a model that obtains the best compression on a new document. The PPM compression model deals with OOV words with an escape method which essentially is a weighted linear interpolation of several different n-gram models. Also, the use of n-gram models is related to the phrase weighting in IR [25]. An n-gram could be considered as a phrase and its weight is calculated by smoothed frequency counting. Relaxing the independence assumption of the Naive Bayes model is a much researched idea in machine learning, and other researchers have considered learning tree augmented naive Bayes classifiers from data [7, 10]. However, learning
Combining Naive Bayes and n-Gram Language Models
349
the hidden tree structure is problematic, and our chain augmented naive Bayes model, being a special case of TAN Bayes, better preserves the simplicity of the naive Bayes classifier while introducing some of the additional dependencies of TAN Bayes.
6
Conclusions
We have presented a chain augmented naive Bayes classifier (CAN) based on statistical n-gram language modeling. Our CAN Bayes model captures dependence between adjacent attributes as a Markov chain. By using better smoothing techniques than Laplace smoothing we obtain further performance improvements. Our CAN Bayes modeling approach is able to work at either the character level or the word level, which provides language independent abilities to handle Eastern languages like Chinese and Japanese just as easily as Western languages like English or Greek. Our experimental results support the utility of our approach. We are currently investigating other data sets such as Reuters-21578 data set.
Acknowledgments We thank E. Stamatatos for supplying us with the Greek authorship attribution data, Ji He for the Chinese topic detection data, the four anonymous reviewers for their constructive comments, and William Teahan for his clarification of WittenBell smoothing. Research supported by Bell University Labs and MITACS.
References [1] T. Bell, J. Cleary and I. Witten. (1990). Text Compression. Prentice Hall. 348 [2] S. Chen and J. Goodman. (1998). An Empirical Study of Smoothing Techniques for Language Modeling. Technical report, TR-10-98, Harvard University. 338, 340 [3] W. Cavnar, J. Trenkle. (1994). N-Gram-Based Text Categorization. In Proceedings of SDAIR-94. 348 [4] P. Domingos and M. Pazzani. (1997). Beyond Independence: Conditions for the Optimality of the Simple Bayesian Classifier. Machine Learning, 29, 103-130 335 [5] R. Duda and P. Hart. (1973). Pattern Classification and Scene Analysis. Wiley, NY. 336, 337 [6] S. Eyheramendy, D. Lewis and D. Madigan. (2003). On the Naive Bayes Model for Text Categorization. To appear in Artificial Intelligence & Statistics 2003. 337, 343 [7] N. Friedman, D. Geiger, and M. Goldszmidt. (1997). Bayesian Network Classifiers. In Machine Learning 29:131–163. 335, 348 [8] J. He, A. Tan, and C. Tan. (2000). A Comparative Study on Chinese Text Categorization Methods. In Proceedings of PRICAI’2000 International Workshop on Text and Web Mining, p24-35. 343, 344, 348 [9] D. Hiemstra. (2001). Using Language Models for Information Retrieval. Ph.D. Thesis, Centre for Telematics and Information Technology, University of Twente. 339
350
Fuchun Peng and Dale Schuurmans
[10] E. Keogh and M. Pazzanni. (1999). Learning Augmented Bayesian Classifiers: A Comparison of Distribution-based and Classification-based Approaches. In Artificial Intelligence & Statistics 1999 335, 348 [11] K. Kwok. (1999). Employing Multiple Representations for Chinese Information Retrieval, JASIS, 50(8), 709-723. 346 [12] D. Lewis. (1998). Naive (Bayes) at Forty: The Independence Assumption in Information Retrieval. In Proceedings ECML-98. 335 [13] C. Manning, and H. Sch¨ utze. (1999). Foundations of Statistical Natural Language Processing, MIT Press, Cambridge, Massachusetts. 338 [14] A. McCallum and K. Nigam. (1998). A Comparison of Event Models for Naive Bayes Text Classification. In Proceedings of AAAI-98 Workshop on ”Learning for Text Categorization”, AAAI Presss. 335, 337, 343 [15] H. Ney, U. Essen, and R. Kneser. (1994). On Structuring Probabilistic Dependencies in Stochastic Language Modeling. In Comput. Speech and Lang., 8(1), 1-28. 340 [16] M. Pazzani and D. Billsus. (1997). Learning and Revising User Profiles: The identification of interesting web sites. Machine Learning, 27, 313-331. [17] J. Ponte, W. Croft. (1998). A Language Modeling Approach to Information Retrieval. In Proceedings of SIGIR1998, 275-281. 339 [18] J. Rennie. (2001). Improving Multi-class Text Classification with Naive Bayes. Master’s Thesis. M. I. T. AI Technical Report AITR-2001-004. 2001. 343, 344, 348 [19] I. Rish. (2001). An Empirical Study of the Naive Bayes Classifier. In Proceedings of IJCAI-01 Workshop on Empirical Methods in Artificial Intelligence. 335 [20] S. Robertson and K. Sparck Jones. (1976). Relevance Weighting of Search Terms. JASIS, 27, 129-146. 335 [21] S. Scott and S. Matwin. (1999). Feature Engineering for Text Classification. In Proceedings of ICML’ 99, pp. 379-388. 337 [22] F. Sebastiani. (2002). Machine Learning in Automated Text Categorization. ACM Computing Surveys, 34(1):1-47, 2002. 336 [23] E. Stamatatos, N. Fakotakis and G. Kokkinakis. (2000). Automatic Text Categorization in Terms of Genre and Author. Comput. Ling., 26(4), pp.471-495. 342, 344, 348 [24] W. Teahan and D. Harper. (2001). Using Compression-Based Language Models for Text Categorization. In Proceedings of Workshop on LMIR. 348 [25] A. Turpin and A. Moffat. (1999). Statistical Phrases for Vector-Space Information Retrieval. Proceedings of SIGIR 1999, pp. 309-310. 348 [26] Y. Yang. (1999). An Evaluation of Statistical Approaches to Text Categorization. Information Retrieval, Vol. 1, No. 1/2, pp. 67–88. 344
WebDocBall: A Graphical Visualization Tool for Web Search Results Jes´ us Vegas1 , Pablo de la Fuente1 , and Fabio Crestani2 1
2
Dpto. Inform´ atica, Universidad de Valladolid Valladolid, Spain {jvegas,pfuente}@infor.uva.es Dept. Computer and Information Sciences, University of Strathclyde Glasgow, Scotland, UK F.Crestani@cis.strath.ac.uk
Abstract. In the Web search process people often think that the hardest work is done by the search engines or by the directories which are entrusted with finding the Web pages. While this is partially true, a not less important part of the work is done by the user, who has to decide which page is relevant from the huge set of retrieved pages. In this paper we present a graphical visualisation tool aimed at helping users to determine the relevance of a Web page with respect to its structure. Such tool can help the user in the often tedious task of deciding which page is relevant enough to deserve a visit.
1
Introduction
Searching the Web is one of the most frequent tasks nowadays. Unfortunately, it is often also one of the most frustrating tasks. The user gets little help from a Web search engines or a Web directories. The former lacks precision, while the scope of the latter is often too small. The only tool the user has to initiate the search is usually just a small set of query terms and, after the query process, the user is left with a huge amount of information to process manually. While much work has been devoted to design and develop algorithms to improve the query process, little has been done to help the users to find the needle in this “document stack”. In the remainder of this paper we will use the terms We page and document interchangeably. According to Shneiderman, the search process can be divided in four phases [15]: 1. formulation: the information need is expressed in the query. 2. search: the query is submitted to the search engine and is processed. 3. reviewing of the results: the retrieved document set obtained is reviewed by the user. 4. refinement: the query is reformulated in a manual or semi-automatic way to try to improve the retrieval results. F. Sebastiani (Ed.): ECIR 2003, LNCS 2633, pp. 351–362, 2003. c Springer-Verlag Berlin Heidelberg 2003
352
Jes´ us Vegas et al.
The third phase is where information visualisation can help the user improve the effectiveness of the manual task of browsing the results set. In this phase, the user has to identify a relevance relation between the query he formulated and the results obtained. Usually, the user sees a list of URLs and titles of documents with little more information about them, so this task is hard and tedious and, frequently, the user has to wait several seconds to see that a page is not interesting. It is clear that this is the phase where the user needs assistance to identify potentially relevant documents and discard those that are not useful. This phase is very important, since it has a major impact on the user satisfaction with a system. The areas of interest in this phase are three [12]: set level, site level and document level. At the set level the objective is to represent the entire set of results. Several techniques has been developed, such as, for example, scatter-plots and starfields [1], maps or landscapes metaphors [5], wall metaphor [11], or cone trees [13]. The Web site level tries to locate the retrieved documents in the Web site structure, since the user could be interested in Web sites, not just Web pages. It also tries to tackle the “lost in hyperspace” problem [10]. At the document level, the objective is to help the user to decide if one page is relevant to his/her information need or not. Our work is directed at this level. For this task, we propose a graphical tool to assist the user in the review phase. The visualisation tool displays to the user the structure of the HTML document and the estimated relevance of its parts with respect the query. The tool is based on two assumptions: pages have a hierarchical structure, and the result set can be post-processed. Both assumptions can be easily satisfied. The paper is structured as follows. In Section 2 we review related work, concentrating on visualisation tools used at document level. In Section 3 we introduce a new tool for the visualisation of retrieved documents in Web searches. In addition, we compare our proposal with related work. A description of a Web search engine that incorporated the visualisation tool is reported in Section 4. Finally, Section 5 reports our initial conclusions and provides an outline of future work.
2
Information Visualisation Tools at the Document Level
The document level is the one in which the user analyse the answers obtained from a Web search engine. Here, a large number of pages (the actual number can vary from one to thousands) are presented to the user, who has the hard task of identifying those relevant to his/her information need. Usually, the user is provided with little help for this task. The most important tools designed for this tasks are Tilebars [9], relevance curves [14] and the thumbnail view [4]. Before we present and compare about these three tools, we need a framework for comparison. In order to build it, we need to answer the following question: what does the user need when he is browsing at the document level a result set obtained from a Web query? An established answer, to which we fully subscribe,
WebDocBall: A Graphical Visualization Tool for Web Search Results
a) Tilebars
b) Relevance Curves
353
c) Thumbnails
Fig. 1. Tilebars, Relevance Curves and Thumbnails
is that the user not only needs to know about the relevance of a document, but also “where” the document is relevant. The vast majority of documents that are available on the Web have some hierarchical structure [2], which can either be explicit, like in XML documents, or implicit, like in HTML documents. We argue that the user could get very quickly an idea of the actual relevance of a document by looking at the way the parts estimated to be relevant are distributed in it. In addition, the user can be interested not only about the concentration of relevant parts, but in what are the hierarchical relations among them. Another important information about the retrieved document is its type. This can be inferred from the structure of the document. The user could be more interested in a document with a very flat structure, than in one with a more deep structured. Another important aspect of the retrieved documents is its size. A short letter and an extend technical report are clearly not the same. So, there are three aspects that can help the user analyse the results of a Web search at document level: the relevance the document and how this is distributed on the document parts, the structure of the document, and the size of the document. Figure 1 shows document representations using Tilebars, relevance curves and thumbnail. The first two representations show the relevance of each passage or segment of the text, using a row for each query term. The size of the documents is represented by the Tilebars or the relevance curve size. The passages can correspond to paragraphs or sections, or units of fixed arbitrary length. Both Tilebars and relevance curves show whether and where the document is relevant. However, the use of the structure is only done in a linear way, being it impossible to appreciate the hierarchical relations between the structure elements found in the document. The third document representation is the thumbnail. In this case no information about the size or the structure of the document is provided. The only information represented is related to the appearance of the document. Therefore, a thumbnail representation can complement the two first representations and it is useful when the user works frequently with the same document set and can recognise a document by its thumbnail view. The only information
354
Jes´ us Vegas et al.
about the structure that the user can obtain from this representation is the information that can be inferred from the appearance of the different elements in the document, and this is not enough, since the user also needs information about the relevance of the different parts of the document.
3
The Webdocball
In this paper we present a visual metaphor that can explain the user why a Web document was retrieved by a Web search engine, by showing where in the structure of the document estimated relevance lies. We call this metaphor Webdocball, in analogy to the Docball metaphor presented in [16], of which it is an extension in the Web domain. This visualisation element is included in a prototype system that works on top of a Web search engine by post-processing the results obtained from the search engine to allow the user to browse the result set using different representations of the documents. Figure 2 shows the Webdocball representation of a Web document. In the Webdocball, each ring represents a level of the hierarchical structure of the document, where the centre represents the entire document. In a ring, the regions represent the structural elements in that level. Inside a ring elements are presented in a clockwise order. Each region in the Webdocball is coloured with regard to its estimated relevance: a hotter colour indicates more relevance, a colder colour represents less relevance. White regions have been estimated to be not relevant. Regions are ”clickable”, so that the Webdocball can be used as a navigation tool of the Web document. The Webdocball representation can be considered as the representation of a tree structure, which depends on two parameters: the number of elements in the deeper structural level (the number of leaves) and the number of structural levels in the document (the height of the tree).
Fig. 2. The Webdocball metaphor
WebDocBall: A Graphical Visualization Tool for Web Search Results
a)
355
b)
Fig. 3. Different Webdocballs representing different structures of Web documents
A Web document with a large number of elements will have very narrow regions in the corresponding rings. The regions corresponding to leaves are represented from their level ring to the exterior ring. In addition, in order to enable a clear representation of Web documents with many levels, the height of the rings decreases the deeper the structural level it represents. This feature was not present in the Docball representation. Such feature can be seen in Figure 3, where different Webdocball are shown with respect to the number of leaves and structural levels of the document represented. The Webdocball (a) represents a Web document with a deep structural hierarchy, whereas the document represented by the Webdocball (b) is more flat with respect the its structure, but has a larger number of leaves. 3.1
Comparing Webdocball and Tilebars Representations
In this section, we compare the Webdocball and the Tilebars representations. We do not consider relevance curves because they can be considered just a version of Tilebars. Also, we do not consider Thumbnails because they do not represent structural information. A Webdocball exploits the structure of the documents to show the estimated relevance of the documents, in a similar way to Tilebars, but it goes one step beyond Tilebars. In Tilebars the structure is represented in a linear way, and it is impossible to extract the hierarchical relations between the structural elements as it can be done in the Webdocball representation. So, a Webdocball allows to visualise the structural complexity of the retrieved documents. However, it should be recognised that Tilebars enable the representation of the length of the document, something that is not possible in the Webdocball representation. Another difference is that in Tilebars, the relevance of each single query term is displayed, whereas a Webdocball represents the relevance of all the query
356
Jes´ us Vegas et al.
Fig. 4. Architecture of the Webdocball system
terms. In the case of few query terms Tilebars can be better that Webdocballs. However, in the case of many query terms, Webdocballs are clearly better. In fact, Tilebars cannot manage query expansion by relevance feedback process, where many query terms are often added to the query. In such case, Webdocballs are more useful, since the relevance representation is independent of the number of query terms.
4
A Description of the Webdocball System
The Webdocball visualisation tool is part of a prototype Web search engine we have developed on top of an existing search engine. The prototype is written in Java and the Webdocball visualisation tool has been developed using the SVG (Scalable Vector Graphics) standard [6]. The Web search engine is built on top of Google using the Google Web APIs1 . Google uses the SOAP (Simple Object Access Protocol) [8] and the WSDL (Web Services Description Language) [7] standards, enabling us to use Java for the prototype development. Since a Webdocball represents the estimated relevance of a Web document at each structural level, we need to be able to determine the structure of the Web document, and to estimate the relevance of each structural element with respect to the query. To achieve this, we need to post-process the results set obtained from Google to obtain the information needed to draw the Webdocball. All of this can be seen in the diagrammatic system architecture shown in Figure 4. The query process is the usual one: the system enables the user to submit a natural language query, which is processed by Google. The search results are presented to the user as a list of Web documents with associated Webdocball representations. An example of result list is presented in Figure 5. In the result list each document is presented with its KWIC (Key Word in Context), the link to the site where is the document, and the correspondent Webdocball. The Webdocball is connected with a post-processed form of the 1
Google Web APIs are a free beta service and are available for non-commercial use only at |http://www.google.com/apis—
WebDocBall: A Graphical Visualization Tool for Web Search Results
357
Fig. 5. Results in the Webdocball system
original Web document which is stored in a local cache. The Webdocball is then a simplified version of the Web document that shows to the user information related to the document structure, which is coloured in relation to the estimated relevance degree of each element. From this post-processed document, the user can visit the original one, either by accessing the system cache or by going to the real Web page following the link. In the next sections, we are going to explain the two most interesting phases of the process of construction of a Webdocball representation: the document structure extraction and estimation of relevance of each structural element of the document. 4.1
Extracting the Structure of a Web Document
Documents on the Web are of many different types, but mostly they are HTML documents [2], although XML, PDF and other types of documents can also be found. As explained in the previous section, in order to construct a Webdocball we need to determine the structure of Web documents. To obtain this from XML documents is very easy, since the document structure is expressed explicitly. Unfortunately, the number of XML documents available on the Web is very limited,
358
Jes´ us Vegas et al.
and most documents are in HTML, so we have to extract structural information from HTML labels. We found several problems in this process, the main two being that HTML labels are used with no discipline by the Web documents authors, and that the HTML labels express structural information in an implicit way. Therefore we need to answer these two questions: which are the most common HTML labels in the Web and what are their structural significance. To answer these questions we build a random URL generator using the Google search engine. We retrieved via Google, using a random set of words, 30,000 distinct HTML pages, comprising 13,124,339 HTML (labels). From an analysis of the results we found that the most often used labels were, in decreasing order: content, p-implied, td, br, tr, img, p, comment, table, span, li, script, div. meta, input, title, center, hr, ul, body, html, head, form, link, select, frame, object, and ol. In addition, we obtained some important information about the structure of HTML documents: – – – –
The average number of structural levels in HTML documents is 10.66. Tables are widely used, with an average of 10 tables per page. The paragraph label (p) is used 13 times per page on average. The number of frames, forms and links per page is very low, less than 2, on average.
From the previous label set, we have chosen to consider those labels that have structural meaning, that is, labels used in Web documents to express hierarchical relations. These were the following: – tables: table, tr, and td. – lists: ul, ol, and li – paragraphs: p, and br. We do not use the main structural level labels html, body and head because there is only one of each per page and they do not add structural information that could be used to discriminate between the retrieved documents. To understand how a Web document is represented using a Webdocball metaphor, let us consider the Web document shown in Figure 6, as it can be viewed using the Netscape We page editor (the boxed labels represent the HTML labels). This is a page of an introduction course in IR. The document is composed by four tables (title, navigational tool, content, and foot). The tables are used to organise the content in the Web page. The most interesting table is the content one, because its left column is used to index the content in the right column. In this right column, there are several HTML elements (paragraphs and lists, mainly) with structural meaning. This structural information can be seen in the Webdocball depicted in Figure 7.
WebDocBall: A Graphical Visualization Tool for Web Search Results
359
Fig. 6. Example of Web document 4.2
Determining the Relevance of a Structural Element
In order to colour the Webdocball we need to estimate the relevance of each structural element of the Web document with respect to the query. To do this we use a modified version of the Vector Space Model (VSM). The original VSM is not suitable to index Web documents, because it does not consider important aspects of the Web like the hyperlinks and other information useful to index the Web documents with success (see [3] for more information about indexing the Web). However, it can still be very useful for our very specific purpose. The model we propose considers a Web document as the collection of items to index, where the elements of the document are the items to index. In a Web document there are two types of elements, content (text) and structural elements (labels). We can transform a Web document in a collection of items to index in a two phase process: first each content element is indexed using the VSM, then the indexing weight of the content elements are spread to the top of the
360
Jes´ us Vegas et al.
Fig. 7. The Webdocball of the Web document in the Figure 6
structural hierarchy (i.e. towards the centre of the Webdocball) as indicated by the structural elements. This process is more formally explained in the following. Let us assume that a Web documents d is composed of a hierarchy S of m structural elements s, and can be viewed as d={s1 , s2 , . . ., sm }. Two structural elements are related by an inclusion relation, si ⊂ sj when si is included in sj according to the hierarchy S. The inclusion relation is called directed, denoted by ⊂ , if ∃sk / si ⊂ sk ⊂ sj . A structural element will be a leaf element when there is no element included in it. A structural element sj in a document will have a weight wi,j ≥ 0 with respect to the index term ki calculated as follows: f reqi,j m if sj is a leaf maxl f recl,j × log mi wi,j = (1) w if s is not a leaf i,l j ∀sl ⊂ sj Therefore, as in the VSM, the weight vector of a structural element sj in the document d is represented by sj = {w1,j , w2,j , . . . , wt,j }. The similarity between the query vector and the structural elements vector can be calculated using cosine correlation, as it is done in the standard VSM.
5
Conclusions and Future Work
We have presented a graphical tool for the visualisation of Web documents retrieved by a Web search. The proposed tool uses the structure of the Web documents to show the user where estimated relevance is located inside the document. In addition, we have developed a prototype system, based on Google, that retrieves documents from the Web and uses a modified version of the Vector Space Model to estimate the relevance of each structural element of Web documents to a user query.
WebDocBall: A Graphical Visualization Tool for Web Search Results
361
Currently, we are carrying out an evaluation of the visualisation tool. Preliminary tests have been satisfactory with respect the appearance and utility of the visual metaphor, as it was already found for the Docball metaphor [16]. The most serious drawback, at this stage, is the answer time of the system, which it is very high due to the amount of post-processing work needed to calculate and to draw the Webdocball representation. We are currently working to reduce the time necessary to do that. The work presented in this paper is part of a wider work aimed at the design, implementation, and evaluation of a complete system for Web retrieval. The next step in this project will be to answer the question of where retrieved documents are located in a Web site. We plan to use the same visual metaphor to represent the search results at the set, site and document level, to help the user in the Web searching process.
Acknowledgements Large part of the implementation of the GUI has been carried out by Javier L´opez Gonz´ alez, student at the University of Valladolid. This work was partially supported by the Spanish CICYT program (project TEL99-0335-C04).
References [1] C. Ahlberg and B. Shneiderman. Visual Information Seeking: Tight Coupling of Dynamic Query Filters with Starfield Displays. In Human Factors in Computing Systems. Conference Proceedings CHI’94, pages 313–317, 1994. 352 [2] R. Baeza-Yates and B. Ribeiro-Neto. Modern Information Retrieval. AddisonWesley, 1999. 353, 357 [3] S. Brin and L. Page. The Anatomy of a Large-Scale Hypertextual Web Search Engine. Computer Networks and ISDN Systems, 30(1–7):107–117, 1998. 359 [4] S. K. Card, G. G. Robertson, and W. York. The Webbook and the Web Forager: an Information Workspace for the World Wide Web. In Proceedings of the Conference on Human Factors in Computing Systems CHI’96, 1996. 352 [5] M. Chalmers. Using a Landscape to Represent a Corpus of Documents. In COSIT’93, 1993. 352 [6] SVG Working Group. Scalable Vector Graphics (SVG) 1.1 Specification. Candidate Recommendation, 2002. http://www.w3.org/TR/2002/CR-SVG1120020430/. 356 [7] Web Services Description Working Group. Web Services Description Language (WSDL) Version 1.2. Working Draft. http://www.w3.org/TR/2002/WD-wsdl1220020709/. 356 [8] XML Protocol Working Group. SOAP Version 1.2 Part 0: Primer. Working Draft. http://www.w3.org/TR/2002/WD-soap12-part0-20020626/. 356 [9] M. A. Hearst. Visualization of Term Distribution Information in Full Text Information Access. In ACM SIGCHI Conference on Human Factors in Computing Systems (CHI), 1995. 352
362
Jes´ us Vegas et al.
[10] J. Lamping and R. Rao. Laying out and Visualizing Large Trees using a Hyperbolic Space. In ACM Symposium on User Interface Software and Technology, pages 13–14, 1994. 352 [11] J. D. Mackinlay, G. G. Robertson, and S. K. Card. The Perspective Wall: Detail and Context Smoothly Integrated. In CHI’91, pages 173–179, 1991. 352 [12] T. M. Mann. Visualization of WWW Search Results. In DEXA Workshop, pages 264–268, 1999. 352 [13] G. Robertson, J. Mackinlay, and S. Card. Cone trees: Animated 3d Visualizations of Hierarchical Information. In Conference on Human Factors in Computing Systems CHI’91, pages 189–194, 1991. 352 [14] Arisem S. A. http://www.arisem.com. 352 [15] B. Shneiderman. Designing the User Interface. Strategies for Effective HumanComputer Interaction. Addison-Wesley, 1992. 351 [16] J. Vegas, P. de la Fuente, and F. Crestani. A Graphical User Interface for Structured Document Retrieval. In ECIR 02, BCS-IRSG European Colloquium in Information Retrieval Research, pages 268–283, March 2002. 354, 361
Relevance feedback for content-based image retrieval: what can three mouse clicks achieve?
Daniel C Heesch and Stefan Ruger Department of Computing South Kensington Campus, Imperial College London London SW7 2AZ, England fdh500,s.ruegerg@imperial.ac.uk
We introduce a novel relevance feedback method for contentbased image retrieval and demonstrate its eectiveness using a subset of the Corel Gallery photograph collection and ve low-level colour descriptors. Relevance information is translated into updated, analytically computed descriptor weights and a new query representation, and thus the system combines movement in both query and weight space. To assess the eectiveness of relevance feedback, we rst determine the weight set that is optimal on average for a range of possible queries. The resulting multiple-descriptor retrieval model yields signi cant performance gains over all the single-descriptor models and provides the benchmark against which we measure the additional improvement through relevance feedback. We model a number of scenarios of user-system interaction that differ with respect to the precise type and the extent of relevance feedback. In all scenarios, relevance feedback leads to a signi cant improvement of retrieval performance suggesting that feedback-induced performance gain is a robust phenomenon. Based on a comparison of the dierent scenarios, we identify optimal interaction models that yield high performance gains at a low operational cost for the user. To support the proposed relevant feedback technique we developed a novel presentation paradigm that allows relevance to be treated as a continuous variable. Abstract.
1
Introduction
The eÆcient retrieval of images based on automatically extracted image data has become of great interest with a number of application areas ranging from remote sensing to medical diagnosis. Although the number of commercial and research systems addressing content-based image retrieval (CBIR) is growing rapidly, the area is still far from reaching maturity. Further progress is currently impeded by two fundamental problems. The rst problem arises from the diÆculty of inferring image meaning from primitive image features such as texture, colour and shape. It seems that a high-level representation of the image that speaks the same language as the user cannot be built from intrinsic image data alone but that a signi cant amount of world knowledge is essential. This problem which is commonly referred to as the semantic gap is quite distinct from, although F. Sebastiani (Ed.): ECIR 2003, LNCS 2633, pp. 363-376, 2003. c Springer-Verlag Berlin Heidelberg 2003
364
Daniel C. Heesch and Stefan R¨uger
sometimes confused with, the second problem which results from the semantic ambiguity inherent in images. Even if it were possible to derive image meaning from primitive features, and thus to bridge the semantic gap, the problem of polysemy would persist for it would still not be clear a priori which of the many high-level representations a user has in mind when querying a database with an example image. User-system interaction is a promising step towards tackling the above challenges for it can furnish the system with more information than is contained in the image itself. In the earlier days of CBIR, interaction was limited to the user specifying various system settings such as the particular features to be employed for retrieval. This type of interaction binds the user to a primitive level that becomes very obscure once more sophisticated image descriptors are used. While most of the commercial systems are still limited to this type of interaction, a number of ideas have been developed with the aim of eliciting additional information from the user. The mechanisms that have emerged include inter alia supervised learning prior to retrieval [9], interactive region segmentation [4], and interactive image database annotation [12]. The mechanism which holds most promise of improving the eÆciency of image retrieval systems is relevance feedback, which has long been applied successfully in the domain of traditional information retrieval [19]. In the context of CBIR, relevance feedback typically involves labelling a subset of retrieved images according to their perceived relevance. Unlike with text documents, looking at images and deciding whether they are relevant to a query constitutes a relatively small mental load. A number of dierent techniques have been used for relevance feedback. They broadly fall into one of two categories [1], namely (i) query point moving and (ii) weight update. The rst comprises all those methods that alter the query representation [11]. The idea is to nd not the best aggregation of image features but a representation of the query that renders it more similar to objects the user has marked out as relevant or, likewise, more dissimilar to non-relevant objects (e.g. [7, 14, 8]). Given a set of features, the similarity values derived for individual features are aggregated to yield an overall measure of similarity. Aggregation is often achieved by computing a weighted average of individual similarity values. Weight update techniques exploit relevance feedback to infer which features (and which representations thereof) best capture the user's perception of similarity. Examples include cluster analysis of the images using Kohonen's Learning Vector Quantization [23], non-parametric density estimation [11], the use of inverted les for feature selection [21], Bayesian Networks [3, 11], a statistical analysis of the feature distributions of relevant images [2], variance analysis [18] and analytic global optimisation [17]. In our system, we combine the idea of query point moving with weight update. Retrieved images are placed on the screen such that their distances to the centre represent their dissimilarities to the query image (see Figure 1). By moving an image closer to the centre or further away, the user indicates to what extent the image matches his information need. Because this match is given in terms of the chosen distance from the centre and is thus eectively continuous, this method of
Relevance Feedback for Content-Based Image Retrieval
365
relevance feedback is likely to provide a more accurate representation of the user's idea of similarity. With the similarity function being a simple convex weight combination of basic feature similarity functions, new weight coeÆcients can be computed in such a way that the user's perception of similarity with respect to the query is as close as possible to the similarities computed by the system. The similarity model chosen allows us to compute the new weights analytically using a least squared error approach.
Screen shot of the user interface. The query consists of two images of snowpeaked mountains, depicted at the top of the leftmost canvas. The display shows the 30 top-ranked images. The distance of a retrieved image from the centre is proportional to its dissimilarity to the query as computed by the system. Subject to this distance constraint, images are arranged such that overlap is minimized. Fig. 1.
Operationally, the relevance feedback approach of the present study is similar to [20], where the interface consists in a projection of the image objects in feature space onto the two dimensional plane using a distance metric derived from the user's interaction with the display. Instead of querying a database with an example, the user is invited to explore the database by changing the projection operator. This is done by marking out relevant and non-relevant images as well as by moving images closer to or further away from other images. In our system, rather than browsing the database, the user queries the database with an example image with the semantics of the interaction being kept deliberately simple.
366
Daniel C. Heesch and Stefan R¨uger
While in [20] the arrangement of images on the screen is such that distances inform about respective dissimilarities, we consider and display dissimilarity of an image with respect to a query. This also dierentiates our visualization from [15], which uses multi-dimensional scaling to arrange similar images close to one another without reference to a query. A challenge pertaining to relevance feedback techniques lies in striking a balance between simplicity and eÆciency. Ideally, feedback results in a signi cant gain in retrieval performance after a few iterations with a minimum of user operations. With this in mind, we have modelled dierent scenarios of relevance feedback that vary in the quantity and quality of the interaction. It turns out that the eÆciency of relevance feedback is a general outcome across a broad range of interaction scenarios and, more importantly, that it is possible to de ne conditions under which the system rewards even the most partial feedback. In summary, the contributions of this papers to CBIR are essentially twofold. Firstly, we describe a relevance feedback technique that is based on merging query expansion with analytical weight update. The novelty lies in the utilisation of continuous relevance feedback and the use of a squared error score function for weight update. To support this relevance feedback technique, we develop a simple yet highly expressive way of presenting the user with the retrieved images. Secondly, we model dierent scenarios of user-system interaction in order to formally quantify the improvement in retrieval performance that can be achieved through relevance feedback and to identify interaction models that are both userfriendly and eÆcient. The paper is divided into four sections. Section 2 describes the ve colour descriptors and introduces the relevance feedback technique along with the dierent interaction models used for evaluation. The results are presented in Section 3 and discussed in Section 4.
2 2.1
Methods Colour descriptors
Descriptors for colour representation were chosen with the new MPEG-7 standard in mind. Both the colour structure descriptor (de ned in the HMMD colour space) and the colour cluster descriptor (de ned in the YCbCr colour space) are part of the MPEG-7 speci cation. It was also desirable to keep the set of descriptors suÆciently distinct from one another with the aim of representing dierent aspects of the image colour. Choosing descriptors from dierent colour spaces and allowing for dierent spatial emphasis appeared to be sensible ways to reduce representational overlap and motivated the addition of the standard HSV colour histogram and a local variant thereof. We use a uniform quantization of the HSV colour space using 8 bins for each dimension. Two dierent descriptors are de ned. One is a global histogram consisting of 8 8 8 colour bins with loss of spatial HSV colour histogram
Relevance Feedback for Content-Based Image Retrieval
367
information, while the other consists of an array of ve local histograms each of size 8 8 8, with the rst four covering non-overlapping quarters of the image and the fth covering the central 25% of the image. This second descriptor allows central emphasis and partial preservation of local colour information. The new HMMD (Hue, Min, Max, Di) colour space, which is supported by MPEG-7, derives from the HSV and RGB spaces. The Hue component is as in the HSV space, and Max and Min denote the maximum and minimum among the R, G, and B values, respectively. The Di component is de ned as the dierence between Max and Min. Three components suÆce to uniquely locate a point in the colour space and thus the space is eectively three-dimensional. Following the MPEG-7 standard, we quantize the HMMD non-uniformly into 184 bins with the three dimensions being Hue, Sum and Di (Sum being de ned as (Max+Min)/2). For details about quantization see [10]. Two descriptors are de ned with respect to the HMMD colour space. The rst is a standard global histogram, the second, CSD or colour structure descriptor, is described in more detail below. HMMD colour histogram
This descriptor lends itself well for capturing local colour structure in an image. A 8 8 structuring window is used to slide over the image. Each of the 184 bins of the HMMD histogram contains the number of window positions for which there is at least one pixel falling into the bin under consideration. This descriptor is capable of discriminating between images that have the same global colour distribution but dierent local colour structures. Althou