@@ -7,15 +7,15 @@ First ensure you have
77Python 3.5 (or greater) and ELFI. After installation you can start using
88ELFI:
99
10- .. code :: python
10+ .. code :: ipython3
1111
1212 import elfi
1313
1414 ELFI includes an easy to use generative modeling syntax, where the
1515generative model is specified as a directed acyclic graph (DAG). Let’s
1616create two prior nodes:
1717
18- .. code :: python
18+ .. code :: ipython3
1919
2020 mu = elfi.Prior('uniform', -2, 4)
2121 sigma = elfi.Prior('uniform', 1, 4)
@@ -30,7 +30,7 @@ summary statistics for the data. As an example, lets define the
3030simulator as 30 draws from a Gaussian distribution with a given mean and
3131standard deviation. Let's use mean and variance as our summaries:
3232
33- .. code :: python
33+ .. code :: ipython3
3434
3535 import scipy.stats as ss
3636 import numpy as np
@@ -48,7 +48,7 @@ standard deviation. Let's use mean and variance as our summaries:
4848 Let’s now assume we have some observed data ``y0 `` (here we just create
4949some with the simulator):
5050
51- .. code :: python
51+ .. code :: ipython3
5252
5353 # Set the generating parameters that we will try to infer
5454 mean0 = 1
@@ -73,7 +73,7 @@ Now we have all the components needed. Let’s complete our model by
7373adding the simulator, the observed data, summaries and a distance to our
7474model:
7575
76- .. code :: python
76+ .. code :: ipython3
7777
7878 # Add the simulator node and observed data to the model
7979 sim = elfi.Simulator(simulator, mu, sigma, observed=y0)
@@ -89,15 +89,15 @@ model:
8989 If you have ``graphviz `` installed to your system, you can also
9090visualize the model:
9191
92- .. code :: python
92+ .. code :: ipython3
9393
9494 # Plot the complete model (requires graphviz)
9595 elfi.draw(d)
9696
9797
9898
9999
100- .. image :: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.1 /quickstart_files/quickstart_11_0.svg
100+ .. image :: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2 /quickstart_files/quickstart_11_0.svg
101101
102102
103103
@@ -108,7 +108,7 @@ We can try to infer the true generating parameters ``mean0`` and
108108Rejection sampling and sample 1000 samples from the approximate
109109posterior using threshold value 0.5:
110110
111- .. code :: python
111+ .. code :: ipython3
112112
113113 rej = elfi.Rejection(d, batch_size=10000, seed=30052017)
114114 res = rej.sample(1000, threshold=.5)
@@ -127,13 +127,13 @@ posterior using threshold value 0.5:
127127
128128 Let's plot also the marginal distributions for the parameters:
129129
130- .. code :: python
130+ .. code :: ipython3
131131
132132 import matplotlib.pyplot as plt
133133 res.plot_marginals()
134134 plt.show()
135135
136136
137137
138- .. image :: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.1 /quickstart_files/quickstart_16_0.png
138+ .. image :: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2 /quickstart_files/quickstart_16_0.png
139139
0 commit comments