class_docstr: Online Non-Negative Matrix Factorization.
  
  `Renbo Zhao et al :"Online Nonnegative Matrix Factorization with Outliers" <https://arxiv.org/abs/1604.02634>`_
class_docstr_tok: ["Online","Non-Negative","Matrix","Factorization",".","`","Renbo","Zhao","et","al",":","''","Online","Nonnegative","Matrix","Factorization","with","Outliers","''","<","https",":","\/\/arxiv.org\/abs\/1604.02634",">","`","_"]
docstr: Get the topics sorted by coherence.
  
  Parameters
  ----------
  corpus : iterable of list of (int, float) or `csc_matrix` with the shape (n_tokens, n_documents)
      Training corpus.
      Can be either iterable of documents, which are lists of `(word_id, word_count)`,
      or a sparse csc matrix of BOWs for each document.
      If not specified, the model is left uninitialized (presumably, to be trained later with `self.train()`).
  texts : list of list of str, optional
      Tokenized texts, needed for coherence models that use sliding window based (i.e. coherence=`c_something`)
      probability estimator .
  dictionary : {dict of (int, str), :class:`gensim.corpora.dictionary.Dictionary`}, optional
      Dictionary mapping of id word to create corpus.
      If `model.id2word` is present, this is not needed. If both are provided, passed `dictionary` will be used.
  window_size : int, optional
      Is the size of the window to be used for coherence measures using boolean sliding window as their
      probability estimator. For 'u_mass' this doesn't matter.
      If None - the default window sizes are used which are: 'c_v' - 110, 'c_uci' - 10, 'c_npmi' - 10.
  coherence : {'u_mass', 'c_v', 'c_uci', 'c_npmi'}, optional
      Coherence measure to be used.
      Fastest method - 'u_mass', 'c_uci' also known as `c_pmi`.
      For 'u_mass' corpus should be provided, if texts is provided, it will be converted to corpus
      using the dictionary. For 'c_v', 'c_uci' and 'c_npmi' `texts` should be provided (`corpus` isn't needed)
  topn : int, optional
      Integer corresponding to the number of top words to be extracted from each topic.
  processes : int, optional
      Number of processes to use for probability estimation phase, any value less than 1 will be interpreted as
      num_cpus - 1.
  
  Returns
  -------
  list of (list of (int, str), float)
      Each element in the list is a pair of a topic representation and its coherence score. Topic representations
      are distributions of words, represented as a list of pairs of word IDs and their probabilities.
docstr_tok: ["Get","the","topics","sorted","by","coherence",".","Parameters","--","--","--","--","--","corpus",":","iterable","of","list","of","(","int",",","float",")","or","`","csc_matrix","`","with","the","shape","(","n_tokens",",","n_documents",")","Training","corpus",".","Can","be","either","iterable","of","documents",",","which","are","lists","of","`","(","word_id",",","word_count",")","`",",","or","a","sparse","csc","matrix","of","BOWs","for","each","document",".","If","not","specified",",","the","model","is","left","uninitialized","(","presumably",",","to","be","trained","later","with","`","self.train","(",")","`",")",".","texts",":","list","of","list","of","str",",","optional","Tokenized","texts",",","needed","for","coherence","models","that","use","sliding","window","based","(","i.e",".","coherence=","`","c_something","`",")","probability","estimator",".","dictionary",":","{","dict","of","(","int",",","str",")",",",":","class",":","`","gensim.corpora.dictionary.Dictionary","`","}",",","optional","Dictionary","mapping","of","id","word","to","create","corpus",".","If","`","model.id2word","`","is","present",",","this","is","not","needed",".","If","both","are","provided",",","passed","`","dictionary","`","will","be","used",".","window_size",":","int",",","optional","Is","the","size","of","the","window","to","be","used","for","coherence","measures","using","boolean","sliding","window","as","their","probability","estimator",".","For","'u_mass","'","this","does","n't","matter",".","If","None","-","the","default","window","sizes","are","used","which","are",":","'c_v","'","-","110",",","'c_uci","'","-","10",",","'c_npmi","'","-","10.","coherence",":","{","'u_mass","'",",","'c_v","'",",","'c_uci","'",",","'c_npmi","'","}",",","optional","Coherence","measure","to","be","used",".","Fastest","method","-","'u_mass","'",",","'c_uci","'","also","known","as","`","c_pmi","`",".","For","'u_mass","'","corpus","should","be","provided",",","if","texts","is","provided",",","it","will","be","converted","to","corpus","using","the","dictionary",".","For","'c_v","'",",","'c_uci","'","and","'c_npmi","'","`","texts","`","should","be","provided","(","`","corpus","`","is","n't","needed",")","topn",":","int",",","optional","Integer","corresponding","to","the","number","of","top","words","to","be","extracted","from","each","topic",".","processes",":","int",",","optional","Number","of","processes","to","use","for","probability","estimation","phase",",","any","value","less","than","1","will","be","interpreted","as","num_cpus","-","1",".","Returns","--","--","--","-","list","of","(","list","of","(","int",",","str",")",",","float",")","Each","element","in","the","list","is","a","pair","of","a","topic","representation","and","its","coherence","score",".","Topic","representations","are","distributions","of","words",",","represented","as","a","list","of","pairs","of","word","IDs","and","their","probabilities","."]
code: def top_topics(
      self,
      corpus,
      texts=None,
      dictionary=None,
      window_size=None,
      coherence="u_mass",
      topn=20,
      processes=-1,
  ):
      """Get the topics sorted by coherence.
  
      Parameters
      ----------
      corpus : iterable of list of (int, float) or `csc_matrix` with the shape (n_tokens, n_documents)
          Training corpus.
          Can be either iterable of documents, which are lists of `(word_id, word_count)`,
          or a sparse csc matrix of BOWs for each document.
          If not specified, the model is left uninitialized (presumably, to be trained later with `self.train()`).
      texts : list of list of str, optional
          Tokenized texts, needed for coherence models that use sliding window based (i.e. coherence=`c_something`)
          probability estimator .
      dictionary : {dict of (int, str), :class:`gensim.corpora.dictionary.Dictionary`}, optional
          Dictionary mapping of id word to create corpus.
          If `model.id2word` is present, this is not needed. If both are provided, passed `dictionary` will be used.
      window_size : int, optional
          Is the size of the window to be used for coherence measures using boolean sliding window as their
          probability estimator. For 'u_mass' this doesn't matter.
          If None - the default window sizes are used which are: 'c_v' - 110, 'c_uci' - 10, 'c_npmi' - 10.
      coherence : {'u_mass', 'c_v', 'c_uci', 'c_npmi'}, optional
          Coherence measure to be used.
          Fastest method - 'u_mass', 'c_uci' also known as `c_pmi`.
          For 'u_mass' corpus should be provided, if texts is provided, it will be converted to corpus
          using the dictionary. For 'c_v', 'c_uci' and 'c_npmi' `texts` should be provided (`corpus` isn't needed)
      topn : int, optional
          Integer corresponding to the number of top words to be extracted from each topic.
      processes : int, optional
          Number of processes to use for probability estimation phase, any value less than 1 will be interpreted as
          num_cpus - 1.
  
      Returns
      -------
      list of (list of (int, str), float)
          Each element in the list is a pair of a topic representation and its coherence score. Topic representations
          are distributions of words, represented as a list of pairs of word IDs and their probabilities.
  
      """
      cm = CoherenceModel(
          model=self,
          corpus=corpus,
          texts=texts,
          dictionary=dictionary,
          window_size=window_size,
          coherence=coherence,
          topn=topn,
          processes=processes,
      )
      coherence_scores = cm.get_coherence_per_topic()
  
      str_topics = []
      for (
          topic
      ) in (
          self.get_topics()
      ):  # topic = array of vocab_size floats, one per term
          bestn = matutils.argsort(
              topic, topn=topn, reverse=True
          )  # top terms for topic
          beststr = [
              (topic[_id], self.id2word[_id]) for _id in bestn
          ]  # membership, token
          str_topics.append(
              beststr
          )  # list of topn (float membership, token) tuples
  
      scored_topics = zip(str_topics, coherence_scores)
      return sorted(scored_topics, key=lambda tup: tup[1], reverse=True)
  
imports: import collections.abc
  import logging
  import numpy
  import scipy.sparse
  from scipy.stats import halfnorm
  from gensim import interfaces
  from gensim import matutils
  from gensim import utils
  from gensim.interfaces import TransformedCorpus
  from gensim.models import basemodel, CoherenceModel
  from gensim.models.nmf_pgd import solve_h
label_desc: Use image node_id 7 for calling the Nmf obj's underlying member method code with example usage: obj.top_topics(corpus, texts, dictionary, window_size, coherence, topn, processes) and returns: sorted