TopicTuner — Tune BERTopic HDBSCAN Models
To install from PyPi :
pip install topicmodeltuner
The Problem
Out of the box, BERTopic relies upon HDBSCAN to cluster topics. Two of the most important HDBSCAN parameters, min_cluster_size and sample_size will almost always have a dramatic effect on cluster formation. They dictate the number of clusters created including the -1 or uncategorized cluster. While with some datasets a large number of uncategorized documents may be the right clustering, in practice BERTopic will essentially discard a large percentage of "good" documents and not use them for cluster formation and topic formation.
HDBSCAN is quite sensitive to the values of these two parameters relative to the text being clustered. This means that when using the BERTopic default value of min_topic_size=10 (which is assigned to HDBSCAN's min_cluster_size) the default parameters will more often than not result in an unmanageable number of topics; as well as a sub-optimal number of uncategorized documents. Additionally, documents assigned to the -1 category will not be used to determine topic vocabularly results.
The Solution
TopicTuner provides a TopicModelTuner class — a convenience wrapper for BERTopic Models that efficiently manages the process of discovering optimized min_cluster_size and sample_size parameters, providing:
- Random and grid search functionality to quickly discover optimized parameters for a given BERTopic model.
- An internal datastore that records all searches for a given model, making parameter selection fast and easy.
- Visualizations to assist in parameter tuning and selection.
- Two way Import/Export functionality so that you can start from scratch, or with an existing BERTopic model and export a BERTopic model with optimized parameters at the end of your session.
- Save and Load for persistance.
To get you started this release includes both a demo notebook and API documentation
Metadata
Release files for topicmodeltuner 0.3.4
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 |
|---|---|---|---|---|
| topicmodeltuner-0.3.4.tar.gz | 24.3 kB | Without provenance | Details for topicmodeltuner-0.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| topicmodeltuner-0.3.4-py3-none-any.whl | Python 3 | none | any | Details for topicmodeltuner-0.3.4-py3-none-any.whl |
Total release size: 51.3 kB
Release files / topicmodeltuner-0.3.4.tar.gz
| Download URL | topicmodeltuner-0.3.4.tar.gz |
|---|---|
| Size | 24.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ce603a4efd30d2773534093b23a43c893ce4c83d453ddf87a1b5a4b3b1e6de6
|
|
BLAKE2b-256 checksum How to use checksums |
0c405b5bafb7458cef6294e3ae287e2ef67b335690c4fc7d305da771c1eb9a00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.15
|
Release files / topicmodeltuner-0.3.4-py3-none-any.whl
| Download URL | topicmodeltuner-0.3.4-py3-none-any.whl |
|---|---|
| Size | 27.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ee2ecb646e6f75f4c0ba078a029dd40e8bca3c5c817e5ce48308cbcaa52f8cd
|
|
BLAKE2b-256 checksum How to use checksums |
891e73e53e1847f07ff7afa7183bf1b8d6af4c48bd844a1b682f7330a2c9716a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.15
|
Security for topicmodeltuner 0.3.4
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.