Skip to content

Commit 269ac4f

Browse files
authored
Preparing version v. 0.7.3 (#289)
* Bump version * update api-docs * update sphinx-convert docs
1 parent 33a7a88 commit 269ac4f

9 files changed

+81
-79
lines changed

CHANGELOG.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Changelog
22
=========
33

4-
dev
5-
---
4+
0.7.3 (2018-08-30)
5+
------------------
66
- Fix bug in plot_pairs which crashes in case of 1 parameter
77
- Fix bug in plot_marginals which outputs empty plots in case where we have parameter more than 5
88
- Fix crashing summary and plots for samples with multivariate priors

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**Version 0.7.2 released!** See the CHANGELOG and [notebooks](https://github.com/elfi-dev/notebooks).
1+
**Version 0.7.3 released!** See the CHANGELOG and [notebooks](https://github.com/elfi-dev/notebooks).
22

33
**NOTE:** For the time being NetworkX 2 is incompatible with ELFI.
44

@@ -13,10 +13,10 @@ ELFI - Engine for Likelihood-Free Inference
1313

1414
<img src="https://cloud.githubusercontent.com/assets/1233418/20178983/6e22ee44-a75c-11e6-8345-5934b55b9dc6.png" width="15%" align="right"></img>
1515

16-
ELFI is a statistical software package written in Python for likelihood-free inference (LFI) such as Approximate
17-
Bayesian Computation ([ABC](https://en.wikipedia.org/wiki/Approximate_Bayesian_computation)).
18-
The term LFI refers to a family of inference methods that replace the use of the likelihood function with a data
19-
generating simulator function. ELFI features an easy to use generative modeling syntax and supports parallelized
16+
ELFI is a statistical software package written in Python for likelihood-free inference (LFI) such as Approximate
17+
Bayesian Computation ([ABC](https://en.wikipedia.org/wiki/Approximate_Bayesian_computation)).
18+
The term LFI refers to a family of inference methods that replace the use of the likelihood function with a data
19+
generating simulator function. ELFI features an easy to use generative modeling syntax and supports parallelized
2020
inference out of the box.
2121

2222
Currently implemented LFI methods:
@@ -32,8 +32,8 @@ ELFI also integrates tools for visualization, model comparison, diagnostics and
3232

3333
See examples under [notebooks](https://github.com/elfi-dev/notebooks) to get started. Full
3434
documentation can be found at http://elfi.readthedocs.io/. Limited user-support may be
35-
asked from elfi-support.at.hiit.fi, but the
36-
[Gitter chat](https://gitter.im/elfi-dev/elfi?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
35+
asked from elfi-support.at.hiit.fi, but the
36+
[Gitter chat](https://gitter.im/elfi-dev/elfi?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
3737
is preferable.
3838

3939

@@ -48,9 +48,9 @@ pip install elfi
4848
or on some platforms using Python 3 specific syntax:
4949
```
5050
pip3 install elfi
51-
```
51+
```
5252

53-
Note that in some environments you may need to first install `numpy` with
53+
Note that in some environments you may need to first install `numpy` with
5454
`pip install numpy`. This is due to our dependency to `GPy` that uses `numpy` in its installation.
5555

5656
### Optional dependencies
@@ -88,11 +88,11 @@ docker run -it elfi
8888

8989
### Potential problems with installation
9090

91-
ELFI depends on several other Python packages, which have their own dependencies.
91+
ELFI depends on several other Python packages, which have their own dependencies.
9292
Resolving these may sometimes go wrong:
9393
- If you receive an error about missing `numpy`, please install it first.
9494
- If you receive an error about `yaml.load`, install `pyyaml`.
95-
- On OS X with Anaconda virtual environment say `conda install python.app` and then use
95+
- On OS X with Anaconda virtual environment say `conda install python.app` and then use
9696
`pythonw` instead of `python`.
9797
- Note that ELFI requires Python 3.5 or greater so try `pip3 install elfi`.
9898
- Make sure your Python installation meets the versions listed in `requirements.txt`.

docs/api.rst

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Below is the API for creating generative models.
3838

3939
.. autosummary::
4040
elfi.draw
41+
elfi.plot_params_vs_node
4142

4243
Inference API
4344
-------------
@@ -177,6 +178,8 @@ Modelling API classes
177178

178179
.. autofunction:: elfi.draw
179180

181+
.. autofunction:: elfi.plot_params_vs_node
182+
180183
.. This would show undocumented members :undoc-members:
181184
182185

docs/quickstart.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ for the standard deviation ``sigma``. All distributions from
2828
For likelihood-free models we typically need to define a simulator and
2929
summary statistics for the data. As an example, lets define the
3030
simulator as 30 draws from a Gaussian distribution with a given mean and
31-
standard deviation. Let's use mean and variance as our summaries:
31+
standard deviation. Lets use mean and variance as our summaries:
3232

3333
.. code:: ipython3
3434
@@ -125,7 +125,7 @@ posterior using threshold value 0.5:
125125
126126
127127
128-
Let's plot also the marginal distributions for the parameters:
128+
Lets plot also the marginal distributions for the parameters:
129129

130130
.. code:: ipython3
131131

docs/usage/BOLFI.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ initialize the GP model with a dictionary of previous results by giving
101101

102102
The BOLFI class can now try to ``fit`` the surrogate model (the GP) to
103103
the relationship between parameter values and the resulting
104-
discrepancies. We'll request only 100 evidence points (including the
104+
discrepancies. Well request only 100 evidence points (including the
105105
``initial_evidence`` defined above).
106106

107107
.. code:: ipython3
@@ -263,7 +263,7 @@ is a sophisticated algorithm, and in some cases one may get warnings
263263
about diverged proposals, which are signs that `something may be wrong
264264
and should be
265265
investigated <http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup>`__.
266-
It is good to understand the cause of these warnings although they don't
266+
It is good to understand the cause of these warnings although they dont
267267
automatically mean that the results are unreliable. You could try
268268
rerunning the ``sample`` method with a higher target probability
269269
``target_prob`` during adaptation, as its default 0.6 may be inadequate

docs/usage/external.rst

+23-23
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ If your simulator or other operations are implemented in a programming
1010
language other than Python, you can still use ELFI. This notebook
1111
briefly demonstrates how to do this in three common scenarios:
1212

13-
- External executable (written e.g. in C++ or a shell script)
13+
- External executable (written e.g. in C++ or a shell script)
1414
- R function
1515
- MATLAB function
1616

17-
Let's begin by importing some libraries that we will be using:
17+
Lets begin by importing some libraries that we will be using:
1818

1919
.. code:: ipython3
2020
@@ -43,7 +43,7 @@ introduced in this tutorial.
4343

4444
We demonstrate here how to wrap executables as ELFI nodes. We will first
4545
use ``elfi.tools.external_operation`` tool to wrap executables as a
46-
Python callables (function). Let's first investigate how it works with a
46+
Python callables (function). Lets first investigate how it works with a
4747
simple shell ``echo`` command:
4848

4949
.. code:: ipython3
@@ -64,7 +64,7 @@ simple shell ``echo`` command:
6464
6565
6666
67-
The placeholders for arguments in the command string are just Python's
67+
The placeholders for arguments in the command string are just Pythons
6868
```format strings`` <https://docs.python.org/3/library/string.html#formatstrings>`__.
6969

7070
Currently ``echo_sim`` only accepts scalar arguments. In order to work
@@ -103,16 +103,16 @@ Complex external operations :math:`-` case BDM
103103
----------------------------------------------
104104

105105
To provide a more realistic example of external operations, we will
106-
consider the Birth-Death-Mutation (BDM) model used in `*Lintusaari at al
107-
2016* <https://doi.org/10.1093/sysbio/syw077>`__ *[1]*.
106+
consider the Birth-Death-Mutation (BDM) model used in `Lintusaari at al
107+
2016 <https://doi.org/10.1093/sysbio/syw077>`__ *[1]*.
108108

109109
Birth-Death-Mutation process
110110
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111111

112112
We will consider here the Birth-Death-Mutation process simulator
113113
introduced in *Tanaka et al 2006 [2]* for the spread of Tuberculosis.
114114
The simulator outputs a count vector where each of its elements
115-
represents a "mutation" of the disease and the count describes how many
115+
represents a mutation of the disease and the count describes how many
116116
are currently infected by that mutation. There are three rates and the
117117
population size:
118118

@@ -128,8 +128,8 @@ population size:
128128
It is assumed that the susceptible population is infinite, the hosts
129129
carry only one mutation of the disease and transmit that mutation
130130
onward. A more accurate description of the model can be found from the
131-
original paper or e.g. `*Lintusaari at al
132-
2016* <https://doi.org/10.1093/sysbio/syw077>`__ *[1]*.
131+
original paper or e.g. `Lintusaari at al
132+
2016 <https://doi.org/10.1093/sysbio/syw077>`__ *[1]*.
133133

134134
.. For documentation
135135
@@ -140,8 +140,8 @@ original paper or e.g. `*Lintusaari at al
140140

141141
This simulator cannot be implemented effectively with vectorized
142142
operations so we have implemented it with C++ that handles loops
143-
efficiently. We will now reproduce Figure 6(a) in `*Lintusaari at al
144-
2016* <https://doi.org/10.1093/sysbio/syw077>`__ *[2]* with ELFI. Let's
143+
efficiently. We will now reproduce Figure 6(a) in `Lintusaari at al
144+
2016 <https://doi.org/10.1093/sysbio/syw077>`__ *[2]* with ELFI. Lets
145145
start by defining some constants:
146146

147147
.. code:: ipython3
@@ -154,7 +154,7 @@ start by defining some constants:
154154
# The zeros are to make the observed population vector have length N
155155
y_obs = np.array([6, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype='int16')
156156
157-
Let's build the beginning of a new model for the birth rate
157+
Lets build the beginning of a new model for the birth rate
158158
:math:`\alpha` as the only unknown
159159

160160
.. code:: ipython3
@@ -214,8 +214,8 @@ thousands of simulations. We will also here redirect the output to a
214214
file and then read the file into a numpy array.
215215

216216
This is just one possibility among the many to implement this. The most
217-
efficient would be to write a native Python module with C++ but it's
218-
beyond the scope of this article. So let's work through files which is a
217+
efficient would be to write a native Python module with C++ but its
218+
beyond the scope of this article. So lets work through files which is a
219219
fairly common situation especially with existing software.
220220

221221
.. code:: ipython3
@@ -265,7 +265,7 @@ fairly common situation especially with existing software.
265265
process_result=process_result,
266266
stdout=False)
267267
268-
Now let's replace the echo simulator with this. To create unique but
268+
Now lets replace the echo simulator with this. To create unique but
269269
informative filenames, we ask ELFI to provide the operation some meta
270270
information. That will be available under the ``meta`` keyword (see the
271271
``prepare_inputs`` function above):
@@ -306,9 +306,9 @@ Completing the BDM model
306306
~~~~~~~~~~~~~~~~~~~~~~~~
307307

308308
We are now ready to finish up the BDM model. To reproduce Figure 6(a) in
309-
`*Lintusaari at al 2016* <https://doi.org/10.1093/sysbio/syw077>`__
310-
*[2]*, let's add different summaries and discrepancies to the model and
311-
run the inference for each of them:
309+
`Lintusaari at al 2016 <https://doi.org/10.1093/sysbio/syw077>`__ *[2]*,
310+
lets add different summaries and discrepancies to the model and run the
311+
inference for each of them:
312312

313313
.. code:: ipython3
314314
@@ -421,7 +421,7 @@ the functionality of R from within Python. You can install it with
421421
``pip install rpy2``.
422422

423423
Here we demonstrate how to calculate the summary statistics used in the
424-
ELFI tutorial (autocovariances) using R's ``acf`` function for the MA2
424+
ELFI tutorial (autocovariances) using Rs ``acf`` function for the MA2
425425
model.
426426

427427
.. code:: ipython3
@@ -436,7 +436,7 @@ model.
436436

437437
.. _issue: https://github.com/ContinuumIO/anaconda-issues/issues/152
438438

439-
Let's create a Python function that wraps the R commands (please see the
439+
Lets create a Python function that wraps the R commands (please see the
440440
documentation of `rpy2 <http://rpy2.readthedocs.io>`__ for details):
441441

442442
.. code:: ipython3
@@ -600,7 +600,7 @@ Replace the summaries S1 and S2 with our R autocovariance function.
600600
601601
602602
603-
Finally, don't forget to quit the MATLAB session:
603+
Finally, dont forget to quit the MATLAB session:
604604

605605
.. code:: ipython3
606606
@@ -625,6 +625,6 @@ References
625625
Kaski, Jukka Corander; Fundamentals and Recent Developments in
626626
Approximate Bayesian Computation. Syst Biol 2017; 66 (1): e66-e82.
627627
doi: 10.1093/sysbio/syw077
628-
- [2] Tanaka, Mark M., et al. "Using approximate Bayesian computation
629-
to estimate tuberculosis transmission parameters from genotype data."
628+
- [2] Tanaka, Mark M., et al. Using approximate Bayesian computation
629+
to estimate tuberculosis transmission parameters from genotype data.
630630
Genetics 173.3 (2006): 1511-1520.

docs/usage/parallelization.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ inference via different clients. Currently ELFI includes three clients:
1212
- ``elfi.clients.native`` (activated by default): does not parallelize
1313
but makes it easy to test and debug your code.
1414
- ``elfi.clients.multiprocessing``: basic local parallelization using
15-
Python's built-in multiprocessing library
15+
Pythons built-in multiprocessing library
1616
- ``elfi.clients.ipyparallel``:
1717
`ipyparallel <http://ipyparallel.readthedocs.io/>`__ based client
1818
that can parallelize from multiple cores up to a distributed cluster.
@@ -24,15 +24,15 @@ This tutorial shows how to activate and use the ``multiprocessing`` or
2424
``ipyparallel`` client with ELFI. The ``ipyparallel`` client supports
2525
parallelization from local computer up to a cluster environment. For
2626
local parallelization however, the ``multiprocessing`` client is simpler
27-
to use. Let's begin by importing ELFI and our example MA2 model from the
27+
to use. Lets begin by importing ELFI and our example MA2 model from the
2828
tutorial.
2929

3030
.. code:: ipython3
3131
3232
import elfi
3333
from elfi.examples import ma2
3434
35-
Let's get the model and plot it (requires graphviz)
35+
Lets get the model and plot it (requires graphviz)
3636

3737
.. code:: ipython3
3838
@@ -57,7 +57,7 @@ in your computer. You can activate it simply by
5757
elfi.set_client('multiprocessing')
5858
5959
Any inference instance created **after** you have set the new client
60-
will automatically use it to perform the computations. Let's try it with
60+
will automatically use it to perform the computations. Lets try it with
6161
our MA2 example model from the tutorial. When running the next command,
6262
take a look at the system monitor of your operating system; it should
6363
show that all of your cores are doing heavy computation simultaneously.
@@ -197,14 +197,14 @@ Working interactively with ipyparallel
197197
--------------------------------------
198198

199199
If you are using the ``ipyparallel`` client from an interactive
200-
environment (e.g. jupyter notebook) there are some things to take care
200+
environment (e.g. jupyter notebook) there are some things to take care
201201
of. All imports and definitions must be visible to all ``ipyparallel``
202202
engines. You can ensure this by writing a script file that has all the
203203
definitions in it. In a distributed setting, this file must be present
204204
in all remote workers running an ``ipyparallel`` engine.
205205

206206
However, you may wish to experiment in an interactive session, using
207-
e.g. a jupyter notebook. ``ipyparallel`` makes it possible to
207+
e.g. a jupyter notebook. ``ipyparallel`` makes it possible to
208208
interactively define functions for ELFI model and send them to workers.
209209
This is especially useful if you work from a jupyter notebook. We will
210210
show a few examples. More information can be found from ```ipyparallel``
@@ -220,7 +220,7 @@ functionality without problems:
220220
rej2 = elfi.Rejection(d2, batch_size=10000)
221221
result2 = rej2.sample(1000, quantile=0.01)
222222
223-
But let's say you want to use your very own distance function in a
223+
But lets say you want to use your very own distance function in a
224224
jupyter notebook:
225225

226226
.. code:: ipython3

0 commit comments

Comments
 (0)