3
$\begingroup$

I am trying to implement a system for automatic document categorization, where each document of a corpus belongs to some class. I define the following contingency table for every class C and every word W:

$\begin{array}{c|cc} & W & \bar{W}\\ \hline C & \frac{nb\_docs(C,W)}{nb\_docs} & \frac{nb\_docs(C,\bar{W})}{nb\_docs}\\ \bar{C} & \frac{nb\_docs(\bar{C},W)}{nb\_docs} & \frac{nb\_docs(\bar{C},\bar{W})}{nb\_docs}\\ \end{array}$

where $nb\_docs$ is the total number of documents in the corpus, $nb\_docs(C,W)$ is the number of documents of class C that contains the word $W$, $nb\_docs(C,\bar{W})$ is the number of documents of class C that does NOT contain $W$, and so on.

I need to smooth this table to avoid zero values, ideally something simple similarly to Laplace smoothing (i.e., add-one smoothing) while keeping well-defined probabilities/normalized frequencies.

I can't figure out how to do that... Any idea?

Edit: My goal is to extract the most "important" terms to reduce the dimensionality of the space during classification. There are many functions to identify those important terms, some being undefined with zero probabilities. Undefined values could be simply ignored but there should be some way to deal with this :)

$\endgroup$
  • $\begingroup$ Why do you need to avoid zeros? $\endgroup$ – Glen_b -Reinstate Monica Sep 17 '12 at 23:21
  • $\begingroup$ Question edited :) $\endgroup$ – DevelBD Sep 18 '12 at 10:15
4
$\begingroup$

You might see Jeff Simonoff's 1996 book "Smoothing Methods in Statistics" (Springer) that devotes a chapter to this subject:

In effect, one 'shrinks' the empirical cell probabilities to the 'overall' or 'uniform' cell probabilities using kernel weighting for discrete outcomes. This is designed exactly for the sparse settings you envision. To avoid the zeros you only require a very minimal amount of smoothing by the way.

Hope this helps!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.