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.6.tar.gz
(66.1 kB
view details)
Built Distribution
File details
Details for the file topic_wizard-0.2.6.tar.gz
.
File metadata
- Download URL: topic_wizard-0.2.6.tar.gz
- Upload date:
- Size: 66.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.8 Linux/5.15.0-75-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23cc82fb6f514838bda851a4034a2e2291e2ea8cbe91b8b0dbdbb579da241be9 |
|
MD5 | f96332e22244574605e8b2d82858afd3 |
|
BLAKE2b-256 | a99b932293d5896545aa62d9344813bf2b6f4c1b58e3e8543d1239b47452e0a0 |
File details
Details for the file topic_wizard-0.2.6-py3-none-any.whl
.
File metadata
- Download URL: topic_wizard-0.2.6-py3-none-any.whl
- Upload date:
- Size: 80.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.8 Linux/5.15.0-75-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1354448cf613352bdfbf2c3220db4f552f62e6fe3e61b250c04a563eda3acd7 |
|
MD5 | 171d31e2d1cc8c03fb1408ec1032c5f5 |
|
BLAKE2b-256 | ac4ff4fed60f86c0a9a69fa889c457251e8f49f59df498bc9261b1003c8755f5 |