<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>How well do we know Bernoulli?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Giorgio Maria Di Nunzio</string-name>
          <email>dinunzio@dei.unipd.it</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alessandro Sordoni</string-name>
          <email>sordonia@iro.umontreal.ca</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Dept. of Computer Science and Operations Research</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Dept. of Information Engineering</institution>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>University of Montreal</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>Nave Bayes probabilistic models are widely used in text categorization because of their e cient model training and good empirical results. Bayesian classi ers face a common issue called data sparsity problem which makes an adequate estimation of probabilities a di cult task. Therefore, smoothing techniques are needed in order to adjust the maximum likelihood estimators. In this preliminary paper we make use of a visualization technique to further investigate the expressiveness of the well known Bernoulli Nave Bayes classi er. Various smoothing methods are tested by means of a visual analysis which makes the estimation of optimal parameters straightforward. Experimental results demonstrated that: (1) visual analysis is a valuable tool for understanding the behaviour of smoothing methods and their limits (2) the Bernoulli multivariate model performance can increase signi cantly with a suitable setting of smoothing parameters.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        A large number of studies have shown that Support Vector Machines (SVM) can
outperform other approaches in many categorization applications [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], but Nave
Bayes (NB) is still widely used in practice mostly likely due to its tradeo
between very e cient model training and good empirical results. NB classi ers are
sensitive to the data sparsity problem which is particularly evident when the size
of training data is small. Due to data sparseness, the maximum likelihood
estimation of the probability of unseen features (terms in the case of text classi cation)
tend to be zero. To prevent this undesirable behaviour, smoothing techniques are
a possible solution. Smoothing a probability actually means assigning a non-zero
probability to the features that describe the object we want to classify. Several
smoothing methods have been proposed [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]: additive, or Laplacian smoothing,
Jelinek-Mercer, Dirichlet, absolute discount and two-stage smoothing. Some of
these approaches operate an interpolation with a background collection model,
some others simply add extra counts to the observed frequency of each feature.
      </p>
      <p>
        In this preliminary work, we are interested in studying smoothing methods
