<jupyter_start><jupyter_text>Initialize Graph from BEL Statements<jupyter_code>str_list = ['temp =| cloudy','cloudy => rainy','temp => icream','rainy =| icream']
type_dict = {}
type_dict['temp'] = 'continuous'
type_dict['cloudy'] = 'continuous'
type_dict['rainy'] = 'continuous'
type_dict['icream'] = 'continuous'

graph_test = cg.cg_graph(str_list=str_list,type_dict=type_dict,only_creases=False)<jupyter_output>The causal graph is a acyclic<jupyter_text>Initialize Graph from json File<jupyter_code>graph_test = cg.cg_graph(json_file='icream.txt',type_dict=type_dict)<jupyter_output><empty_output><jupyter_text>Initialize Graph from PyBEL graph<jupyter_code>bel_temp = pb.from_bel_script('sag_bel_graph.txt')
graph_test = cg.cg_graph(bel_graph=bel_temp)<jupyter_output><empty_output><jupyter_text>Test Various Graph Capabilities  Write to file that Can be Read by Causal Fusion<jupyter_code>graph_test.write_to_cf('test',100)<jupyter_output><empty_output><jupyter_text>Initialize Graph Probabilities<jupyter_code>graph_test.prob_init(tot_data)
print(graph_test.exog_list)<jupyter_output>temp<jupyter_text>Inspect Graph Properties<jupyter_code>for item in graph_test.node_dict:
    print(item)
    print(graph_test.node_dict[item].name)
    print(graph_test.node_dict[item].node_type)
    print()
for item in graph_test.node_dict:
    print(graph_test.node_dict[item].alpha_j)
    print(graph_test.node_dict[item].alpha_jk)
    print(graph_test.node_dict[item].beta_j)
    print(graph_test.node_dict[item].beta_jk)
    print()<jupyter_output><empty_output><jupyter_text>Sample the Graph under Various Situations<jupyter_code>graph_test.model_sample()
cond_dict = {}
cond_dict['cloudy'] = torch.Tensor([0.5])

cond_test = graph_test.model_cond_sample(cond_dict)

for item in cond_test:
    print(item)
    print(cond_test[item])
    print()
do_dict = {}
do_dict['rainy'] = torch.Tensor([2.5])

do_test = graph_test.model_do_sample(do_dict)

for item in do_test:
    print(item)
    print(do_test[item])
    print()


do_cond_test = graph_test.model_do_cond_sample(do_dict,cond_dict)
for item in do_cond_test:
    print(item)
    print(do_cond_test[item])
    print()
obs_dict = {}
obs_dict['icream'] = torch.Tensor([0.5])
obs_dict['rainy'] = torch.Tensor([0.8])

do_dict = {}
do_dict['rainy'] = torch.Tensor([1.5])


counter_test = graph_test.model_counterfact(obs_dict,do_dict)
for item in counter_test:
    print(item)
    print(counter_test[item])
    print()<jupyter_output><empty_output><jupyter_text>Do Statistical Tests on Data and Model<jupyter_code>print(graph_test.cond_mut_info(['icream'],['rainy'],['temp'],tot_data))
a = graph_test.g_test(['icream'],tot_data)
print(a)<jupyter_output><empty_output><jupyter_text>Calculate Various Effect Levels<jupyter_code>do_dict1 = {}
do_dict1['cloudy'] = torch.tensor([0.9])
do_dict2 = {}
do_dict2['cloudy'] = torch.tensor([0.1])

target = ['icream']

print(graph_test.tot_effect(target,do_dict1,do_dict2,10000))
do_dict3 = {}
do_dict3['rainy'] = torch.tensor([2.5])
do_dict4 = {}
do_dict4['rainy'] = torch.tensor([0.5])

med_dict = {}
med_dict['temp'] = torch.tensor([25.0])

print(graph_test.cd_effect(target,do_dict3,do_dict4,med_dict,10000))
print(graph_test.nd_effect(target,do_dict1,do_dict2,10000))
print(graph_test.ni_effect(target,do_dict1,do_dict2,10000))<jupyter_output>{'icream': -0.08084563648935778}
{'fraction_non_alphanumeric': 0.14272970561998216, 'fraction_numerical': 0.0231935771632471, 'mean_word_length': 8.241758241758241, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '211656', 'license': 'MIT', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1305, 'n_words': 160, 'path': 'Example Use Cases.ipynb', 'repo_name': 'cthoyt-forks-and-packages/bel2scm', 'size': '3363'}