class_docstr: Objects of this class allow for building and maintaining a model for topic coherence.
  
  Examples
  ---------
  One way of using this feature is through providing a trained topic model. A dictionary has to be explicitly provided
  if the model does not contain a dictionary already
  
  .. sourcecode:: pycon
  
      >>> from gensim.test.utils import common_corpus, common_dictionary
      >>> from gensim.models.ldamodel import LdaModel
      >>> from gensim.models.coherencemodel import CoherenceModel
      >>>
      >>> model = LdaModel(common_corpus, 5, common_dictionary)
      >>>
      >>> cm = CoherenceModel(model=model, corpus=common_corpus, coherence='u_mass')
      >>> coherence = cm.get_coherence()  # get coherence value
  
  Another way of using this feature is through providing tokenized topics such as:
  
  .. sourcecode:: pycon
  
      >>> from gensim.test.utils import common_corpus, common_dictionary
      >>> from gensim.models.coherencemodel import CoherenceModel
      >>> topics = [
      ...     ['human', 'computer', 'system', 'interface'],
      ...     ['graph', 'minors', 'trees', 'eps']
      ... ]
      >>>
      >>> cm = CoherenceModel(topics=topics, corpus=common_corpus, dictionary=common_dictionary, coherence='u_mass')
      >>> coherence = cm.get_coherence()  # get coherence value
class_docstr_tok: ["Objects","of","this","class","allow","for","building","and","maintaining","a","model","for","topic","coherence",".","Examples","--","--","--","--","-","One","way","of","using","this","feature","is","through","providing","a","trained","topic","model",".","A","dictionary","has","to","be","explicitly","provided","if","the","model","does","not","contain","a","dictionary","already","..","sourcecode",":",":","pycon",">",">",">","from","gensim.test.utils","import","common_corpus",",","common_dictionary",">",">",">","from","gensim.models.ldamodel","import","LdaModel",">",">",">","from","gensim.models.coherencemodel","import","CoherenceModel",">",">",">",">",">",">","model","=","LdaModel","(","common_corpus",",","5",",","common_dictionary",")",">",">",">",">",">",">","cm","=","CoherenceModel","(","model=model",",","corpus=common_corpus",",","coherence='u_mass","'",")",">",">",">","coherence","=","cm.get_coherence","(",")","#","get","coherence","value","Another","way","of","using","this","feature","is","through","providing","tokenized","topics","such","as",":","..","sourcecode",":",":","pycon",">",">",">","from","gensim.test.utils","import","common_corpus",",","common_dictionary",">",">",">","from","gensim.models.coherencemodel","import","CoherenceModel",">",">",">","topics","=","[","...","[","'human","'",",","'computer","'",",","'system","'",",","'interface","'","]",",","...","[","'graph","'",",","'minors","'",",","'trees","'",",","'eps","'","]","...","]",">",">",">",">",">",">","cm","=","CoherenceModel","(","topics=topics",",","corpus=common_corpus",",","dictionary=common_dictionary",",","coherence='u_mass","'",")",">",">",">","coherence","=","cm.get_coherence","(",")","#","get","coherence","value"]
docstr: Perform the coherence evaluation for each of the models.
  
  Parameters
  ----------
  model_topics : list of list of str
      list of list of words for the model trained with that number of topics.
  
  Returns
  -------
  list of (float, float)
      Sequence of pairs of average topic coherence and average coherence.
  
  Notes
  -----
  This first precomputes the probabilities once, then evaluates coherence for each model.
  
  Since we have already precomputed the probabilities, this simply involves using the accumulated stats in the
  :class:`~gensim.models.coherencemodel.CoherenceModel` to perform the evaluations, which should be pretty quick.
docstr_tok: ["Perform","the","coherence","evaluation","for","each","of","the","models",".","Parameters","--","--","--","--","--","model_topics",":","list","of","list","of","str","list","of","list","of","words","for","the","model","trained","with","that","number","of","topics",".","Returns","--","--","--","-","list","of","(","float",",","float",")","Sequence","of","pairs","of","average","topic","coherence","and","average","coherence",".","Notes","--","--","-","This","first","precomputes","the","probabilities","once",",","then","evaluates","coherence","for","each","model",".","Since","we","have","already","precomputed","the","probabilities",",","this","simply","involves","using","the","accumulated","stats","in","the",":","class",":","`","~gensim.models.coherencemodel.CoherenceModel","`","to","perform","the","evaluations",",","which","should","be","pretty","quick","."]
code: def compare_model_topics(self, model_topics):
      """Perform the coherence evaluation for each of the models.
  
      Parameters
      ----------
      model_topics : list of list of str
          list of list of words for the model trained with that number of topics.
  
      Returns
      -------
      list of (float, float)
          Sequence of pairs of average topic coherence and average coherence.
  
      Notes
      -----
      This first precomputes the probabilities once, then evaluates coherence for each model.
  
      Since we have already precomputed the probabilities, this simply involves using the accumulated stats in the
      :class:`~gensim.models.coherencemodel.CoherenceModel` to perform the evaluations, which should be pretty quick.
  
      """
      orig_topics = self._topics
      orig_topn = self.topn
  
      try:
          coherences = self._compare_model_topics(model_topics)
      finally:
          self.topics = orig_topics
          self.topn = orig_topn
  
      return coherences
  
imports: import logging
  import multiprocessing
  from collections import namedtuple
  import numpy
  from gensim import interfaces, matutils
  from gensim import utils
  from gensim.topic_coherence import segmentation, probability_estimation, direct_confirmation_measure, indirect_confirmation_measure, aggregation
  from gensim.topic_coherence.probability_estimation import unique_ids_from_segments
label_desc: Use image node_id 25 for calling the CoherenceModel obj's underlying member method code with example usage: obj.compare_model_topics(model_topics) and returns: coherences