NLP - Topic Modeling
What will be the output of
lda.transform(dtm) in the following code?from sklearn.decomposition import LatentDirichletAllocation from sklearn.feature_extraction.text import CountVectorizer docs = ["cat dog", "dog mouse", "cat mouse"] vectorizer = CountVectorizer() dtm = vectorizer.fit_transform(docs) lda = LatentDirichletAllocation(n_components=2, random_state=42) lda.fit(dtm) result = lda.transform(dtm) print(result.shape)
