Skip to content

Commit 5066e4f

Browse files
committed
Another test
1 parent ec079b4 commit 5066e4f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/estimation_tests/test_genetic_programming_regression_fitter.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
from causal_testing.estimation.genetic_programming_regression_fitter import GP
66

77

8+
def root(x):
9+
return x**0.5
10+
11+
812
class TestGP(unittest.TestCase):
913
def test_init_invalid_fun_name(self):
1014
with self.assertRaises(ValueError):
@@ -27,3 +31,13 @@ def test_fitness_string(self):
2731
max_order=0,
2832
)
2933
self.assertEquals(gp.fitness("add(x1, 1)"), (0,))
34+
35+
def test_fitness_inf(self):
36+
gp = GP(
37+
df=pd.DataFrame({"x1": [-1], "outcome": [0]}),
38+
features=["x1"],
39+
outcome="outcome",
40+
max_order=0,
41+
extra_operators=[(root, 1)],
42+
)
43+
self.assertEquals(gp.fitness("root(x1)"), (float("inf"),))

0 commit comments

Comments
 (0)