class_docstr: Create topic model widget.
docstr: Trains LDA Gensim model.
  
  Args:
      text_docs: A list of text documents in string format. These documents
          should generally be pre-processed
      min_topics: Starting number of topics to optimize for if number of topics
          not provided. Default is 2
      max_topics: Maximum number of topics to optimize for if number of topics
          not provided. Default is 10
      no_below: Minimum number of documents a word must appear in to be used in
      training. Default is 10
      no_above: Maximum proportion of documents a word may appear in to be used in
          training. Default is 0.2
  
  Returns:
      lda_model (Gensim LdaModel): Trained LDA topic model
code: def _compute_lda_model(
      self,
      text_docs: List[str],
      min_topics: int = 2,
      max_topics: int = 10,
      no_below: int = 10,
      no_above: float = 0.2,
  ):
      """Trains LDA Gensim model.
  
      Args:
          text_docs: A list of text documents in string format. These documents
              should generally be pre-processed
          min_topics: Starting number of topics to optimize for if number of topics
              not provided. Default is 2
          max_topics: Maximum number of topics to optimize for if number of topics
              not provided. Default is 10
          no_below: Minimum number of documents a word must appear in to be used in
          training. Default is 10
          no_above: Maximum proportion of documents a word may appear in to be used in
              training. Default is 0.2
  
      Returns:
          lda_model (Gensim LdaModel): Trained LDA topic model
      """
      tokenized_text_docs = [text_doc.split() for text_doc in text_docs]
      self._min_topics = min_topics
      self._max_topics = max_topics
      self._dictionary, self._corpus = filter_dictionary(
          tokenized_text_docs, no_below, no_above
      )
      lda_model_list = []
  
      if not self._model_kwargs:
          self._model_kwargs = {}
      self._model_kwargs = {
          **{
              "random_state": 1,
              "corpus": self._corpus,
              "num_topics": self._num_topics,
              "id2word": self._dictionary,
          },
          **self._model_kwargs,
      }
  
      with warnings.catch_warnings():
          warnings.filterwarnings("ignore", category=DeprecationWarning)
          if self._num_topics is None:
              self._coherence_values = []
              pbar = _compat["tqdm"].tqdm(  # type: ignore
                  range(self._min_topics, self._max_topics + 1),
                  desc="Fitting topic model",
              )
              for num in pbar:
                  self._model_kwargs.update({"num_topics": num})
                  lda_model = _compat[  # type: ignore
                      "gensim"
                  ].models.ldamodel.LdaModel(**self._model_kwargs)
                  coherence_model = _compat[  # type: ignore
                      "gensim"
                  ].models.coherencemodel.CoherenceModel(
                      model=lda_model,
                      texts=tokenized_text_docs,
                      dictionary=self._dictionary,
                      coherence="c_v",
                  )
                  score = coherence_model.get_coherence()
                  self._coherence_values.append(score)
                  lda_model_list.append(lda_model)
              max_coherence_index = self._coherence_values.index(
                  max(self._coherence_values)
              )
              self._num_topics = len(
                  lda_model_list[max_coherence_index].get_topics()
              )
              return lda_model_list[max_coherence_index]
          else:
              lda_model = _compat["gensim"].models.ldamodel.LdaModel(  # type: ignore
                  **self._model_kwargs
              )
              return lda_model
  
imports: import warnings
  from typing import List, Optional, Dict, Tuple, TYPE_CHECKING
  import pandas
  import numpy
  from sklearn.decomposition import TruncatedSVD, NMF
  import matplotlib.pyplot
  import seaborn
  from data_describe.config._config import get_option
  from data_describe.text.text_preprocessing import create_doc_term_matrix, create_tfidf_matrix, filter_dictionary
  from data_describe.backends import _get_viz_backend
  from data_describe.compat import _compat, _requires, _in_notebook
  from data_describe._widget import BaseWidget
label_desc: Use image node_id 15 for calling the TopicModelWidget obj's underlying member method code with example usage: obj._compute_lda_model(text_docs, min_topics, max_topics, no_below, no_above) and returns: lda_model_list, lda_model