Skip to content

Commit

Permalink
Merge pull request #276 from elfi-dev/dev
Browse files Browse the repository at this point in the history
Release 0.7.2
  • Loading branch information
vuolleko committed Jun 20, 2018
2 parents b5807b1 + e6ed1d6 commit ce02414
Show file tree
Hide file tree
Showing 20 changed files with 1,017 additions and 86 deletions.
106 changes: 106 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# IDE settings
.idea

# Byte-compiled / optimized / DLL files
**/__pycache__
*.py[cod]
*$py.class

# C/C++ extensions
*.so
*.bin

# Distribution / packaging
.Python
env
build
develop-eggs
dist
downloads
eggs
.eggs
lib
lib64
parts
sdist
var
*.egg-info
.installed.cfg
*.egg

# Images
*.png
*.svg
*.jpg
*.jpeg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*cover
.hypothesis

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build

# PyBuilder
target

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv
ENV
.venv

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# Editor temp files
*~
*.swo
*.swp

6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

0.7.2 (2018-06-20)
------------------
- Added support for kwargs in elfi.set_client
- Added new example: inference of transmission dynamics of bacteria in daycare centers
- Added new example: Lorenz model

0.7.1 (2018-04-11)
------------------
- Implemented model selection (elfi.compare_models). See API documentation.
Expand Down
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.6

RUN apt-get update && apt-get install -y graphviz

WORKDIR /elfi
ADD . /elfi

RUN pip install numpy graphviz
RUN pip install -e .
RUN pip install -r requirements-dev.txt

# matplotlib unable to show figures
RUN mkdir -p /root/.config/matplotlib
RUN echo "backend : Agg" >> /root/.config/matplotlib/matplotlibrc

