Skip to content

Commit dd5b760

Browse files
authored
Release 0.6.2 (#231)
* PEP8 fix (#225) * Fix PEP8: imports, docstrings (#226) * Fix PEP8: imports, docstrings * Fix docstrings for clients. * Fix docstrings under model * Fix docstrings under methods * Fix docstrings under examples * Fix docstrings under visualization * Fix docstrings under bo * Fix docstrings under root * Fix readthedocs * Implementing the g-and-k models (uni- and bi-variate). (#193) * Implementing the g-and-k models (uni- and bi-variate). Setting the default values for running the models. Adding the models to the init file. * Addressed the code review. Added naive tests. Applied the new linting. * Easier model saving and loading * Linting fixes * Improve sub seed generation performance (#229) * Change get_sub_seed to use only integer seeds * Added caching to sub seed generation This dramatically decreased the time to recompute results from OutputPool with large amount of batches (200000 in the test case). * Changelog update * SMC uses ModelPrior, ensure validity of proposals (#224) * SMC uses ModelPrior, ensure validity of proposals * Address comments * Change behaviour when size=None * Address comment * Bump version and notebooks to 0.6.2 (#230)
1 parent 3d4fe94 commit dd5b760

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+3156
-1541
lines changed

CHANGELOG.rst

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
Changelog
2-
==========
2+
=========
3+
4+
0.6.2 (2017-09-06)
5+
------------------
6+
7+
- Easier saving and loading of ElfiModel
8+
- Renamed elfi.set_current_model to elfi.set_default_model
9+
- Renamed elfi.get_current_model to elfi.get_default_model
10+
- Improved performance when rerunning inference using stored data
11+
- Change SMC to use ModelPrior, use to immediately reject invalid proposals
312

413
0.6.1 (2017-07-21)
514
------------------

CONTRIBUTING.rst

+9-15
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ Ready to contribute? Here's how to set up `ELFI` for local development.
6464

6565
$ git clone git@github.com:your_name_here/elfi.git
6666

67-
3. Install your local copy and the development requirements into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development. Due to a bug in the pip installation of GPy numpy needs to be installed manually.::
67+
3. Install your local copy and the development requirements into a conda environment::
6868

69-
$ mkvirtualenv elfi
70-
$ cd elfi/
71-
$ pip install numpy
69+
$ conda create -n elfi python=3.5 numpy
70+
$ source activate elfi
71+
$ cd elfi
7272
$ make dev
7373

7474
4. Create a branch for local development::
@@ -84,7 +84,7 @@ Ready to contribute? Here's how to set up `ELFI` for local development.
8484
$ make lint
8585
$ make test
8686

87-
Also make sure that the docstrings of your code are formatted properly::
87+
Also make sure that the docstrings of your code are formatted properly::
8888

8989
$ make docs
9090

@@ -99,26 +99,20 @@ Ready to contribute? Here's how to set up `ELFI` for local development.
9999
Style Guidelines
100100
----------------
101101

102-
The projects follows the `Khan Academy Style Guide <https://github.com/Khan/style-guides/blob/master/style/python.md>`_. Except that we use numpy style docstrings instead of Google style docstrings.
102+
The Python code in ELFI mostly follows `PEP8 <http://pep8.org/>`_, which is considered the de-facto code style guide for Python. Lines should not exceed 100 characters.
103103

104-
See `this example <http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html>`_ for how to format the docstrings.
104+
Docstrings follow the `NumPy style <http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html>`_.
105105

106-
Additional Style Guidelines
107-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
108-
109-
- Use the ``.format()`` string method instead of the old percent operator. For more information see `PyFormat <https://pyformat.info/>`_.
110-
- Use the type hinting syntax suggested `here <https://www.jetbrains.com/help/pycharm/2016.1/type-hinting-in-pycharm.html>`_ in the docstrings.
111-
112106
Pull Request Guidelines
113107
-----------------------
114108

115109
Before you submit a pull request, check that it meets these guidelines:
116110

117-
1. The pull request should include tests.
111+
1. The pull request should include tests that will be run automatically using Travis-CI.
118112
2. If the pull request adds functionality, the docs should be updated. Put
119113
your new functionality into a function with a docstring, and add the
120114
feature to the list in README.rst.
121-
3. The pull request should work for Python 2.7, 3.5 and later. Check
115+
3. The pull request should work for Python 3.5 and later. Check
122116
https://travis-ci.org/elfi-dev/elfi/pull_requests
123117
and make sure that the tests pass for all supported Python versions.
124118

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ docs: ## generate Sphinx HTML documentation, including API docs
6969
$(MAKE) -C docs html
7070
# $(BROWSER) docs/_build/html/index.html
7171

72-
CONTENT_URL := http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.1/
72+
CONTENT_URL := http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/
7373

7474
notebook-docs: ## Conver notebooks to rst docs. Assumes you have them in `notebooks` directory.
7575
jupyter nbconvert --to rst ../notebooks/quickstart.ipynb --output-dir docs

README.md

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

33
ELFI - Engine for Likelihood-Free Inference
44
===========================================

docs/api.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ Below is the API for creating generative models.
3232

3333
.. autosummary::
3434
elfi.new_model
35-
elfi.get_current_model
36-
elfi.set_current_model
35+
elfi.load_model
36+
elfi.get_default_model
37+
elfi.set_default_model
3738

3839
.. currentmodule:: elfi.visualization.visualization
3940

docs/conf.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,34 @@
1313
# All configuration values have a default; values that are commented out
1414
# serve to show the default.
1515

16-
import sys
1716
import os
18-
17+
import sys
1918
# http://docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
2019
from unittest.mock import MagicMock
2120

2221

2322
class Mock(MagicMock):
2423
@classmethod
2524
def __getattr__(cls, name):
26-
return MagicMock()
25+
return MagicMock()
26+
2727

2828
on_RTD = os.environ.get('READTHEDOCS', None) == 'True'
2929
if on_RTD:
30-
MOCK_MODULES = ['pygtk', 'gtk', 'gobject', 'argparse', 'numpy', 'pandas', 'scipy',
31-
'unqlite', 'dask', 'distributed', 'distributed.client', 'graphviz', 'matplotlib',
32-
'sobol_seq', 'GPy', 'dask.delayed', 'scipy.optimize', 'scipy.stats',
33-
'scipy.spatial', 'scipy.sparse', 'matplotlib.pyplot', 'numpy.random', 'networkx',
34-
'ipyparallel', 'numpy.lib', 'numpy.lib.format', 'sklearn.linear_model']
30+
MOCK_MODULES = [
31+
'pygtk', 'gtk', 'gobject', 'argparse', 'numpy', 'pandas', 'scipy', 'unqlite', 'dask',
32+
'distributed', 'distributed.client', 'graphviz', 'matplotlib', 'sobol_seq', 'GPy',
33+
'dask.delayed', 'scipy.optimize', 'scipy.stats', 'scipy.spatial', 'scipy.sparse',
34+
'matplotlib.pyplot', 'numpy.random', 'networkx', 'ipyparallel', 'numpy.lib',
35+
'numpy.lib.format', 'sklearn.linear_model'
36+
]
3537
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
3638

3739
html_theme = 'default'
3840

3941
else:
4042
html_theme = 'sphinx_rtd_theme'
4143

42-
4344
# https://github.com/rtfd/readthedocs.org/issues/1139
4445
"""
4546
def run_apidoc(_):
@@ -179,7 +180,6 @@ def setup(app):
179180
# If true, `todo` and `todoList` produce output, else they produce nothing.
180181
todo_include_todos = False
181182

182-
183183
# -- Options for HTML output ----------------------------------------------
184184

185185
# The theme to use for HTML and HTML Help pages. See the documentation for

docs/quickstart.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ First ensure you have
77
Python 3.5 (or greater) and ELFI. After installation you can start using
88
ELFI:
99

10-
.. code:: python
10+
.. code:: ipython3
1111
1212
import elfi
1313
1414
ELFI includes an easy to use generative modeling syntax, where the
1515
generative model is specified as a directed acyclic graph (DAG). Let’s
1616
create 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
3030
simulator as 30 draws from a Gaussian distribution with a given mean and
3131
standard 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
4949
some 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
7373
adding the simulator, the observed data, summaries and a distance to our
7474
model:
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
9090
visualize 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
108108
Rejection sampling and sample 1000 samples from the approximate
109109
posterior 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

Comments
 (0)