class_docstr: Train and use Online Latent Dirichlet Allocation model as presented in
  `'Online Learning for LDA' by Hoffman et al.`_
  
  Examples
  -------
  Initialize a model using a Gensim corpus
  
  .. sourcecode:: pycon
  
      >>> from gensim.test.utils import common_corpus
      >>>
      >>> lda = LdaModel(common_corpus, num_topics=10)
  
  You can then infer topic distributions on new, unseen documents.
  
  .. sourcecode:: pycon
  
      >>> doc_bow = [(1, 0.3), (2, 0.1), (0, 0.09)]
      >>> doc_lda = lda[doc_bow]
  
  The model can be updated (trained) with new documents.
  
  .. sourcecode:: pycon
  
      >>> # In practice (corpus =/= initial training corpus), but we use the same here for simplicity.
      >>> other_corpus = common_corpus
      >>>
      >>> lda.update(other_corpus)
  
  Model persistency is achieved through :meth:`~gensim.models.ldamodel.LdaModel.load` and
  :meth:`~gensim.models.ldamodel.LdaModel.save` methods.
class_docstr_tok: ["Train","and","use","Online","Latent","Dirichlet","Allocation","model","as","presented","in","`","'Online","Learning","for","LDA","'","by","Hoffman","et","al.","`","_","Examples","--","--","--","-","Initialize","a","model","using","a","Gensim","corpus","..","sourcecode",":",":","pycon",">",">",">","from","gensim.test.utils","import","common_corpus",">",">",">",">",">",">","lda","=","LdaModel","(","common_corpus",",","num_topics=10",")","You","can","then","infer","topic","distributions","on","new",",","unseen","documents",".","..","sourcecode",":",":","pycon",">",">",">","doc_bow","=","[","(","1",",","0.3",")",",","(","2",",","0.1",")",",","(","0",",","0.09",")","]",">",">",">","doc_lda","=","lda","[","doc_bow","]","The","model","can","be","updated","(","trained",")","with","new","documents",".","..","sourcecode",":",":","pycon",">",">",">","#","In","practice","(","corpus","=\/=","initial","training","corpus",")",",","but","we","use","the","same","here","for","simplicity",".",">",">",">","other_corpus","=","common_corpus",">",">",">",">",">",">","lda.update","(","other_corpus",")","Model","persistency","is","achieved","through",":","meth",":","`","~gensim.models.ldamodel.LdaModel.load","`","and",":","meth",":","`","~gensim.models.ldamodel.LdaModel.save","`","methods","."]
docstr: Load a previously saved :class:`gensim.models.ldamodel.LdaModel` from file.
  
  See Also
  --------
  :meth:`~gensim.models.ldamodel.LdaModel.save`
      Save model.
  
  Parameters
  ----------
  fname : str
      Path to the file where the model is stored.
  *args
      Positional arguments propagated to :meth:`~gensim.utils.SaveLoad.load`.
  **kwargs
      Key word arguments propagated to :meth:`~gensim.utils.SaveLoad.load`.
  
  Examples
  --------
  Large arrays can be memmap'ed back as read-only (shared memory) by setting `mmap='r'`:
  
  .. sourcecode:: pycon
  
      >>> from gensim.test.utils import datapath
      >>>
      >>> fname = datapath("lda_3_0_1_model")
      >>> lda = LdaModel.load(fname, mmap='r')
