コード例 #1
0
ファイル: test_atom.py プロジェクト: zizai/molml
 def test_transform(self):
     a = LocalEncodedBond()
     a.fit(ALL_DATA)
     m = a.transform(ALL_DATA)
     expected_results = numpy.array(
         [17.068978019300587, 54.629902544876572, 1006.4744899075993])
     mm = numpy.array([x.sum() for x in m])
     self.assertTrue((numpy.allclose(mm, expected_results)))
コード例 #2
0
ファイル: test_atom.py プロジェクト: crcollins/molml
 def test_transform(self):
     a = LocalEncodedBond()
     a.fit(ALL_DATA)
     m = a.transform(ALL_DATA)
     expected_results = numpy.array([17.068978019300587,
                                     54.629902544876572,
                                     1006.4744899075993])
     mm = numpy.array([x.sum() for x in m])
     self.assertTrue((numpy.allclose(mm, expected_results)))
コード例 #3
0
ファイル: test_atom.py プロジェクト: zizai/molml
 def test_transform_max_depth1(self):
     a = LocalEncodedBond(max_depth=1)
     a.fit(ALL_DATA)
     m = a.transform(ALL_DATA)
     expected_results = numpy.array([6.82758723, 6.82758018, 88.75860423])
     mm = numpy.array([x.sum() for x in m])
     try:
         numpy.testing.assert_allclose(mm, expected_results)
     except AssertionError as e:
         self.fail(e)
コード例 #4
0
ファイル: test_atom.py プロジェクト: crcollins/molml
 def test_transform_max_depth1(self):
     a = LocalEncodedBond(max_depth=1)
     a.fit(ALL_DATA)
     m = a.transform(ALL_DATA)
     expected_results = numpy.array([6.82758723,
                                     6.82758018,
                                     88.75860423])
     mm = numpy.array([x.sum() for x in m])
     try:
         numpy.testing.assert_allclose(mm, expected_results)
     except AssertionError as e:
         self.fail(e)
コード例 #5
0
ファイル: test_atom.py プロジェクト: zizai/molml
    def test_small_to_large(self):
        a = LocalEncodedBond()
        a.fit([METHANE])

        # This is a cheap test to prevent needing all the values here
        expected_results = numpy.array([
            0.016125813269,  # mean
            0.065471987297,  # std
            0.,  # min
            0.398807098298,  # max
            29.02646388512,  # sum
        ])
        try:
            m = a.transform([MID])
            val = numpy.array([
                m.mean(),
                m.std(),
                m.min(),
                m.max(),
                m.sum(),
            ])
            numpy.testing.assert_allclose(val, expected_results)
        except AssertionError as e:
            self.fail(e)
コード例 #6
0
ファイル: test_atom.py プロジェクト: crcollins/molml
    def test_small_to_large(self):
        a = LocalEncodedBond()
        a.fit([METHANE])

        # This is a cheap test to prevent needing all the values here
        expected_results = numpy.array([
            0.016125813269,  # mean
            0.065471987297,  # std
            0.,              # min
            0.398807098298,  # max
            29.02646388512,  # sum
        ])
        try:
            m = a.transform([MID])
            val = numpy.array([
                m.mean(),
                m.std(),
                m.min(),
                m.max(),
                m.sum(),
            ])
            numpy.testing.assert_allclose(val, expected_results)
        except AssertionError as e:
            self.fail(e)
コード例 #7
0
ファイル: test_atom.py プロジェクト: zizai/molml
 def test_add_unknown(self):
     a = LocalEncodedBond(add_unknown=True)
     a.fit([METHANE])
     m = a.transform([MID])
     self.assertEqual(m.shape, (1, 9, 300))
コード例 #8
0
ファイル: test_atom.py プロジェクト: zizai/molml
 def test_transform_before_fit(self):
     a = LocalEncodedBond()
     with self.assertRaises(ValueError):
         a.transform(ALL_DATA)
コード例 #9
0
ファイル: test_atom.py プロジェクト: crcollins/molml
 def test_add_unknown(self):
     a = LocalEncodedBond(add_unknown=True)
     a.fit([METHANE])
     m = a.transform([MID])
     self.assertEqual(m.shape, (1, 9, 300))
コード例 #10
0
ファイル: test_atom.py プロジェクト: crcollins/molml
 def test_transform_before_fit(self):
     a = LocalEncodedBond()
     with self.assertRaises(ValueError):
         a.transform(ALL_DATA)