0

What is n_components in sklearn.NMF?

nmf = NMF(n_components=2, init='random', random_state=0)
nmf.fit(V)
desertnaut
  • 57,590
  • 26
  • 140
  • 166
  • Read [wiki](https://en.wikipedia.org/wiki/Non-negative_matrix_factorization) and replace *features* with *components*, – sascha Nov 12 '20 at 21:04

1 Answers1

0

Here's one example of how I've seen this parameter used:

When used for topic modeling in natural language processing, n_components can be used as the number of topics to print out.

For example, if I fit the NMF object on a TF-IDF vectorizer and set n_components = 10, I can use it to show me 10 different collections of words that I can interpret as my topics.

Nate
  • 466
  • 5
  • 23