def _Eq6(_lambda,K,_x_u,m_pre_c,user_comment,_comment_2_user_matrix,shot_comments_vector,_n_t_c):
#traverse all users
total=[]
for index,key in enumerate(user_comment):
temp=np.zeros(K)
for comment in user_comment[key]:
i,j=comment[0],comment[1]
shared_term=_x_u[index]*_lambda[i]+m_pre_c[i][j]
temp+=_lambda[i]*dlgt(shared_term)\
*(digamma(np.sum(lgt(shared_term))\
-digamma(np.sum(lgt(shared_term))+np.sum(shot_comments_vector[i][j]))
+digamma(lgt(shared_term)+_n_t_c[i][j])\
-digamma(lgt(shared_term))))
total.append(-1*_x_u[index] +temp)
return np.array(total)
评论列表
文章目录