/topic-wizard

Powerful topic model visualization in Python

Primary LanguagePythonMIT LicenseMIT

topicwizard


Pretty and opinionated topic model visualization in Python.

Open in Colab PyPI version pip downloads python version Code style: black

topicwizard-2023-02-19_19.25.33.mp4

Features

  • Investigate complex relations between topics, words and documents
  • Highly interactive
  • Name topics
  • Pretty 🎨
  • Intuitive 🐮
  • Clean API 🍬
  • Sklearn compatible 🔩
  • Easy deployment 🌍

Installation

Install from PyPI:

pip install topic-wizard

Step 1:

Train a scikit-learn compatible topic model.

from sklearn.decomposition import NMF
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.pipeline import Pipeline

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

Step 2:

Visualize with topicwizard.

import topicwizard

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

Step 3:

Investigate 👀 .

a) Topics

topics screenshot

b) Words

words screenshot words screenshot

c) Documents

documents screenshot