Skip to content

Commit 0a1637e

Browse files
authored
Merge branch 'main' into mscroggs/jaxArray
2 parents 186b24e + 5d8b744 commit 0a1637e

5 files changed

Lines changed: 16 additions & 9 deletions

File tree

src/causalprog/graph/continuous_treatment.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def continuous_treatment_model(
7979
)
8080
graph.add_node(
8181
ContinuousRandomVariableNode(
82-
label="u_y", compute=compute_u_y, parents=["c", "u_x"]
82+
label="u_y", compute=compute_u_y, parents=["c", "u_x", "l"]
8383
)
8484
)
8585
graph.add_node(
@@ -88,7 +88,9 @@ def continuous_treatment_model(
8888
)
8989
)
9090
graph.add_node(
91-
ContinuousRandomVariableNode(label="y", compute=compute_y, parents=["x", "u_y"])
91+
ContinuousRandomVariableNode(
92+
label="y", compute=compute_y, parents=["x", "u_y", "l"]
93+
)
9294
)
9395

9496
# For now, manually attach nodes as extra attributes.

tests/test_integration/test_continuous_treatment.py/test_build_loss_function.py renamed to tests/test_integration/test_continuous_treatment/test_build_loss_function.py

File renamed without changes.

tests/test_integration/test_continuous_treatment.py/test_causal_response_function.py renamed to tests/test_integration/test_continuous_treatment/test_causal_response_function.py

File renamed without changes.

tests/test_integration/test_continuous_treatment.py/test_continuous_treatment_model.py renamed to tests/test_integration/test_continuous_treatment/test_continuous_treatment_model.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ def test_treatment_model():
1313
compute_y=lambda _data: 1.0,
1414
)
1515
assert len(graph.nodes) == 7
16-
assert len(graph.edges) == 9
16+
assert len(graph.edges) == 11
1717
edges = {(e[0].label, e[1].label) for e in graph.edges}
1818
assert edges == {
1919
("l", "u_x"),
20+
("l", "u_y"),
21+
("l", "x"),
22+
("l", "y"),
2023
("c", "u_y"),
2124
("c", "u_x"),
2225
("u_x", "u_y"),
2326
("u_x", "x"),
24-
("l", "x"),
2527
("z", "x"),
2628
("u_y", "y"),
2729
("x", "y"),
@@ -37,14 +39,14 @@ def test_treatment_model_update():
3739
compute_y=lambda _data: 1.0,
3840
)
3941
assert len(graph.nodes) == 7
40-
assert len(graph.edges) == 9
42+
assert len(graph.edges) == 11
4143

4244
g = replace_node(
4345
graph,
4446
"x",
4547
ContinuousRandomVariableNode(
4648
label="x_updated",
47-
parents=["z", "l"],
49+
parents=["z"],
4850
),
4951
)
5052
updated_graph = replace_node(
@@ -59,26 +61,29 @@ def test_treatment_model_update():
5961
original_edges = {(e[0].label, e[1].label) for e in graph.edges}
6062
assert original_edges == {
6163
("l", "u_x"),
64+
("l", "u_y"),
65+
("l", "x"),
66+
("l", "y"),
6267
("c", "u_y"),
6368
("c", "u_x"),
6469
("u_x", "u_y"),
6570
("u_x", "x"),
66-
("l", "x"),
6771
("z", "x"),
6872
("u_y", "y"),
6973
("x", "y"),
7074
}
7175

7276
assert len(updated_graph.nodes) == 7
73-
assert len(updated_graph.edges) == 9
77+
assert len(updated_graph.edges) == 10
7478
edges = {(e[0].label, e[1].label) for e in updated_graph.edges}
7579
assert edges == {
7680
("l", "u_x_updated"),
7781
("c", "u_y"),
82+
("l", "u_y"),
83+
("l", "y"),
7884
("c", "u_x_updated"),
7985
("u_x_updated", "u_y"),
8086
("x_updated", "u_x_updated"),
81-
("l", "x_updated"),
8287
("z", "x_updated"),
8388
("u_y", "y"),
8489
("x_updated", "y"),

tests/test_integration/test_continuous_treatment.py/test_regression_function.py renamed to tests/test_integration/test_continuous_treatment/test_regression_function.py

File renamed without changes.

0 commit comments

Comments
 (0)