Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions causing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def create_indiv(m: Model, xdat, show_nr_indiv: int) -> dict:
data for tests cases. Otherwise, use `Model.calc_effects` directly.
"""
eff = m.calc_effects(xdat)
for key in ["exj_indivs", "eyj_indivs", "eyx_indivs", "eyy_indivs"]:
if key in ["exj_indivs", "eyj_indivs"]:
for key in ["xnodeeffects", "ynodeeffects", "xedgeeffects", "yedgeeffects"]:
if key in ["xnodeeffects", "ynodeeffects"]:
eff[key] = eff[key][:, :show_nr_indiv]
else:
eff[key] = eff[key][:show_nr_indiv]
Expand Down
10 changes: 5 additions & 5 deletions causing/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ def annotated_graphs(
) -> Iterable[networkx.DiGraph]:
"""Return DiGraphs with all information required to draw IME graphs"""
if ids is None:
ids = [str(i + 1) for i in range(len(graph_json["eyx_indivs"]))]
ids = [str(i + 1) for i in range(len(graph_json["xedgeeffects"]))]
for graph_id, exj, eyj, eyx, eyy in zip(
ids,
np.array(graph_json["exj_indivs"]).T,
np.array(graph_json["eyj_indivs"]).T,
graph_json["eyx_indivs"],
graph_json["eyy_indivs"],
np.array(graph_json["xnodeeffects"]).T,
np.array(graph_json["ynodeeffects"]).T,
graph_json["xedgeeffects"],
graph_json["yedgeeffects"],
):
g = m.graph.copy()
g.graph["id"] = graph_id
Expand Down
8 changes: 4 additions & 4 deletions causing/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ def calc_effects(self, xdat: np.array, xdat_mean=None, yhat_mean=None):
# model results
"yhat": yhat,
# nodes
"exj_indivs": exj,
"eyj_indivs": eyj,
"xnodeeffects": exj,
"ynodeeffects": eyj,
# edges
"eyx_indivs": eyx,
"eyy_indivs": eyy,
"xedgeeffects": eyx,
"yedgeeffects": eyy,
}

@cached_property
Expand Down
Loading