distance_functions.py 文件源码

python
阅读 40 收藏 0 点赞 0 评论 0

项目:pyabc 作者: neuralyzer 项目源码 文件源码
def _calculate_whitening_transformation_matrix(self, sample_from_prior):
        samples_vec = sp.asarray([self._dict_to_to_vect(x)
                                  for x in sample_from_prior])
        # samples_vec is an array of shape nr_samples x nr_features
        means = samples_vec.mean(axis=0)
        centered = samples_vec - means
        covariance = centered.T.dot(centered)
        w, v = la.eigh(covariance)
        self._whitening_transformation_matrix = (
            v.dot(sp.diag(1. / sp.sqrt(w))).dot(v.T))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号