def _update_logdet_covar_and_inv_covar(self, k):
"""
Update the covariance terms for component `k`.
Based on the `m_N_numerators` and `S_N_partials` terms for the `k`th
component, the `logdet_covars` and `inv_covars` terms are updated.
"""
k_N = self.prior.k_0 + self.counts[k]
v_N = self.prior.v_0 + self.counts[k]
m_N = self.m_N_numerators[k]/k_N
covar = (k_N + 1.)/(k_N*(v_N - self.D + 1.)) * (self.S_N_partials[k] - k_N*np.outer(m_N, m_N))
self.logdet_covars[k] = slogdet(covar)[1]
self.inv_covars[k, :, :] = inv(covar)
# @profile
评论列表
文章目录