def getLPfromResp(Resp, Data, smoothMass=0.01):
  D = Data.nDoc
  K = Resp.shape[1]
  DocTopicC = np.zeros((D, K))
  for dd in range(D):
    start,stop = Data.doc_range[dd,:]
    DocTopicC[dd,:] = np.dot(Data.word_count[start:stop],        
                               Resp[start:stop,:]
                             )
  # Alpha and ElogPi : D x K+1 matrices
  padCol = smoothMass * np.ones((D,1))
  alph = np.hstack( [DocTopicC + smoothMass, padCol])    
  ElogPi = digamma(alph) - digamma(alph.sum(axis=1))[:,np.newaxis]
  assert ElogPi.shape == (D,K+1)
  return dict(word_variational =Resp, 
              E_logPi=ElogPi, alphaPi=alph,
              DocTopicCount=DocTopicC)
Returns local parameters (LP) for an HDP model
dataset/ETHPy150Open daeilkim/refinery/refinery/bnpy/bnpy-dev/bnpy/init/FromScratchMult.py/getLPfromResp