File size: 398 Bytes
b2cb6f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from sklearn.decomposition import NMF
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.pipeline import Pipeline

bow_vectorizer = CountVectorizer()
nmf = NMF(n_components=10)
topic_pipeline = Pipeline(
   [
      ("bow", bow_vectorizer),
      ("nmf", nmf),
   ]
)
topic_pipeline.fit(texts)

import topicwizard

topicwizard.visualize(pipeline=topic_pipeline, corpus=texts)