Esempio n. 1
0
 def test_transform(self):
     a = CoulombMatrix()
     a.fit([METHANE])
     expected_results = numpy.array([[
         36.8581052, 5.49459021, 5.49462885, 5.4945, 5.49031286, 5.49459021,
         0.5, 0.56071947, 0.56071656, 0.56064037, 5.49462885, 0.56071947,
         0.5, 0.56071752, 0.56064089, 5.4945, 0.56071656, 0.56071752, 0.5,
         0.56063783, 5.49031286, 0.56064037, 0.56064089, 0.56063783, 0.5
     ]])
     try:
         numpy.testing.assert_array_almost_equal(a.transform([METHANE]),
                                                 expected_results)
     except AssertionError as e:
         self.fail(e)
Esempio n. 2
0
 def test_transform_before_fit(self):
     a = CoulombMatrix()
     with self.assertRaises(ValueError):
         a.transform(ALL_DATA)
Esempio n. 3
0
 def test_small_to_large_transform_drop_values(self):
     a = CoulombMatrix(drop_values=True)
     a.fit([METHANE])
     a.transform(ALL_DATA)
     self.assertEqual(a.transform(ALL_DATA).shape, (3, 25))
Esempio n. 4
0
 def test_small_to_large_transform(self):
     a = CoulombMatrix()
     a.fit([METHANE])
     with self.assertRaises(ValueError):
         a.transform(ALL_DATA)