CMD ["/bin/bash"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ lint: ## check style with flake8
flake8 elfi tests

test: ## run tests quickly with the default Python
PYTHONPATH=$$PYTHONPATH:. py.test
PYTHONPATH=$$PYTHONPATH:. py.test --reruns 1

test-all: ## run tests on every Python version with tox
tox
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**Version 0.7.1 released!** See the CHANGELOG and [notebooks](https://github.com/elfi-dev/notebooks).
**Version 0.7.2 released!** See the CHANGELOG and [notebooks](https://github.com/elfi-dev/notebooks).

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

Expand Down Expand Up @@ -75,6 +75,17 @@ source activate elfi
pip install elfi
```

### Docker container

A simple Dockerfile for command-line interface is also provided. Please see [Docker documentation](https://docs.docker.com/).

```
git clone --depth 1 https://github.com/elfi-dev/elfi.git
cd elfi
docker build -t elfi .
docker run -it elfi
```

### Potential problems with installation

ELFI depends on several other Python packages, which have their own dependencies.
Expand All @@ -94,9 +105,9 @@ If you wish to cite ELFI, please use the paper in [arXiv](https://arxiv.org/abs/

```
@misc{1708.00707,
Author = {Jarno Lintusaari and Henri Vuollekoski and Antti Kangasrääsiö and Kusti Skytén and Marko Järvenpää and Michael Gutmann and Aki Vehtari and Jukka Corander and Samuel Kaski},
Author = {Jarno Lintusaari and Henri Vuollekoski and Antti Kangasrääsiö and Kusti Skytén and Marko Järvenpää and Pekka Marttinen and Michael Gutmann and Aki Vehtari and Jukka Corander and Samuel Kaski},
Title = {ELFI: Engine for Likelihood Free Inference},
Year = {2017},
Year = {2018},
Eprint = {arXiv:1708.00707},
}
```
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ If you wish to cite ELFI, please use the paper in arXiv_:
.. code-block:: console
@misc{1708.00707,
Author = {Jarno Lintusaari and Henri Vuollekoski and Antti Kangasrääsiö and Kusti Skytén and Marko Järvenpää and Michael Gutmann and Aki Vehtari and Jukka Corander and Samuel Kaski},
Author = {Jarno Lintusaari and Henri Vuollekoski and Antti Kangasrääsiö and Kusti Skytén and Marko Järvenpää and Pekka Marttinen and Michael Gutmann and Aki Vehtari and Jukka Corander and Samuel Kaski},
Title = {ELFI: Engine for Likelihood Free Inference},
Year = {2017},
Year = {2018},
Eprint = {arXiv:1708.00707},
}
13 changes: 13 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,16 @@ means the current folder.
.. _Github repo: https://github.com/elfi-dev/elfi
.. _tarball: https://github.com/elfi-dev/elfi/tarball/dev

Docker container
----------------

A simple Dockerfile for command-line interface is also provided. Please see `Docker documentation`_.

.. _Docker documentation: https://docs.docker.com/

.. code-block:: console
git clone --depth 1 https://github.com/elfi-dev/elfi.git
cd elfi
docker build -t elfi .
docker run -it elfi
77 changes: 63 additions & 14 deletions docs/usage/parallelization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ in your computer. You can activate it simply by
elfi.set_client('multiprocessing')
Any inference instance created after you have set the new client will
automatically use it to perform the computations. Let's try it with our
MA2 example model from the tutorial. When running the next command, take
a look at the system monitor of your operating system; it should show
that all of your cores are doing heavy computation simultaneously.
Any inference instance created **after** you have set the new client
will automatically use it to perform the computations. Let's try it with
our MA2 example model from the tutorial. When running the next command,
take a look at the system monitor of your operating system; it should
show that all of your cores are doing heavy computation simultaneously.

.. code:: ipython3
Expand All @@ -70,8 +70,8 @@ that all of your cores are doing heavy computation simultaneously.
.. parsed-literal::
CPU times: user 272 ms, sys: 28 ms, total: 300 ms
Wall time: 2.41 s
CPU times: user 298 ms, sys: 25.7 ms, total: 324 ms
Wall time: 3.93 s
And that is it. The result object is also just like in the basic case:
Expand All @@ -91,14 +91,63 @@ And that is it. The result object is also just like in the basic case:
Method: Rejection
Number of samples: 5000
Number of simulations: 1000000
Threshold: 0.0817
Sample means: t1: 0.68, t2: 0.133
Threshold: 0.0826
Sample means: t1: 0.694, t2: 0.226
.. image:: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/usage/parallelization_files/parallelization_11_1.png


Note that for reproducibility a reference to the activated client is
saved in the inference instance:

.. code:: ipython3
rej.client
.. parsed-literal::
<elfi.clients.multiprocessing.Client at 0x1a19c2f128>
If you want to change the client for an existing inference instance, you
have to do something like this:

.. code:: ipython3
elfi.set_client('native')
rej.client = elfi.get_client()
rej.client
.. parsed-literal::
<elfi.clients.native.Client at 0x1a1d2a5cf8>
By default the multiprocessing client will use all cores on your system.
This is not always desirable, as the operating system may prioritize
some other process, leaving ELFI queuing for the promised resources. You
can define some other number of processes like so:

.. code:: ipython3
elfi.set_client(elfi.clients.multiprocessing.Client(num_processes=3))
**Note:** The ``multiprocessing`` library may require additional care
under Windows. If you receive a RuntimeError mentioning
``freeze_support``, please include a call to
``multiprocessing.freeze_support()``, see
`documentation <https://docs.python.org/3.6/library/multiprocessing.html#multiprocessing.freeze_support>`__.

Ipyparallel client
------------------

Expand Down Expand Up @@ -136,8 +185,8 @@ take care of the parallelization from now on:
.. parsed-literal::
CPU times: user 3.16 s, sys: 184 ms, total: 3.35 s
Wall time: 13.4 s
CPU times: user 3.47 s, sys: 288 ms, total: 3.76 s
Wall time: 18.1 s
To summarize, the only thing that needed to be changed from the basic
Expand Down Expand Up @@ -230,8 +279,8 @@ The above may look a bit cumbersome, but now this works:
Method: Rejection
Number of samples: 1000
Number of simulations: 100000
Threshold: 0.0136
Sample means: t1: 0.676, t2: 0.129
Threshold: 0.0146
Sample means: t1: 0.693, t2: 0.233
Expand All @@ -250,5 +299,5 @@ Remember to stop the ipcluster when done
.. parsed-literal::
2017-07-19 16:20:58.662 [IPClusterStop] Stopping cluster [pid=21020] with [signal=<Signals.SIGINT: 2>]
2018-04-24 19:14:56.997 [IPClusterStop] Stopping cluster [pid=39639] with [signal=<Signals.SIGINT: 2>]

0 comments on commit ce02414

Please sign in to comment.