예제 #1
0
 def test_transform(self):
     a = EncodedAngle()
     a.fit([METHANE])
     # This is a cheap test to prevent needing all the values here
     expected_results = numpy.array([
         0.116708,  # mean
         0.450738,  # std
         0.,  # min
         3.043729,  # max
     ])
     try:
         m = a.fit_transform([METHANE])
         assert_close_statistics(m, expected_results)
     except AssertionError as e:
         self.fail(e)
예제 #2
0
 def test_small_to_large_transform(self):
     a = EncodedAngle()
     a.fit([METHANE])
     # This is a cheap test to prevent needing all the values here
     expected_results = numpy.array([
         0.018603,  # mean
         0.130329,  # std
         0.,  # min
         1.568823,  # max
     ])
     try:
         m = a.transform([MID])
         assert_close_statistics(m, expected_results)
     except AssertionError as e:
         self.fail(e)
예제 #3
0
    def test_add_unknown(self):
        a = EncodedAngle(add_unknown=True)
        a.fit([METHANE])

        # This is a cheap test to prevent needing all the values here
        expected_results = numpy.array([
            0.117057,  # mean
            0.510819,  # std
            0.,  # min
            6.343512,  # max
        ])
        try:
            m = a.transform([MID])
            self.assertEqual(m.shape, (1, 200))
            assert_close_statistics(m, expected_results)
        except AssertionError as e:
            self.fail(e)
예제 #4
0
 def test_fit(self):
     a = EncodedAngle()
     a.fit(ALL_DATA)
     expected = set([('C', 'N', 'C'), ('C', 'C', 'C'), ('H', 'H', 'H'),
                     ('H', 'O', 'O'), ('O', 'N', 'O'), ('H', 'N', 'N'),
                     ('C', 'H', 'H'), ('C', 'O', 'H'), ('C', 'H', 'C'),
                     ('N', 'C', 'N'), ('O', 'O', 'O'), ('H', 'O', 'N'),
                     ('H', 'N', 'O'), ('O', 'H', 'O'), ('H', 'H', 'N'),
                     ('C', 'C', 'N'), ('H', 'N', 'H'), ('C', 'H', 'N'),
                     ('H', 'C', 'O'), ('N', 'O', 'O'), ('N', 'N', 'N'),
                     ('C', 'C', 'H'), ('C', 'O', 'O'), ('C', 'N', 'N'),
                     ('H', 'O', 'H'), ('H', 'H', 'O'), ('C', 'C', 'O'),
                     ('N', 'H', 'N'), ('C', 'H', 'O'), ('O', 'C', 'O'),
                     ('H', 'C', 'N'), ('C', 'O', 'C'), ('N', 'O', 'N'),
                     ('N', 'N', 'O'), ('C', 'N', 'O'), ('C', 'O', 'N'),
                     ('H', 'C', 'H'), ('C', 'N', 'H'), ('N', 'H', 'O'),
                     ('N', 'C', 'O')])
     self.assertEqual(a._groups, expected)