NLP - Topic Modeling
Given the following code snippet, what will be the shape of the variable
topic_distribution?
from sklearn.decomposition import LatentDirichletAllocation from sklearn.feature_extraction.text import CountVectorizer docs = ["apple banana apple", "banana orange banana", "apple orange orange"] vectorizer = CountVectorizer() dtm = vectorizer.fit_transform(docs) lda = LatentDirichletAllocation(n_components=2, random_state=0) lda.fit(dtm) topic_distribution = lda.transform(dtm)
