def __call__(self, data):
if data.domain != self.pca.pre_domain:
data = data.from_table(self.pca.pre_domain, data)
pca_space = self.pca.transform(data.X)
if self.components is not None:
#set unused components to zero
remove = np.ones(pca_space.shape[1])
remove[self.components] = 0
remove = np.extract(remove, np.arange(pca_space.shape[1]))
pca_space[:,remove] = 0
return self.pca.proj.inverse_transform(pca_space)
评论列表
文章目录