lightopic.lightbertopic ======================= .. py:module:: lightopic.lightbertopic .. autoapi-nested-parse:: A simple child class of bertopic.BERTopic to enable using Lightopic. The only addition to the base class is a method to `save_lightopic`: this will serialise a model in a format suitable for instantiating a Lightopic model with Lightopic.load. As part of this process it will train a reduced UMAP model, suitable for projecting down to two dimensions for plotting. Typical usage example: ```python from lightopic import LightBERTopic from sklearn.datasets import fetch_20newsgroups docs = fetch_20newsgroups(subset="all")["data"] topic_model = LightBERTopic() topics, probabilities = topic_model.fit_transform(docs) topic_model.save_lightopic("lightopic_model") ``` Classes ------- .. autoapisummary:: lightopic.lightbertopic.LightBERTopic Module Contents --------------- .. py:class:: LightBERTopic Bases: :py:obj:`bertopic.BERTopic` Child class of bertopic.BERTopic to enable serialising models in the Lightopic format. All methods from bertopic.BERTopic are left unchanged; we add only the save_lightopic method. .. py:method:: save_lightopic(output_path: str) -> None Serialise a trained model for use as a Lightopic model. :param output_path: Directory path to serialise the model, will be created if it does not exist. :type output_path: str