From the course: Natural Language Processing in Python

Unlock this course with a free trial

Join today to access over 26,400 courses taught by industry experts.

Demo: Fit an NMF model

Demo: Fit an NMF model

“

For this demo, our goal is going to be to use non-negative matrix factorization to find the main themes in product reviews. Alright, let's start our new section here and call it Topic Modeling. Let's also restate our goal one more time so we can reference it later on. Now the first thing we need to input into our Topic Modeling model is a vectorized version of our text. So far throughout this section, we've created a count vectorizer as well as a TF-IDF vectorizer. And for NMF, TF-IDF vectorizers tend to work better because they do a better job of emphasizing important words. And we want to see those important words to come up with our topics. So that's the one I'm going to copy down here. So I'm going to take this from our text classification section, paste it down here, and I'm going to change some of these variable names so we don't overwrite our variables from earlier. Alright, let me run that. And you can see we have our document term matrix. But I'm also going to modify some of…

Contents