title: Plot centroids in K-Means using TF-IDF
body: <p>I'm coding to group texts using KMeans and everything is working well, but I'm not able to plot the centroids together. I don't know how to use matplotlib, only seaborn along with the vector created by tdidf.</p>
  
  <p>MiniBatchKMeans has the variable <code>cluster_centers_</code>, but I'm not able to use it in the image.</p>
  
  <pre><code>from sklearn.feature_extraction.text import TfidfVectorizer
  df_abstracts = df_cleared['abstract'].tolist() # list with 33,000 lines of strings
  
  tfidf = TfidfVectorizer(max_features=2**12, ngram_range=(1,4), stop_words = 'english')
  vextorized = tfidf.fit_transform(df_abstracts)
  
  #For the plot generation, I do this dimensionality reduction from 33,000 to 2.
  from sklearn.decomposition import PCA
  pca = PCA(n_components = 9)
  X_pca = pca.fit_transform(vextorized.toarray())
  
  from sklearn.cluster import MiniBatchKMeans
  kmeans = MiniBatchKMeans(init='k-means++', n_clusters=4, max_iter=500, n_init=10, 
                           random_state=9)
  
  y_pred = kmeans.fit_predict(vextorized)
  np.unique(y_pred)
  
  palette = sns.color_palette('bright', len(set(y_pred)))
  sns.scatterplot(X_pca[:,0], X_pca[:, 1], hue=y_pred, legend='full', palette=palette)
  plt.title('Clustered')
  </code></pre>