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: Initialize a CoherenceModel with estimated probabilities for all of the given models.
  Use :meth:`~gensim.models.coherencemodel.CoherenceModel.for_topics` method.
  
  Parameters
  ----------
  models : list of :class:`~gensim.models.basemodel.BaseTopicModel`
      List of models to evaluate coherence of, each of it should implements
      :meth:`~gensim.models.basemodel.BaseTopicModel.get_topics` method.
  dictionary : :class:`~gensim.corpora.dictionary.Dictionary`
      Gensim dictionary mapping of id word.
  topn : int, optional
      Integer corresponding to the number of top words to be extracted from each topic.
  kwargs : object
      Sequence of arguments, see :meth:`~gensim.models.coherencemodel.CoherenceModel.for_topics`.
  
  Return
  ------
  :class:`~gensim.models.coherencemodel.CoherenceModel`
      CoherenceModel with estimated probabilities for all of the given models.
  
  Example
  -------
  .. sourcecode:: pycon
  
      >>> from gensim.test.utils import common_corpus, common_dictionary
      >>> from gensim.models.ldamodel import LdaModel
      >>> from gensim.models.coherencemodel import CoherenceModel
      >>>
      >>> m1 = LdaModel(common_corpus, 3, common_dictionary)
      >>> m2 = LdaModel(common_corpus, 5, common_dictionary)
      >>>
      >>> cm = CoherenceModel.for_models([m1, m2], common_dictionary, corpus=common_corpus, coherence='u_mass')
docstr_tok: ["Initialize","a","CoherenceModel","with","estimated","probabilities","for","all","of","the","given","models",".","Use",":","meth",":","`","~gensim.models.coherencemodel.CoherenceModel.for_topics","`","method",".","Parameters","--","--","--","--","--","models",":","list","of",":","class",":","`","~gensim.models.basemodel.BaseTopicModel","`","List","of","models","to","evaluate","coherence","of",",","each","of","it","should","implements",":","meth",":","`","~gensim.models.basemodel.BaseTopicModel.get_topics","`","method",".","dictionary",":",":","class",":","`","~gensim.corpora.dictionary.Dictionary","`","Gensim","dictionary","mapping","of","id","word",".","topn",":","int",",","optional","Integer","corresponding","to","the","number","of","top","words","to","be","extracted","from","each","topic",".","kwargs",":","object","Sequence","of","arguments",",","see",":","meth",":","`","~gensim.models.coherencemodel.CoherenceModel.for_topics","`",".","Return","--","--","--",":","class",":","`","~gensim.models.coherencemodel.CoherenceModel","`","CoherenceModel","with","estimated","probabilities","for","all","of","the","given","models",".","Example","--","--","--","-","..","sourcecode",":",":","pycon",">",">",">","from","gensim.test.utils","import","common_corpus",",","common_dictionary",">",">",">","from","gensim.models.ldamodel","import","LdaModel",">",">",">","from","gensim.models.coherencemodel","import","CoherenceModel",">",">",">",">",">",">","m1","=","LdaModel","(","common_corpus",",","3",",","common_dictionary",")",">",">",">","m2","=","LdaModel","(","common_corpus",",","5",",","common_dictionary",")",">",">",">",">",">",">","cm","=","CoherenceModel.for_models","(","[","m1",",","m2","]",",","common_dictionary",",","corpus=common_corpus",",","coherence='u_mass","'",")"]
code: def for_models(cls, models, dictionary, topn=20, **kwargs):
      """Initialize a CoherenceModel with estimated probabilities for all of the given models.
      Use :meth:`~gensim.models.coherencemodel.CoherenceModel.for_topics` method.
  
      Parameters
      ----------
      models : list of :class:`~gensim.models.basemodel.BaseTopicModel`
          List of models to evaluate coherence of, each of it should implements
          :meth:`~gensim.models.basemodel.BaseTopicModel.get_topics` method.
      dictionary : :class:`~gensim.corpora.dictionary.Dictionary`
          Gensim dictionary mapping of id word.
      topn : int, optional
          Integer corresponding to the number of top words to be extracted from each topic.
      kwargs : object
          Sequence of arguments, see :meth:`~gensim.models.coherencemodel.CoherenceModel.for_topics`.
  
      Return
      ------
      :class:`~gensim.models.coherencemodel.CoherenceModel`
          CoherenceModel with estimated probabilities for all of the given models.
  
      Example
      -------
      .. sourcecode:: pycon
  
          >>> from gensim.test.utils import common_corpus, common_dictionary
          >>> from gensim.models.ldamodel import LdaModel
          >>> from gensim.models.coherencemodel import CoherenceModel
          >>>
          >>> m1 = LdaModel(common_corpus, 3, common_dictionary)
          >>> m2 = LdaModel(common_corpus, 5, common_dictionary)
          >>>
          >>> cm = CoherenceModel.for_models([m1, m2], common_dictionary, corpus=common_corpus, coherence='u_mass')
      """
      topics = [
          cls.top_topics_as_word_lists(model, dictionary, topn)
          for model in models
      ]
      kwargs["dictionary"] = dictionary
      kwargs["topn"] = topn
      return cls.for_topics(topics, **kwargs)
  
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 2 for calling the CoherenceModel obj's underlying member method code with example usage: obj.for_models(cls, models, dictionary, topn) and returns: cls