original_docstring:  Calculate entropy of soft assignments term in ELBO objective.
  
      Returns
      -------
      L_entropy : scalar float
      
docstring: Calculate entropy of soft assignments term in ELBO objective.
  Returns
  
  L_entropy : scalar float
docstring_tokens: Calculate entropy of soft assignments term in ELBO objective . Returns L_entropy : scalar float
code: def L_entropy(Data=None, LP=None, resp=None, returnVector=0):
      """ Calculate entropy of soft assignments term in ELBO objective.
  
      Returns
      -------
      L_entropy : scalar float
      """
      spR = None
      if LP is not None:
          if 'resp' in LP:
              resp = LP['resp']
          elif 'spR' in LP:
              spR = LP['spR']
              N, K = LP['spR'].shape
          else:
              raise ValueError("LP dict missing resp or spR")
      if resp is not None:
          N, K = LP['resp'].shape
  
      if hasattr(Data, 'word_count') and N == Data.word_count.size:
          if resp is not None:
              Hvec = -1 * NumericUtil.calcRlogRdotv(resp, Data.word_count)
          elif spR is not None:
              Hvec = calcSparseRlogRdotv(v=Data.word_count, **LP)
          else:
              raise ValueError("Missing resp assignments!")
      else:
          if resp is not None:
              Hvec = -1 * NumericUtil.calcRlogR(resp)
          elif 'spR' in LP:
              assert 'nnzPerRow' in LP
              Hvec = calcSparseRlogR(**LP)
          else:
              raise ValueError("Missing resp assignments!")
      assert Hvec.size == K
      assert Hvec.min() >= -1e-6
      if returnVector:
          return Hvec
      return Hvec.sum()
code_tokens: def L_entropy ( Data = None , LP = None , resp = None , returnVector = 0 ) : spR = None if LP is not None : if 'resp' in LP : resp = LP [ 'resp' ] elif 'spR' in LP : spR = LP [ 'spR' ] N , K = LP [ 'spR' ] . shape else : raise ValueError ( "LP dict missing resp or spR" ) if resp is not None : N , K = LP [ 'resp' ] . shape if hasattr ( Data , 'word_count' ) and N == Data . word_count . size : if resp is not None : Hvec = - 1 * NumericUtil . calcRlogRdotv ( resp , Data . word_count ) elif spR is not None : Hvec = calcSparseRlogRdotv ( v = Data . word_count , ** LP ) else : raise ValueError ( "Missing resp assignments!" ) else : if resp is not None : Hvec = - 1 * NumericUtil . calcRlogR ( resp ) elif 'spR' in LP : assert 'nnzPerRow' in LP Hvec = calcSparseRlogR ( ** LP ) else : raise ValueError ( "Missing resp assignments!" ) assert Hvec . size == K assert Hvec . min ( ) >= - 1e-6 if returnVector : return Hvec return Hvec . sum ( )
short_docstring: Calculate entropy of soft assignments term in ELBO objective.
short_docstring_tokens: Calculate entropy of soft assignments term in ELBO objective .
comment: """ Calculate entropy of soft assignments term in ELBO objective.
  
      Returns
      -------
      L_entropy : scalar float
      """