def test_inject_feature_simple(self):
        f = Map(Map(F('a'), np.abs), np.abs)
        self.assertEqual(str(f), 'absolute(absolute(a))')
        new_f = inject_feature(f, Map, function=lambda x: x + 1000)
        self.assertEqual(str(new_f), 'absolute(absolute(<lambda>(a)))')

        d, ff = build_feature_safe(new_f, self.data)
        assert_almost_equal(d[d.columns[0]].values, (self.data['a'] + 1000).values)
 def test_inject_feature_combo(self):
     f = Map(F('a') + F('b'), np.abs)
     self.assertEqual(str(f), 'absolute(Add(a, b))')
     new_f = inject_feature(f, Map, function=lambda x: x + 1000)
     # Should inject in
     self.assertEqual(str(new_f), 'absolute(Add(<lambda>(a), <lambda>(b)))')
Exemplo n.º 3
0
 def test_inject_feature_simple(self):
     f = Map(Map(F('a'), np.abs), np.abs)
     self.assertEqual(str(f), 'absolute(absolute(a))')
     new_f = inject_feature(f, Map, function=lambda x: x + 1000)
     self.assertEqual(str(new_f), 'absolute(absolute(<lambda>(a)))')