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)))
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)))
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)
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)
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)
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)
def test_add_unknown(self): a = LocalEncodedBond(add_unknown=True) a.fit([METHANE]) m = a.transform([MID]) self.assertEqual(m.shape, (1, 9, 300))
def test_fit(self): a = LocalEncodedBond() a.fit(ALL_DATA) self.assertEqual(a._elements, (('C', ), ('H', ), ('N', ), ('O', )))
def test_add_unknown(self): a = LocalEncodedBond(add_unknown=True) a.fit([METHANE]) m = a.transform([MID]) self.assertEqual(m.shape, (1, 9, 300))
def test_fit(self): a = LocalEncodedBond() a.fit(ALL_DATA) self.assertEqual(a._elements, ('C', 'H', 'N', 'O'))
def test_fit(self): a = LocalEncodedBond() a.fit(ALL_DATA) self.assertEqual(a._elements, set(['N', 'C', 'O', 'H']))