forked from Tobias-Kohn/PyFOPPL-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
33 lines (27 loc) · 884 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Setup the FOPPL-compiler and auto-importer:
from foppl import Options, imports
# Print additional information:
Options.debug = True
# Import and compile the model:
import onegauss as foppl_model
# Print out the entire model:
print(foppl_model.model)
print("=" * 30)
print("CODE")
print(foppl_model.model.gen_prior_samples_code)
print("-" * 30)
print(foppl_model.model.gen_pdf_code)
print("-" * 30)
# A sample run with the model:
print("=" * 30)
state = foppl_model.model.gen_prior_samples()
print("-" * 30)
for i in range(10):
state['log_pdf'] = 0.0
pdf = foppl_model.model.gen_pdf(state)
print("Result: {}\nLog-PDF: {}".format(foppl_model.model.get_result(state), pdf))
print("=" * 30)
state = foppl_model.model.transform_state(state, samples_only=True)
for key in sorted(state.keys()):
print("{} -> {}".format(key, state[key]))
foppl_model.model.display_graph()