From 819ed5e632cd025a72e7ee47c9e27fb1dda5b96c Mon Sep 17 00:00:00 2001 From: Henri Vuollekoski Date: Fri, 19 May 2017 10:09:08 +0300 Subject: [PATCH] Add example script of running MA2 (#160) --- scripts/MA2_run.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/MA2_run.py diff --git a/scripts/MA2_run.py b/scripts/MA2_run.py new file mode 100644 index 00000000..66f0d8ed --- /dev/null +++ b/scripts/MA2_run.py @@ -0,0 +1,19 @@ +import matplotlib.pyplot as plt + +import elfi +from elfi.examples import ma2 + + +# load the model from elfi.examples +model = ma2.get_model() + +# setup and run rejection sampling +rej = elfi.Rejection(model['d'], batch_size=10000) +result = rej.sample(1000, quantile=0.01) + +# show summary of results on stdout +result.summary + +# save a figure of results +result.plot_pairs() +plt.savefig('ma2.png')