def _solve_theta(lo, hi, topic, X, BTBpR, c0, c1, f):
theta_batch = np.empty((hi - lo, f), dtype=topic.dtype)
for ib, u in enumerate(range(lo, hi)):
x_u, idx_u = get_row(X, u)
B_u = topic[idx_u]
a = x_u.dot(c1 * B_u)
'''
non-zero elements handled in this loop
'''
B = BTBpR + B_u.T.dot((c1 - c0) * B_u)#B_u only contains vectors corresponding to non-zero doc-word occurence
theta_batch[ib] = LA.solve(B, a)
theta_batch = theta_batch.clip(0)
return theta_batch
评论列表
文章目录