def _log_prod_students_t(self, i, mu, log_prod_var, inv_var, v):
"""
Return the value of the log of the product of the univariate Student's
t PDFs at `X[i]`.
"""
delta = self.X[i, :] - mu
return (
self.D * (
self._cached_gammaln_by_2[v + 1] - self._cached_gammaln_by_2[v]
- 0.5*self._cached_log_v[v] - 0.5*self._cached_log_pi
)
- 0.5*log_prod_var
- (v + 1.)/2. * (np.log(1. + 1./v * np.square(delta) * inv_var)).sum()
)
#-----------------------------------------------------------------------------#
# UTILITY FUNCTIONS #
#-----------------------------------------------------------------------------#
# Below is slightly faster than np.sum, see http://stackoverflow.com/questions/
# 18365073/why-is-numpys-einsum-faster-than-numpys-built-in-functions
评论列表
文章目录