original_docstring:  Calculate allocation term of the ELBO objective.
  
      E[ log p(pi) + log p(z) - log q(pi)  ]
  
      Returns
      -------
      L_alloc : scalar float
      
docstring: Calculate allocation term of the ELBO objective.
  
  Returns
  
  L_alloc : scalar float
docstring_tokens: Calculate allocation term of the ELBO objective . Returns L_alloc : scalar float
code: def L_alloc(Data=None, LP=None, nDoc=0, alpha=1.0, **kwargs):
      ''' Calculate allocation term of the ELBO objective.
  
      E[ log p(pi) + log p(z) - log q(pi)  ]
  
      Returns
      -------
      L_alloc : scalar float
      '''
      if Data is not None:
          nDoc = Data.nDoc
      if LP is None:
          LP = dict(**kwargs)
  
      K = LP['DocTopicCount'].shape[1]
      cDiff = nDoc * c_Func(alpha / K, K) - c_Func(LP['theta'])
      return cDiff
      # Slack term will always be zero, so need not compute it.
      #slackVec = LP['DocTopicCount'] + alpha / K - LP['theta']
      #slackVec *= LP['ElogPi']
      #return cDiff + np.sum(slackVec)
code_tokens: def L_alloc ( Data = None , LP = None , nDoc = 0 , alpha = 1.0 , ** kwargs ) : if Data is not None : nDoc = Data . nDoc if LP is None : LP = dict ( ** kwargs ) K = LP [ 'DocTopicCount' ] . shape [ 1 ] cDiff = nDoc * c_Func ( alpha / K , K ) - c_Func ( LP [ 'theta' ] ) return cDiff
short_docstring: Calculate allocation term of the ELBO objective.
short_docstring_tokens: Calculate allocation term of the ELBO objective .
comment: ''' Calculate allocation term of the ELBO objective.
  
      E[ log p(pi) + log p(z) - log q(pi)  ]
  
      Returns
      -------
      L_alloc : scalar float
      '''$SEP$# Slack term will always be zero, so need not compute it.$SEP$#slackVec = LP['DocTopicCount'] + alpha / K - LP['theta']$SEP$#slackVec *= LP['ElogPi']$SEP$#return cDiff + np.sum(slackVec)