docstr_tok: ["Load","a","previously","saved",":","class",":","`","gensim.models.ldamodel.LdaModel","`","from","file",".","See","Also","--","--","--","--",":","meth",":","`","~gensim.models.ldamodel.LdaModel.save","`","Save","model",".","Parameters","--","--","--","--","--","fname",":","str","Path","to","the","file","where","the","model","is","stored",".","*","args","Positional","arguments","propagated","to",":","meth",":","`","~gensim.utils.SaveLoad.load","`",".","*","*","kwargs","Key","word","arguments","propagated","to",":","meth",":","`","~gensim.utils.SaveLoad.load","`",".","Examples","--","--","--","--","Large","arrays","can","be","memmap'ed","back","as","read-only","(","shared","memory",")","by","setting","`","mmap=","'","r","'","`",":","..","sourcecode",":",":","pycon",">",">",">","from","gensim.test.utils","import","datapath",">",">",">",">",">",">","fname","=","datapath","(","``","lda_3_0_1_model","''",")",">",">",">","lda","=","LdaModel.load","(","fname",",","mmap=","'","r","'",")"]
code: def load(cls, fname, *args, **kwargs):
      """Load a previously saved :class:`gensim.models.ldamodel.LdaModel` from file.
  
      See Also
      --------
      :meth:`~gensim.models.ldamodel.LdaModel.save`
          Save model.
  
      Parameters
      ----------
      fname : str
          Path to the file where the model is stored.
      *args
          Positional arguments propagated to :meth:`~gensim.utils.SaveLoad.load`.
      **kwargs
          Key word arguments propagated to :meth:`~gensim.utils.SaveLoad.load`.
  
      Examples
      --------
      Large arrays can be memmap'ed back as read-only (shared memory) by setting `mmap='r'`:
  
      .. sourcecode:: pycon
  
          >>> from gensim.test.utils import datapath
          >>>
          >>> fname = datapath("lda_3_0_1_model")
          >>> lda = LdaModel.load(fname, mmap='r')
  
      """
      kwargs["mmap"] = kwargs.get("mmap", None)
      result = super(LdaModel, cls).load(fname, *args, **kwargs)
  
      # check if `random_state` attribute has been set after main pickle load
      # if set -> the model to be loaded was saved using a >= 0.13.2 version of Gensim
      # if not set -> the model to be loaded was saved using a < 0.13.2 version of Gensim,
      # so set `random_state` as the default value
      if not hasattr(result, "random_state"):
          result.random_state = utils.get_random_state(
              None
          )  # using default value `get_random_state(None)`
          logging.warning("random_state not set so using default value")
  
      # dtype could be absent in old models
      if not hasattr(result, "dtype"):
          result.dtype = (
              np.float64
          )  # float64 was implicitly used before (cause it's default in numpy)
          logging.info(
              "dtype was not set in saved %s file %s, assuming np.float64",
              result.__class__.__name__,
              fname,
          )
  
      state_fname = utils.smart_extension(fname, ".state")
      try:
          result.state = LdaState.load(state_fname, *args, **kwargs)
      except Exception as e:
          logging.warning(
              "failed to load state from %s: %s", state_fname, e
          )
  
      id2word_fname = utils.smart_extension(fname, ".id2word")
      # check if `id2word_fname` file is present on disk
      # if present -> the model to be loaded was saved using a >= 0.13.2 version of Gensim,
      # so set `result.id2word` using the `id2word_fname` file
      # if not present -> the model to be loaded was saved using a < 0.13.2 version of Gensim,
      # so `result.id2word` already set after the main pickle load
      if os.path.isfile(id2word_fname):
          try:
              result.id2word = utils.unpickle(id2word_fname)
          except Exception as e:
              logging.warning(
                  "failed to load id2word dictionary from %s: %s",
                  id2word_fname,
                  e,
              )
      return result
  
imports: import logging
  import numbers
  import os
  import time
  from collections import defaultdict
  import numpy
  from scipy.special import gammaln, psi
  from scipy.special import polygamma
  from gensim import interfaces, utils, matutils
  from gensim.matutils import kullback_leibler, hellinger, jaccard_distance, jensen_shannon, dirichlet_expectation, logsumexp, mean_absolute_difference
  from gensim.models import basemodel, CoherenceModel
  from gensim.models.callbacks import Callback
label_desc: Use image node_id 24 for calling the LdaModel obj's underlying member method code with example usage: obj.load(cls, fname) and returns: result