Skip to main content

Pretty and opinionated topic model visualization in Python.

Project description

topicwizard


Pretty and opinionated topic model visualization in Python.

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

https://user-images.githubusercontent.com/13087737/234209888-0d20ede9-2ea1-4d6e-b69b-71b863287cc9.mp4

New in version 0.2.5 🌟 🌟

Features

  • Investigate complex relations between topics, words and documents
  • Highly interactive
  • Automatically infer topic names
  • Name topics manually
  • Pretty :art:
  • Intuitive :cow:
  • Clean API :candy:
  • Sklearn, Gensim and BERTopic compatible :nut_and_bolt:
  • Easy deployment :earth_africa:

Installation

Install from PyPI:

pip install topic-wizard

Usage (documentation)

Step 1:

Train a scikit-learn compatible topic model. (If you want to use non-scikit-learn topic models, check compatibility)

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

# Create topic pipeline
topic_pipeline = make_pipeline(
    CountVectorizer(),
    NMF(n_components=10),
)

# Then fit it on the given texts
topic_pipeline.fit(texts)

Step 2:

Visualize with topicwizard.

import topicwizard

# You can get automatically assigned topic labels, that you can change manually later
topic_names = topicwizard.infer_topic_names(pipeline=pipeline)

# Then you can visualize your results
topicwizard.visualize(pipeline=topic_pipeline, corpus=texts, topic_names=topic_names)

Step 3:

Investigate :eyes: .

a) Topics

topics screenshot

b) Words

words screenshot words screenshot

c) Documents

documents screenshot

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

topic_wizard-0.2.6.tar.gz (66.1 kB view hashes)

Uploaded Source

Built Distribution

topic_wizard-0.2.6-py3-none-any.whl (80.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page