Closed priamai closed 8 months ago
Never mind found the solution is simple:
# print estimated causal graph
graph_est={n:[] for n in result.keys()}
for key in result.keys():
parents = result[key]['parents']
graph_est[key].extend(parents)
print(f'{key}: {parents}')
and then
plot_graph(graph_est, node_size=1000)
for i, n in enumerate(var_names):
plt.plot(data_trans[-100:,i], label=n)
plt.legend()
plt.legend()
plt.show()
Hi there, I am following the example code and I think there is a missing functionality to make it easier to use. Let me explain, at some point in the code we do this:
The result is a dict with parents and p_dict and value keys. I now want to plot the DAG like in the other example code:
This fails of course because the structure doesn't follow the schema of the example with graph_gt:
data_array, var_names, graph_gt = DataGenerator(sem, T=T, seed=0)
So my question is there an utility function that converts the result object dict into a graph_gt like dict?
Thanks.