for the multi-variate Bernoulli classi er. Most research so far has shown that the
multinomial Nave Bayes generally outperforms the Bernoulli classi er both in
text categorization [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] and information retrieval [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. From a probabilistic point
of view, the latter model makes a weaker independence assumption about word
occurrences at the price of not being able to model multiple word occurrences.
Even if there has been some empirical evidence that multinomial outperforms
multi-variate Bernoulli, the need for a more systematic comparison between these
model is needed [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. Therefore, we put forward the following research question:
how far can we improve the performance of the Bernoulli classi er by setting
optimal Beta prior smoothing parameters? The objective of our experimental
evaluation (inspired by the work of [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]) is to compare three well-established
smoothing methods against a manual optimization of the Beta parameters by
means of the two-dimensional visual approach [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Bayesian and Jelinek-Mercer Smoothing</title>
      <p>
        Given a set C of categories, the bayesian approach to categorization consists
by estimating P(djci) and calculating the posterior P(cijd) via Bayes rule3. The
multi-variate Bernoulli model represents a document as a binary vector over the
space of terms in which each dimension indicates whether the term occurs in
the document. The occurrence of each term is governed by a Bernoulli
distribution. Learning the parameters of this model corresponds to estimating
classconditional Bernoulli parameters tkjci P(tkjci; ), where tk is a term of the
vocabulary. The maximum likelihood (ML) estimators of this parameters are of
the form:
^tMkjLci = k;i (1)
mi
where k;i is the number of documents belonging to ci in which term tk appears
and mi is the total number of documents in ci. The ML is zero for terms that
never occur in documents in ci. To prevent this undesirable behavior, the choice
of a suitable prior to smooth probabilities is a possible solution. The conjugate
prior of the Bernoulli distribution is the beta-distribution beta( ; ; ), where
and are hyper-parameters. Assuming this prior, the smoothed estimate of the
probability of a term tk given a category ci is given by the posterior mean [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]:
Setting = 1, = 1 is called Laplace smoothing. Using the Jelinek-Mercer (JM)
method, this parameter is computed by interpolating the maximum likelihood
estimate with a collection language model tkjC P(tkjC; ):
^B
tkjci =
      </p>
      <p>k;i +
mi +
+</p>
      <p>;
^tMkjLC =
k ;
m
(2)
(3)
(4)
where k is the number of documents in which term tk appears and m the
number of documents in the collection. Using as the interpolation parameter,
the Jelinek-Mercer can be written as:
^JM
tkjci = (1
)^tMkjLci +
^tMkjLC ;
3 P(cijd) = P(djci)P(ci)=P(d), where ci 2 C and d is a document.
with 0 1. For = 0, we obtain the maximum likelihood estimator,
while for = 1 we completely rely on the collection language model. Indeed,
opposite to Beta smoothing, the Jelinek-Mercer smooths each parameter ^ML
tkjci
by a di erent amount depending on the probability of the term with respect to
the entire collection. Nevertheless, looking closer at Eq. (2), we can write:
^B
tkjci = mi +
mi
+
k;i +
mi</p>
      <p>+
mi +
+
+
;
(5)
which means that the probability of a term is obtained by interpolating the
maximum likelihood estimator with the prior mean =( + ). Setting =
k=m k, such that =( + ) = ( k=m), we recover the JM except that the
interpolation slope is atter: we must allow to vary through a bigger interval
in order to recover JM estimations4. In our experiments, and for the purpose of
visual analysis, we limit ourselves to use the same and for each smoothed
estimate of term tk. As we will see in the next sections, this will represent a
lack of expressiveness of the Beta prior smoothing and opens a path for the
continuation of this work.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Visualization of Priors' E ects</title>
      <p>
        In this work, we make use of a visual analysis tool, namely the two-dimensional
visualization of probabilistic models [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], for understanding the behaviour of
smoothing methods and their limits. In the two-dimensional visualization, two
coordinates are calculated for each document d and for each category ci. These
two coordinates correspond to the two posterior probabilities P(cijd; ^) and
P(cijd; ^) governed by the estimated parameter ^. We compare these two
probabilities to decide whether the document belongs to ci or not. By applying Bayes
rule and taking the logs in order to avoid arithmetical anomalies (products of
very small numbers tend to zero very quickly) we obtain:
log P(djci; ^ci ) + log P(ci; ^) &gt; log P(djci; ^ci ) + log P(ci; ^)
(6)
Given a category ci, each coordinate of a document is the sum of two addends:
a variable component which depends on the terms that appear in the document,
and a constant component related to probability of the category itself. The
probability P(djci; ^ci ) is in turn estimated by combining the estimates ^tkjci for
each term in the document. We can therefore determine and change the position
of the document in the two-dimensional space by adjusting the hyper-parameters
and .
      </p>
      <p>
        An example of this visualization is shown in Figure 1. The decision boundary
is represented by the green line: below the line, the document is assigned to the
category ci, above the line, the document is assigned to ci. The in uence of a
change in the values and is visualized with an animation of the documents
in the space.
4 A similar derivation is done in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] with a Dirichlet prior.
      </p>
      <p>(a) Display window.</p>
      <p>(b) Properties window
(c) Display window.</p>
      <p>
        (d) Properties window
We tested Jelinek-Mercer (je) against three di erent parametrization of the
beta prior: (la) a uniform (Laplace smoothing) beta prior, beta( ; 1; 1); (ey)
a beta distribution was set as found by Eyheramendi et al. [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], beta( ; 0:1; 0:3);
(vi) a beta distribution with optimal parameters and , beta( ; ; ).
We found and ; for each category by optimizing the F1-score (F1) on
the training set: the Jelinek-Mercer was selected by iterative searching over
the interval [0; 1]; for ; , we exploited the document visualization technique.
As overall quality measures, we used standard ATC micro- and macro-averged
Recall, Precision, and F1 measures [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>
        We selected three of the most widely used collections in literature. We tested
Reuters-21578 using the 10 most frequent categories following the \ModApte"
split (9,603 training and 3,299 test documents); 20 Newsgroups, 20 categories
with 18,846 stories, divided in 60%-40% training/test; Ohsumed, 6,286
training and 7,643 for test documents classi ed into 23 Medical Subject Headings
(MeSH). These subsets of the collections were chosen accordingly to most of the
literature in Automated Text Categorization (ATC) [
        <xref ref-type="bibr" rid="ref1 ref10 ref3">3, 1, 10</xref>
        ]. Default English
stopwords were removed and all letters have been converted to lowercase. The
two-dimensional interface was implemented in Java using Java Swing
technologies.
      </p>
      <p>
        The baseline obtained by (la) performed statistically worse than any other
approach upon the considered datasets: Church and Gale presented strong
arguments against the e ectiveness of add-one smoothing for language data in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
As we started the visual search from the parameters set by (ey), (vi) cannot
be worse than (ey). Nevertheless, since the parameters found with (vi) were
optimized by monitoring the F1 measure, it may happen that with a higher F1,
either the value of Recall or Precision are less than (ey). The averaged results
on the three datasets are reported in Table 1.
      </p>
      <p>Visual parameter optimization signi cantly improves categorization
performances over the three methods in Reuters. Fig. 1 illustrates how visual
optimization operates for the category \wheat". Applying the same amount of
smoothing to each term reveals to be e ective in this collection: almost all
categories are well represented and using the collection language model as an
evidence source for smoothing is not of much interest. Nevertheless, by taking
a closer look to performances on each category (not reported in this paper),
we found indeed that JM performs best on di cult categories (ship, wheat).
This tendency is clearly emerging on the other two collections. On 20
Newsgroups, visual optimization greatly increases Precision performances over static
(ey) parameters. Despite this fact, Beta prior smoothing with optimal
parameters reaches the same expressiveness as Jelinek-Mercer (JM) smoothing. On the
Ohsumed collection, visual optimization con rms that Beta prior smoothing is
lacking expressiveness for this dataset. Computing the mean and the variance
of the optimal parameter found for each category we obtained = 0:82,
2 = 0:02 thus con rming that taking evidence at a collection level is relevant
when dealing with noisy documents and semantically overlapping categories.
5</p>
    </sec>
    <sec id="sec-4">
      <title>Conclusions</title>
      <p>In this preliminary work, we have studied the e ects of smoothing methods
for the NB classi er by means of visualization analysis. In the initial phase
of this research, we have focused our analysis on the simplest NB model: the
multi-variate Bernoulli model. We put forward the following research question:
how far can we improve the performance of the Bernoulli classi er by setting
optimal Beta prior smoothing parameters? The objective of our experimental
evaluation was to compare three well-established smoothing methods against a
manual optimization of the Beta parameters (which govern the smoothing of the
probabilities) by means of the two-dimensional visual approach.</p>
      <p>Experiments have shown that it is possible to nd hyper-parameters of the
Beta prior that improve the classi cation signi cantly. However, in this rst set
of experiments we limited ourselves to the use the same and for each term. A
natural continuation of this research will be to nd an automatic way to estimate
di erent and parameters for each term and to understand if this actually
improves performance measures. This problem will consist in characterizing the
rst and second order moment of each Beta prior distribution based on some
relevant empirical evidence of term occurrence in the collection.</p>
      <p>
        This initial set of experiments will lead to the second phase of the study: the
analysis of the smoothing methods for the multinomial NB model. Most research
so far has shown that the multinomial Nave Bayes generally outperforms the
Bernoulli classi er both in text categorization and information retrieval. From
a probabilistic point of view, the Bernoulli model makes a weaker independence
assumption on word occurences. This is why we believe that a more systematic
comparison between these model is still needed [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. Another thread of research
will be to apply the visualization analysis to more complex NB models, such
as the Chain Augmented NB models (also known as CAN models) which allow
a straightforward the application of sophisticated smoothing techniques from
statistical language modeling [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <p>Acknowledgments. This work has been partially supported by the
QONTEXT project under grant agreement N. 247590 (FP7/2007-2013).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Sebastiani</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          <article-title>: Machine learning in automated text categorization</article-title>
          .
          <source>ACM Comput. Surv</source>
          .
          <volume>34</volume>
          (
          <year>2002</year>
          )
          <volume>1</volume>
          {
          <fpage>47</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Zhai</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>La</surname>
            <given-names>erty</given-names>
          </string-name>
          , J.D.:
          <article-title>A study of smoothing methods for language models applied to information retrieval</article-title>
          .
          <source>ACM Trans. Inf. Syst</source>
          .
          <volume>22</volume>
          (
          <year>2004</year>
          )
          <volume>179</volume>
          {
          <fpage>214</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>McCallum</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nigam</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          :
          <article-title>A comparison of event models for naive bayes text classi cation</article-title>
          .
          <source>In: AAAI-98 workshop on learning for text categorization</source>
          . Volume
          <volume>752</volume>
          . (
          <year>1998</year>
          )
          <volume>41</volume>
          {
          <fpage>48</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Metzler</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lavrenko</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Croft</surname>
          </string-name>
          , W.B.:
          <article-title>Formal multiple-bernoulli models for language modeling</article-title>
          .
          <source>In: Proceedings of the 27th annual international ACM SIGIR conference on Research and development in information retrieval.</source>
          (
          <year>2004</year>
          )
          <volume>540</volume>
          {
          <fpage>541</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Zhai</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Statistical language models for information retrieval</article-title>
          .
          <source>Synthesis Lectures on Human Language Technologies</source>
          <volume>1</volume>
          (
          <year>2008</year>
          )
          <volume>1</volume>
          {
          <fpage>141</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>Di</given-names>
            <surname>Nunzio</surname>
          </string-name>
          , G.:
          <article-title>Using scatterplots to understand and improve probabilistic models for text categorization and retrieval</article-title>
          .
          <source>Int. J. Approx. Reasoning</source>
          <volume>50</volume>
          (
          <year>2009</year>
          )
          <volume>945</volume>
          {
          <fpage>956</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Gelman</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Carlin</surname>
            ,
            <given-names>J.B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stern</surname>
            ,
            <given-names>H.S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rubin</surname>
            ,
            <given-names>D.B.</given-names>
          </string-name>
          :
          <article-title>Bayesian Data Analysis</article-title>
          ,
          <string-name>
            <surname>Second Edition</surname>
          </string-name>
          (Chapman &amp; Hall/CRC Texts in Statistical Science).
          <article-title>2 edn. Chapman and Hall/CRC (</article-title>
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Smucker</surname>
            ,
            <given-names>M.D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Allan</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>An investigation of dirichlet prior smoothing's performance advantage</article-title>
          .
          <source>Technical Report Technical Report IR-391</source>
          , The University of Massachusetts,
          <article-title>The Center for Intelligent Information Retrieval (</article-title>
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Eyheramendy</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lewis</surname>
            ,
            <given-names>D.D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Madigan</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>On the Naive Bayes Model for Text Categorization</article-title>
          . In Bishop,
          <string-name>
            <given-names>C.</given-names>
            ,
            <surname>Frey</surname>
          </string-name>
          , B., eds.
          <source>: Proceedings of the Ninth International Workshop on Arti cial Intelligence and Statistics</source>
          . (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Peng</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schuurmans</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wang</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Augmenting naive bayes classi ers with statistical language models</article-title>
          .
          <source>Inf. Retr</source>
          .
          <volume>7</volume>
          (
          <year>2004</year>
          )
          <volume>317</volume>
          {
          <fpage>345</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Gale</surname>
            ,
            <given-names>W.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Church</surname>
            ,
            <given-names>K.W.</given-names>
          </string-name>
          :
          <article-title>What's wrong with adding one? In: Corpus-Based Research into Language</article-title>
          . Rodolpi. (
          <year>1994</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>