def change_test(self): # Check to see if functions touch original data # They should not data_init = np.copy(self.data) p = PCA(eps=0.) p.fit(self.data) assert np.allclose(self.data,data_init) p.fit_transform(self.data) assert np.allclose(self.data,data_init) p.inv_transform(self.data) assert np.allclose(self.data,data_init)
def dimreduce_test(self): # Check to see if intrinsically 2D data # can be transformed to 2D and back exactly p = PCA(dim=2, eps=0.) new = p.fit_transform(self.data) new = p.inv_transform(new) assert np.allclose(new,self.data)
def transform_test(self): # Check to see if data can # be transformed and inverse transformed exactly p = PCA(eps=0.) new = p.fit_transform(self.data) new = p.inv_transform(new) assert np.allclose(new,self.data)