class_docstr: Create topic model widget.
docstr: Trains NMF scikit-learn model.
  
  Args:
      text_docs: A list of text documents in string format. These documents should
          generally be pre-processed
      tfidf: If True, model created using TF-IDF matrix. Otherwise, document-term
          matrix with wordcounts is used. Default is True.
  
  Returns:
      lsa_model (scikit-learn NMF model): Trained NMF topic model
code: def _compute_nmf_model(
      self, text_docs: List[str], tfidf: bool = True
  ):
      """Trains NMF scikit-learn model.
  
      Args:
          text_docs: A list of text documents in string format. These documents should
              generally be pre-processed
          tfidf: If True, model created using TF-IDF matrix. Otherwise, document-term
              matrix with wordcounts is used. Default is True.
  
      Returns:
          lsa_model (scikit-learn NMF model): Trained NMF topic model
      """
      if not self._num_topics:
          self._num_topics = 3
  
      if tfidf:
          self._matrix = create_tfidf_matrix(text_docs)
      else:
          self._matrix = create_doc_term_matrix(text_docs)
  
      if not self._model_kwargs:
          self._model_kwargs = {}
      self._model_kwargs.update({"n_components": self._num_topics})
  
      nmf_model = NMF(**self._model_kwargs)
      nmf_model.fit(self._matrix)
      return nmf_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 16 for calling the TopicModelWidget obj's underlying member method code with example usage: obj._compute_nmf_model(text_docs, tfidf) and returns: nmf_model