title: TF-IDF and Rocchio classification in Introduction to Information Retrieval
body: <p>I'm looking at table 14.1 from <a href="http://nlp.stanford.edu/IR-book/pdf/14vcat.pdf" rel="nofollow noreferrer">Vector Space Classification</a> (chapter at link) in Introduction to Information Retrieval which Example 14.1 says "shows the tf-idf vector representations of the five documents in Table 13.1 using the formula <code>(1 + log tf) * log(4/df)</code> if <code>tf &gt; 0</code>.  Yet, when I look at Table 14.1, it does not appear that this TF-IDF formula is applied to the document vectors.  </p>
  
  <p>The documents from table 13.1 are:</p>
  
  <pre><code>1: Chinese Beijing Chinese
  2: Chinese Chinese Shanghai
  3: Chinese Macao
  4: Tokyo Japan Chinese
  </code></pre>
  
  <p>and the term weights for the vectors in Table 14.1 are:</p>
  
  <pre><code>vector Chinese Japan Tokyo Macao Beijing Shanghai
  d1     0       0     0     0     1.0     0
  d2     0       0     0     0     0       1.0
  d3     0       0     0     1.0   0       0
  d4     0       0.71  0.71  0     0       0
  </code></pre>
  
  <p>If I apply the TF-IDF formula to the <code>Japan</code> dimension of <code>d4</code>, I get:</p>
  
  <pre><code>TF: 1 (term appears once in document 4)
  DF: log(4 / 1) (term is present in only document 4)
  TF-IDF Weight is thus: log(4) ~ .60
  </code></pre>
  
  <p>Why does my calculation outcome different from what is included in the text?</p>