WordViz is a Python visualization library designed for exploring and visualizing word embeddings. Built on top of popular libraries such as matplotlib, plotly, and gensim, WordViz provides intuitive tools for analyzing embeddings through clustering, similarity exploration, and dimensionality reduction, all wrapped in interactive and customizable plots.
With WordViz, users can gain insights into the structure of their word embeddings, making it a valuable tool for researchers and practitioners in natural language processing.
This project was created as part of my Bachelor's Degree thesis in Statistics and Information Management with title (translated): "Word Embeddings in Practice: Designing a Library for Visualization and Operations"
version 0.6.0
Documentation: https://wordviz.readthedocs.io/
Built with:
Last Version Updates
Added
- Added HDBSCAN and Gaussian Mixture Model (GMM) clustering methods to the
plot_clustersfunction. - New
metricparameter inplot_clustersto select the distance metric for clustering, with default values based on the chosen method. - New
ReducedCacheclass to manage reduced embeddings for both 2D and 3D visualizations, allowing for more efficient caching, validation and retrieval of reduced embeddings. - Added
customparameter forred_methodto use embeddings reduced by external methods, with validation of shape and dimensionality.
Fixed
- Better error handling in the clustering functions.
- Removed automatic dimensionality reduction before clustering, reducing coupling between clustering and reduction.
Updated
compute_distancesnow can handle distances between a target embedding and a set of embeddings, reducing complexity from n^3 to n^2. A benchmark test was added to validate the performance improvement.map_colorshas now a fallback to a default color palette if the number of unique labels exceeds the available colors in the selected theme, ensuring that all labels are assigned a different color.plot_dendrogramnow supports coloring by cluster if an_clustersto visualize is provided. Together with the threshold line, now all the branches are colored according to the cluster they belong to.
See more about previous changes in CHANGELOG.md
Main Features
- Load and explore pretrained embeddings (e.g., GloVe, FastText)
- Select from a variety of available embeddings
- Visualize embeddings in 2D or 3D with flexible dimensionality reduction options
- Identify and plot the most similar words to a given token
- Visualize clusters of related words
- Interactive plots powered by
plotly - Support for many light and dark themes
Installation
Install the latest version from PyPI:
pip install wordviz
Notes: Python version compatibility
The only versions that support Python 3.13 are the latest releases starting from version 0.3.5.
If you still have problems with the installation, it is recommended to use Python 3.12.
uv init --python 3.12
This warning will be removed in the next versions of wordviz, as Python 3.13 will be fully supported.
Usage
You can load and manage embeddings though the EmbeddingLoader class, and then visualize them with the Visualizer (or Visualizer3D) class.
from wordviz import EmbeddingLoader, Visualizer
loader = EmbeddingLoader()
loader.load_from_file('path/to/your/embedding/file', 'word2vec')
vis = Visualizer(loader)
vis.plot_embeddings()
You can explore all functionalities through the example notebook provided in the docs/ folder:
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the MIT License.
Contacts
Elena Zen - My Portfolio Website - info.elenazen@gmail.com
Metadata
Release files for wordviz 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wordviz-0.6.0.tar.gz | 3.4 MB | Without provenance | Details for wordviz-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wordviz-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for wordviz-0.6.0-py3-none-any.whl |
Total release size: 3.4 MB
Release files / wordviz-0.6.0.tar.gz
| Download URL | wordviz-0.6.0.tar.gz |
|---|---|
| Size | 3.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c1a9661de3a57f156946fb1b064b52bc47f4b8d3f60ef1a75e2014275b3c89e
|
|
BLAKE2b-256 checksum How to use checksums |
2fcf266aa30f99924b5fbe5eed3b5430d6030cd619134f0edd0738bb176d33ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.10 Windows/11
|
Release files / wordviz-0.6.0-py3-none-any.whl
| Download URL | wordviz-0.6.0-py3-none-any.whl |
|---|---|
| Size | 28.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
194a8906fa628efd810e89a575cb769c575e00bb6dca10cd6cc097fe55bb0939
|
|
BLAKE2b-256 checksum How to use checksums |
9adde414373c079e5a5c72521a253e572716e93dd01d5e6f7bbc8a80882022fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.10 Windows/11
|
Security for wordviz 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.