tommy.controller.model_parameters_controller

Classes

class tommy.controller.model_parameters_controller.ModelParametersController[source]

Bases: object

Controls the access to and changes to the parameters to be used in topic modelling

__init__() None[source]

Initialize the model-parameters-controller and its publisher

property algorithm_changed_event: EventHandler[None]

The event that is triggered when the algorithm is changed

get_bert_max_features() int | None[source]

Return the maximum number of terms in the BERTopic matrix

get_bert_min_df() float | None[source]

Return the minimum frequency of a term in BERTopic

get_model_alpha() float[source]

Return the alpha parameter for the topic modelling

get_model_alpha_beta_custom_enabled() bool[source]

Return whether the alpha and beta parameters should be set manually

get_model_beta() float[source]

Return the beta parameter for the topic modelling

get_model_n_topics() int[source]

Return the number of topics the topic modelling will find

get_model_type() ModelType[source]

Return the type of topic modelling algorithm to be run

get_model_word_amount() int[source]

Return the amount of words to be displayed per topic

property n_topics_changed_event: EventHandler[int]

The event that is triggered when the number of topics is changed

on_model_swap() None[source]

Notify the frontend that the model parameters model has changed :return: None

property params_model_changed_event: EventHandler[None]

This event gets triggered when the model parameters model is changed for example due to changing configs :return: The event

set_bert_max_features(max_features: int | None) None[source]

Set the value of the minimum frequency of a term in the BERTopic algorithm :param max_features: new value of min_df

set_bert_min_df(min_df: float | None) None[source]

Set the value of the minimum frequency of a term in the BERTopic algorithm :param min_df: new value of min_df

set_model_alpha(alpha: float) None[source]

Set the alpha parameter for the topic modelling

set_model_alpha_beta_custom_enabled(enabled: bool) None[source]

Set whether the alpha and beta parameters should be set manually :param enabled: whether the parameters should be set manually

set_model_beta(beta: float) None[source]

Set the beta parameter for the topic modelling

set_model_n_topics(n_topics: int) None[source]

Set the number of topics to use in the topic modelling :param n_topics: the desired number of topics

set_model_refs(model_parameters_model: ModelParametersModel) None[source]

Set the reference to the model-parameters-model

set_model_type(model_type: ModelType) None[source]

Set the type of topic modelling algorithm to be run :param model_type: the algorithm type to be run

set_model_word_amount(word_amount: int) None[source]

Set the amount of words to be displayed per topic :param word_amount: the amount of words to be displayed per topic :return: None