awacke1 commited on
Commit
b2cb6f5
·
1 Parent(s): bcf518d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sklearn.decomposition import NMF
2
+ from sklearn.feature_extraction.text import CountVectorizer
3
+ from sklearn.pipeline import Pipeline
4
+
5
+ bow_vectorizer = CountVectorizer()
6
+ nmf = NMF(n_components=10)
7
+ topic_pipeline = Pipeline(
8
+ [
9
+ ("bow", bow_vectorizer),
10
+ ("nmf", nmf),
11
+ ]
12
+ )
13
+ topic_pipeline.fit(texts)
14
+
15
+ import topicwizard
16
+
17
+ topicwizard.visualize(pipeline=topic_pipeline, corpus=texts)
18
+