Changeset 10645:a9cffa7f948c in orange for Orange/testing/unit/tests/test_projection_linear.py
Legend:
 Unmodified
 Added
 Removed

Orange/testing/unit/tests/test_projection_linear.py
r10644 r10645 60 60 self.assertIsInstance(pca, linear.PcaProjector) 61 61 62 absolute_error = (np.abs(pca. eigen_vectors[0])  np.abs(self.principal_component)).sum()62 absolute_error = (np.abs(pca.projection[0])  np.abs(self.principal_component)).sum() 63 63 self.assertAlmostEqual(absolute_error, 0.) 64 64 … … 69 69 self.assertIsInstance(pca, linear.PcaProjector) 70 70 71 absolute_error = (np.abs(pca. eigen_vectors[0])  np.abs(self.principal_component)).sum()71 absolute_error = (np.abs(pca.projection[0])  np.abs(self.principal_component)).sum() 72 72 self.assertAlmostEqual(absolute_error, 0., 1) 73 73 … … 76 76 77 77 pca = linear.Pca(standardize=True)(self.dataset) 78 eigen_vector = pca. eigen_vectors[0]78 eigen_vector = pca.projection[0] 79 79 non_zero_elements = eigen_vector[eigen_vector.nonzero()] 80 80 … … 87 87 pca = linear.Pca(variance_covered=.99)(self.dataset) 88 88 # all data points lie in one dimension, one component should cover all the variance 89 nvectors, vector_dimension = pca. eigen_vectors.shape89 nvectors, vector_dimension = pca.projection.shape 90 90 self.assertEqual(nvectors, 1) 91 91 … … 96 96 pca = linear.Pca(max_components=max_components)(self.dataset) 97 97 # all data points lie in one dimension, one component should cover all the variance 98 nvectors, vector_dimension = pca. eigen_vectors.shape98 nvectors, vector_dimension = pca.projection.shape 99 99 self.assertEqual(nvectors, max_components) 100 100 101 101 def test_pca_handles_unknowns(self): 102 102 self.create_dataset_with_unknowns() 103 print self.dataset[0]104 103 105 104 pca = linear.Pca()(self.dataset)
Note: See TracChangeset
for help on using the changeset viewer.