def test_initialize(self,window):
points = np.random.randn(self.n_points,self.dim)
GM = GaussianMixture(self.n_components,window=window)
GM.initialize(points)
checking.verify_covariance(GM.get('cov'),self.n_components,self.dim)
checking.verify_means(GM.get('means'),self.n_components,self.dim)
checking.verify_log_pi(GM.get('log_weights'),self.n_components)
cov_chol = np.empty_like(GM.get('cov'))
for i in range(self.n_components):
cov_chol[i] = linalg.cholesky(GM.get('cov')[i],lower=True)
assert_almost_equal(cov_chol,GM.get('cov_chol'))
assert GM.get('_is_initialized') == True
评论列表
文章目录