title: How to get the highest tf-idf values of words for each class after using tfidf.vectorizer
body: <p>So I have a dataset with 3 label: Soccer, Music and Movies
  I used tfidf.vectorizer and then logistic regression to train my model, now I want to get a list of the 5 words that have the highest tfidf for each label.  (5 highest for soccer, 5 for Music ... )
  I couldn't find a way to get them.</p>
  <p>This is the code that I have</p>
  <pre><code>le = preprocessing.LabelEncoder()
  y = le.fit_transform(data[&quot;Label&quot;])
  tfidf = TfidfVectorizer(analyzer = 'word')
  X = tfidf.fit_transform(data[&quot;text&quot;])
  
  X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.1)
  lr = LogisticRegression()
  lr.fit(X_train, y_train)
  lr.score(X_test,y_test)
  </code></pre>
  <p>Thanks for the help.</p>