Pretty and opinionated topic model visualization in Python.
Project description
topicwizard
Pretty and opinionated topic model visualization in Python.
New in version 0.2.5 🌟 🌟
- Compatiblity with Gensim topic models 💥
- Compatibility with BERTopic(experimental 🧪)
- Topic name inference 🧠
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
b) Words
c) Documents
Project details
Release history Release notifications | RSS feed
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.5.tar.gz
(65.5 kB
view details)
Built Distribution
File details
Details for the file topic_wizard-0.2.5.tar.gz
.
File metadata
- Download URL: topic_wizard-0.2.5.tar.gz
- Upload date:
- Size: 65.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.8 Linux/5.15.0-71-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f55f5201bbd528ae74eca6b227d149eb657f0b591c5013dbdf127b656aa17027 |
|
MD5 | a9ff01c19100a941c9513549453fba32 |
|
BLAKE2b-256 | 3a59a6e0b3232f387535e01c4f9d1e73c91ee85c624ef71d7b7446869263b8c6 |
File details
Details for the file topic_wizard-0.2.5-py3-none-any.whl
.
File metadata
- Download URL: topic_wizard-0.2.5-py3-none-any.whl
- Upload date:
- Size: 78.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.8 Linux/5.15.0-71-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f52bc1bd3439d015bca0fcc1c2a845621e564c13bbd91eaca940a06e8519f49c |
|
MD5 | 223625d937dad2d0ae72169f81e92c69 |
|
BLAKE2b-256 | 903d024fb4a1883d29a27ae3dc0aecb96969a4ffc30d5ee8a15049285ffcd5b2 |