title: How does TfidfVectorizer compute scores on test data
body: <p>In scikit-learn <code>TfidfVectorizer</code> allows us to fit over training data, and later use the same vectorizer to transform over our test data.
  The output of the transformation over the train data is a matrix that represents a tf-idf score for each word for a given document.</p>
  
  <p>However, how does the fitted vectorizer compute the score for new inputs? I have guessed that either:</p>
  
  <ol>
  <li>The score of a word in a new document computed by some aggregation of the scores of the same word over documents in the training set.</li>
  <li>The new document is 'added' to the existing corpus and new scores are calculated.</li>
  </ol>
  
  <p>I have tried deducing the operation from scikit-learn's source <a href="https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_extraction/text.py" rel="noreferrer">code</a> but could not quite figure it out. Is it one of the options I've previously mentioned or something else entirely?
  Please assist.</p>