original_docstring:  Calculate summary from local parameters for given data slice.
  
      Parameters
      -------
      Data : bnpy data object
      LP : local param dict with fields
          resp : Data.nObs x K array,
              where resp[n,k] = posterior resp of comp k
          doPrecompEntropy : boolean flag
              indicates whether to precompute ELBO terms in advance
              used for memoized learning algorithms (moVB)
  
      Returns
      -------
      SS : SuffStatBag with K components
          * nDoc : scalar float
              Counts total documents available in provided data.
  
          Also has optional ELBO field when precompELBO is True
          * Hvec : 1D array, size K
              Vector of entropy contributions from each comp.
              Hvec[k] = \sum_{n=1}^N H[q(z_n)], a function of 'resp'
      
docstring: Calculate summary from local parameters for given data slice.
  Parameters
  
  Data : bnpy data object
  LP : local param dict with fields
  resp : Data.nObs x K array,
  where resp[n,k] = posterior resp of comp k
  doPrecompEntropy : boolean flag
  indicates whether to precompute ELBO terms in advance
  used for memoized learning algorithms (moVB)
  
  Returns
  
  SS : SuffStatBag with K components
  nDoc : scalar float
  Counts total documents available in provided data.
  
  Also has optional ELBO field when precompELBO is True
  Hvec : 1D array, size K
  Vector of entropy contributions from each comp.
docstring_tokens: Calculate summary from local parameters for given data slice . Parameters Data : bnpy data object LP : local param dict with fields resp : Data . nObs x K array where resp [ n k ] = posterior resp of comp k doPrecompEntropy : boolean flag indicates whether to precompute ELBO terms in advance used for memoized learning algorithms ( moVB ) Returns SS : SuffStatBag with K components nDoc : scalar float Counts total documents available in provided data . Also has optional ELBO field when precompELBO is True Hvec : 1D array size K Vector of entropy contributions from each comp .
code: def calcSummaryStats(Dslice, LP=None, alpha=None,
                       doPrecompEntropy=False,
                       cslice=(0, None),
                       **kwargs):
      """ Calculate summary from local parameters for given data slice.
  
      Parameters
      -------
      Data : bnpy data object
      LP : local param dict with fields
          resp : Data.nObs x K array,
              where resp[n,k] = posterior resp of comp k
          doPrecompEntropy : boolean flag
              indicates whether to precompute ELBO terms in advance
              used for memoized learning algorithms (moVB)
  
      Returns
      -------
      SS : SuffStatBag with K components
          * nDoc : scalar float
              Counts total documents available in provided data.
  
          Also has optional ELBO field when precompELBO is True
          * Hvec : 1D array, size K
              Vector of entropy contributions from each comp.
              Hvec[k] = \sum_{n=1}^N H[q(z_n)], a function of 'resp'
      """
      K = LP['DocTopicCount'].shape[1]
      SS = SuffStatBag(K=K, D=Dslice.dim)
  
      if cslice[1] is None:
          SS.setField('nDoc', Dslice.nDoc, dims=None)
      else:
          SS.setField('nDoc', cslice[1] - cslice[0], dims=None)
  
      SS.setField('nDoc', Dslice.nDoc, dims=None)
      if doPrecompEntropy:
          assert 'theta' in LP
          Lalloc = L_alloc(Dslice, LP, alpha=alpha)
          SS.setELBOTerm('L_alloc', Lalloc, dims=None)
  
          if 'nnzPerRow' in LP and LP['nnzPerRow'] == 1:
              SS.setELBOTerm('Hvec', 0.0, dims=None)
          else:
              Hvec = L_entropy(Dslice, LP, returnVector=1)
              SS.setELBOTerm('Hvec', Hvec, dims='K')
      return SS
code_tokens: def calcSummaryStats ( Dslice , LP = None , alpha = None , doPrecompEntropy = False , cslice = ( 0 , None ) , ** kwargs ) : K = LP [ 'DocTopicCount' ] . shape [ 1 ] SS = SuffStatBag ( K = K , D = Dslice . dim ) if cslice [ 1 ] is None : SS . setField ( 'nDoc' , Dslice . nDoc , dims = None ) else : SS . setField ( 'nDoc' , cslice [ 1 ] - cslice [ 0 ] , dims = None ) SS . setField ( 'nDoc' , Dslice . nDoc , dims = None ) if doPrecompEntropy : assert 'theta' in LP Lalloc = L_alloc ( Dslice , LP , alpha = alpha ) SS . setELBOTerm ( 'L_alloc' , Lalloc , dims = None ) if 'nnzPerRow' in LP and LP [ 'nnzPerRow' ] == 1 : SS . setELBOTerm ( 'Hvec' , 0.0 , dims = None ) else : Hvec = L_entropy ( Dslice , LP , returnVector = 1 ) SS . setELBOTerm ( 'Hvec' , Hvec , dims = 'K' ) return SS
short_docstring: Calculate summary from local parameters for given data slice.
short_docstring_tokens: Calculate summary from local parameters for given data slice .
comment: """ Calculate summary from local parameters for given data slice.
  
      Parameters
      -------
      Data : bnpy data object
      LP : local param dict with fields
          resp : Data.nObs x K array,
              where resp[n,k] = posterior resp of comp k
          doPrecompEntropy : boolean flag
              indicates whether to precompute ELBO terms in advance
              used for memoized learning algorithms (moVB)
  
      Returns
      -------
      SS : SuffStatBag with K components
          * nDoc : scalar float
              Counts total documents available in provided data.
  
          Also has optional ELBO field when precompELBO is True
          * Hvec : 1D array, size K
              Vector of entropy contributions from each comp.
              Hvec[k] = \sum_{n=1}^N H[q(z_n)], a function of 'resp'
      """