title: Why use LSA before K-Means when doing text clustering
body: <p>I'm following this tutorial from Scikit learn on text clustering using K-Means:
  <a href="http://scikit-learn.org/stable/auto_examples/text/document_clustering.html" rel="noreferrer">http://scikit-learn.org/stable/auto_examples/text/document_clustering.html</a></p>
  
  <p>In the example, optionally LSA (using SVD) is used to perform dimensionality reduction.</p>
  
  <p>Why is this useful ? The number of dimensions (features) can already be controlled in the TF-IDF vectorizer using the "max_features" parameter.</p>
  
  <p>I understand that LSA (and LDA) are also topic modelling techniques. The difference with clustering is that documents belong to multiple topics, but only to one cluster. I do not understand why LSA would be used in the context of K-Means clustering.</p>
  
  <p>Example code:</p>
  
  <pre><code>from sklearn.feature_extraction.text import TfidfVectorizer
  from sklearn.cluster import KMeans
  
  documents = ["some text", "some other text", "more text"]
  
  tfidf_vectorizer = TfidfVectorizer(max_df=0.5, max_features=10000, min_df=2, stop_words='english', use_idf=True)
  X = tfidf_vectorizer.fit_transform(documents)
  
  svd = TruncatedSVD(1000)
  normalizer = Normalizer(copy=False)
  lsa = make_pipeline(svd, normalizer)
  Xnew = lsa.fit_transform(X)
  
  model = KMeans(n_clusters=10, init='k-means++', max_iter=100, n_init=1, verbose=False)
  model.fit(Xnew)
  </code></pre>