简体   繁体   中英

What is n_components in NMF(Non-Negative Matrix Factorization) in sklearn?

What is n_components in sklearn.NMF ?

nmf = NMF(n_components=2, init='random', random_state=0)
nmf.fit(V)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM