Skip to content

Commit 08f3099

Browse files
authored
Merge pull request #317 from elfi-dev/dev
Release v. 0.7.5 - Improved the appearance of figures produced by `plot_gp` and added the option to draw true parameter indicators on the subplots using the optional input `true_params` - Modified DCC model by taking into account that subject can't infect herself - Added ability to set minimizer constrains for BOLFI - Enable bolfi.fit using only pre-generated initial evidence points - Fixed a bug causing random seed number to be deterministic - Updated requirements-dev.txt with pytest>=4.4 - Minor changes to documentation and refactoring - Added `make test-notslow` alternative
2 parents b07ff6e + 21a9121 commit 08f3099

27 files changed

+243
-117
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
Please provide a short summary here
33

44
#### Please make sure
5-
- You have updated the CHANGELOG.rst
6-
- You have updated the documentation (if applicable)
5+
6+
- [ ] You have updated the CHANGELOG.rst
7+
- [ ] You have provided a short summary of your changes (see previous section)
8+
- [ ] You have listed the copyright holder for the work you are submitting (see next section)
9+
10+
If your contribution adds, removes or somehow changes the functional behavior of the package, please check that
11+
12+
- [ ] You have included or updated all the relevant documentation
13+
- [ ] The proposed changes pass all unit tests (check step 6 of CONTRIBUTING.rst for details)
14+
- [ ] You have added appropriate unit tests to ensure the new features behave as expected
715

816
#### Copyright and Licensing
917

CHANGELOG.rst

+32-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
Changelog
22
=========
33

4+
0.7.5 (2019-12-18)
5+
------------------
6+
- Improved the appearance of figures produced by `plot_gp` and added the option
7+
to draw true parameter indicators on the subplots using the optional input
8+
`true_params`
9+
- Modified DCC model by taking into account that subject can't infect herself
10+
- Added ability to set minimizer constrains for BOLFI
11+
- Enable bolfi.fit using only pre-generated initial evidence points
12+
- Fixed a bug causing random seed number to be deterministic
13+
- Updated requirements-dev.txt with pytest>=4.4
14+
- Minor changes to documentation and refactoring
15+
- Added `make test-notslow` alternative
416

517
0.7.4 (2019-03-07)
618
------------------
719
- Add sampler option `algorithm` for bolfi-posterior-sampling
8-
- Add a check whether the option given for `algorithm` is one if the implemented samplers
20+
- Add a check whether the option given for `algorithm` is one if the
21+
implemented samplers
922
- Add metropolis sampler `algorithm=metropolis` for bolfi-posterior-sampling
1023
- Add option `warmup` to metropolis-sampler
1124
- Add a small test of metropolis-sampler
@@ -17,7 +30,8 @@ Changelog
1730
0.7.3 (2018-08-30)
1831
------------------
1932
- Fix bug in plot_pairs which crashes in case of 1 parameter
20-
- Fix bug in plot_marginals which outputs empty plots in case where we have parameter more than 5
33+
- Fix bug in plot_marginals which outputs empty plots in case where we have
34+
parameter more than 5
2135
- Fix crashing summary and plots for samples with multivariate priors
2236
- Add progress bar for inference methods
2337
- Add method save to Sample objects
@@ -27,7 +41,8 @@ Changelog
2741
0.7.2 (2018-06-20)
2842
------------------
2943
- Added support for kwargs in elfi.set_client
30-
- Added new example: inference of transmission dynamics of bacteria in daycare centers
44+
- Added new example: inference of transmission dynamics of bacteria in daycare
45+
centers
3146
- Added new example: Lorenz model
3247

3348
0.7.1 (2018-04-11)
@@ -40,19 +55,22 @@ Changelog
4055
----------------
4156
- Added new example: the stochastic Lotka-Volterra model
4257
- Fix methods.bo.utils.minimize to be strictly within bounds
43-
- Implemented the Two Stage Procedure, a method of summary-statistics diagnostics
58+
- Implemented the Two Stage Procedure, a method of summary-statistics
59+
diagnostics
4460
- Added the MaxVar acquisition method
4561
- Added the RandMaxVar acquisition method
4662
- Added the ExpIntVar acquisition method
47-
- Implemented the Two Stage Procedure, a method of summary-statistics diagnostics
63+
- Implemented the Two Stage Procedure, a method of summary-statistics
64+
diagnostics
4865
- Added new example: the stochastic Lotka-Volterra model
4966
- Fix methods.bo.utils.minimize to be strictly within bounds
5067
- Fix elfi.Distance to support scipy 1.0.0
5168

5269
0.6.3 (2017-09-28)
5370
------------------
5471

55-
- Further performance improvements for rerunning inference using stored data via caches
72+
- Further performance improvements for rerunning inference using stored data
73+
via caches
5674
- Added the general Gaussian noise example model (fixed covariance)
5775
- restrict NetworkX to versions < 2.0
5876

@@ -74,18 +92,21 @@ Changelog
7492
- Added OutputPool.open to read a closed pool from disk
7593
- Refactored Sample and SmcSample classes
7694
- Added elfi.new_model method
77-
- Made elfi.set_client method to accept clients as strings for easier client switching
95+
- Made elfi.set_client method to accept clients as strings for easier client
96+
switching
7897
- Fixed a bug in NpyArray that would lead to an inconsistent state if multiple
7998
simultaneous instances were opened.
8099
- Added the ability to move the pool data folder
81100
- Sample.summary is now a method instead of a property
82-
- SmcSample methods takes the keyword argument 'all' to show results of all populations
101+
- SmcSample methods takes the keyword argument 'all' to show results of all
102+
populations
83103
- Added a section about iterative advancing to documentation
84104

85105
0.6 (2017-07-03)
86106
----------------
87107

88-
- Changed some of the internal variable names in methods.py. Most notable outputs is now
108+
- Changed some of the internal variable names in methods.py. Most notable
109+
outputs is now
89110
output_names.
90111
- methods.py renamed to parameter_inference.py
91112
- Changes in elfi.methods.results module class names:
@@ -108,7 +129,8 @@ Major update, a lot of code base rewritten.
108129
Most important changes:
109130

110131
- revised syntax for model definition (esp. naming)
111-
- scheduler-independent parallelization interface (currently supports native & ipyparallel)
132+
- scheduler-independent parallelization interface (currently supports native &
133+
ipyparallel)
112134
- methods can now be run iteratively
113135
- persistence to .npy files
114136
- Bayesian optimization as a separate method

CONTRIBUTING.rst

+24-9
Original file line numberDiff line numberDiff line change
@@ -54,61 +54,76 @@ If you are proposing a feature:
5454
* Remember that this is a volunteer-driven project, and that contributions
5555
are welcome :)
5656

57+
5758
Get Started!
5859
------------
5960

61+
`ELFI` is a project with dozens of collaborators, so organization is key to making our contributions effective and avoid reword. Thus, in addition to the recommendations below we strongly recommend reading our `Wiki <https://github.com/elfi-dev/elfi/wiki>`_ to see what is the suggested git workflow procedure for your type of contribution.
62+
6063
Ready to contribute? Here's how to set up `ELFI` for local development.
6164

6265
1. Fork the `elfi` repo on GitHub.
6366
2. Clone your fork locally::
6467

6568
$ git clone git@github.com:your_name_here/elfi.git
6669

67-
3. Install your local copy and the development requirements into a conda environment::
70+
3. Make sure you have `Python 3 <https://www.python.org/>`_ and
71+
`Anaconda Distribution <https://www.anaconda.com/>`_ installed on your
72+
machine. Check your conda and Python versions::
73+
74+
$ conda -V
75+
$ python -V
76+
77+
4. Install your local copy and the development requirements into a conda
78+
environment. You may need to replace "3.5" in the first line with the python
79+
version printed in the previous step::
6880

6981
$ conda create -n elfi python=3.5 numpy
7082
$ source activate elfi
7183
$ cd elfi
7284
$ make dev
7385

74-
4. Create a branch for local development::
86+
5. Create a branch for local development::
7587

7688
$ git checkout -b name-of-your-bugfix-or-feature
7789

7890
Now you can make your changes locally.
79-
80-
5. Follow the `Style Guidelines`_
8191

82-
6. When you're done making changes, check that your changes pass flake8 and the tests::
92+
6. Follow the `Style Guidelines`_
93+
94+
7. When you're done making changes, check that your changes pass flake8 and the tests::
8395

8496
$ make lint
8597
$ make test
8698

99+
You may run `make test-notslow` instead of `make test` *as long as your proposed changes are unrelated to BOLFI*.
100+
87101
Also make sure that the docstrings of your code are formatted properly::
88102

89103
$ make docs
90104

91-
7. Commit your changes and push your branch to GitHub::
105+
8. Commit your changes and push your branch to GitHub::
92106

93107
$ git add .
94108
$ git commit -m "Your detailed description of your changes."
95109
$ git push origin name-of-your-bugfix-or-feature
96110

97-
8. Submit a pull request through the GitHub website.
111+
9. Submit a pull request through the GitHub website.
98112

99113
Style Guidelines
100114
----------------
101115

102116
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.
103-
117+
104118
Docstrings follow the `NumPy style <http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html>`_.
105119

106120
Pull Request Guidelines
107121
-----------------------
108122

109123
Before you submit a pull request, check that it meets these guidelines:
110124

111-
1. The pull request should include tests that will be run automatically using Travis-CI.
125+
1. The pull request should include tests that will be run automatically using
126+
Travis-CI.
112127
2. If the pull request adds functionality, the docs should be updated. Put
113128
your new functionality into a function with a docstring, and add the
114129
feature to the list in README.rst.

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,16 @@ lint: ## check style with flake8
5252
flake8 elfi tests
5353

5454
test: ## run tests quickly with the default Python
55-
PYTHONPATH=$$PYTHONPATH:. py.test --reruns 1
55+
PYTHONPATH=$$PYTHONPATH:. pytest --reruns 1
56+
57+
test-notslow: ## skips tests marked as slowtest
58+
PYTHONPATH=$$PYTHONPATH:. pytest -m "not slowtest"
5659

5760
test-all: ## run tests on every Python version with tox
5861
tox
5962

6063
coverage: ## check code coverage quickly with the default Python
61-
py.test --cov=elfi
64+
pytest --cov=elfi
6265
coverage report -m
6366
coverage html
6467
$(BROWSER) htmlcov/index.html

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**Version 0.7.4 released!** See the CHANGELOG and [notebooks](https://github.com/elfi-dev/notebooks).
1+
**Version 0.7.5 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

docs/quickstart.rst

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Quickstart
32
==========
43

docs/usage/BOLFI.rst

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
This tutorial is generated from a `Jupyter <http://jupyter.org/>`__
32
notebook that can be found
43
`here <https://github.com/elfi-dev/notebooks>`__.

docs/usage/external.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
This tutorial is generated from a `Jupyter <http://jupyter.org/>`__
32
notebook that can be found
43
`here <https://github.com/elfi-dev/notebooks>`__.
@@ -128,7 +127,7 @@ population size:
128127
It is assumed that the susceptible population is infinite, the hosts
129128
carry only one mutation of the disease and transmit that mutation
130129
onward. A more accurate description of the model can be found from the
131-
original paper or e.g. `Lintusaari at al
130+
original paper or e.g. `Lintusaari at al
132131
2016 <https://doi.org/10.1093/sysbio/syw077>`__ *[1]*.
133132

134133
.. For documentation
@@ -625,6 +624,6 @@ References
625624
Kaski, Jukka Corander; Fundamentals and Recent Developments in
626625
Approximate Bayesian Computation. Syst Biol 2017; 66 (1): e66-e82.
627626
doi: 10.1093/sysbio/syw077
628-
- [2] Tanaka, Mark M., et al. “Using approximate Bayesian computation
627+
- [2] Tanaka, Mark M., et al. “Using approximate Bayesian computation
629628
to estimate tuberculosis transmission parameters from genotype data.”
630629
Genetics 173.3 (2006): 1511-1520.

docs/usage/parallelization.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
This tutorial is generated from a `Jupyter <http://jupyter.org/>`__
32
notebook that can be found
43
`here <https://github.com/elfi-dev/notebooks>`__.
@@ -301,3 +300,4 @@ Remember to stop the ipcluster when done
301300
302301
2018-04-24 19:14:56.997 [IPClusterStop] Stopping cluster [pid=39639] with [signal=<Signals.SIGINT: 2>]
303302
303+

docs/usage/tutorial.rst

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
This tutorial is generated from a `Jupyter <http://jupyter.org/>`__
32
notebook that can be found
43
`here <https://github.com/elfi-dev/notebooks>`__.
@@ -95,8 +94,8 @@ scalars as they are first converted to vectors.
9594
.. Important:: In order to guarantee a consistent state of pseudo-random number generation, the simulator must have `random_state` as a keyword argument for reading in a `numpy.RandomState` object.
9695

9796
Let’s now use this simulator to create toy observations. We will use
98-
parameter values :math:`\theta_1=0.6, \theta_2=0.2` as in `Marin et al.
99-
(2012) <http://link.springer.com/article/10.1007/s11222-011-9288-2>`__
97+
parameter values :math:`\theta_1=0.6, \theta_2=0.2` as in `Marin et
98+
al. (2012) <http://link.springer.com/article/10.1007/s11222-011-9288-2>`__
10099
and then try to infer these parameter values back based on the toy
101100
observed data alone.
102101

@@ -142,7 +141,7 @@ have been produced by similar parameters. Looking at the picture above,
142141
in essence we would keep simulating until we have found enough sequences
143142
that are similar to the observed sequence. Although the idea may appear
144143
inapplicable for the task at hand, you will soon see that it does work.
145-
For more information about ABC, please see e.g.
144+
For more information about ABC, please see e.g. 
146145

147146
- `Lintusaari, J., Gutmann, M. U., Dutta, R., Kaski, S., and Corander,
148147
J. (2016). Fundamentals and recent developments in approximate
@@ -261,8 +260,8 @@ Modifying the model
261260
-------------------
262261

263262
Although the above definition is perfectly valid, let’s use the same
264-
priors as in `Marin et al.
265-
(2012) <http://link.springer.com/article/10.1007/s11222-011-9288-2>`__
263+
priors as in `Marin et
264+
al. (2012) <http://link.springer.com/article/10.1007/s11222-011-9288-2>`__
266265
that guarantee that the problem will be identifiable (loosely speaking,
267266
the likelihood willl have just one mode). Marin et al. used priors for
268267
which :math:`-2<\theta_1<2` with :math:`\theta_1+\theta_2>-1` and
@@ -532,12 +531,12 @@ applicable.
532531
Storing simulated data
533532
----------------------
534533

535-
As the samples are already in numpy arrays, you can just say e.g.
536-
``np.save('t1_data.npy', result.samples['t1'])`` to save them. However,
537-
ELFI provides some additional functionality. You may define a *pool* for
538-
storing all outputs of any node in the model (not just the accepted
539-
samples). Let’s save all outputs for ``t1``, ``t2``, ``S1`` and ``S2``
540-
in our model:
534+
As the samples are already in numpy arrays, you can just say
535+
e.g. ``np.save('t1_data.npy', result.samples['t1'])`` to save them.
536+
However, ELFI provides some additional functionality. You may define a
537+
*pool* for storing all outputs of any node in the model (not just the
538+
accepted samples). Let’s save all outputs for ``t1``, ``t2``, ``S1`` and
539+
``S2`` in our model:
541540

542541
.. code:: ipython3
543542
@@ -758,9 +757,9 @@ Often “pairwise relationships” are more informative:
758757
.. image:: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/usage/tutorial_files/tutorial_79_0.png
759758

760759

761-
Note that if working in a non-interactive environment, you can use e.g.
762-
``plt.savefig('pairs.png')`` after an ELFI plotting command to save the
763-
current figure to disk.
760+
Note that if working in a non-interactive environment, you can use
761+
e.g. ``plt.savefig('pairs.png')`` after an ELFI plotting command to save
762+
the current figure to disk.
764763

765764
Sequential Monte Carlo ABC
766765
--------------------------
@@ -1013,3 +1012,4 @@ practices with ELFI.
10131012
10141013
That’s it! See the other documentation for more advanced topics on
10151014
e.g. BOLFI, external simulators and parallelization.
1015+

elfi/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
__email__ = 'elfi-support@hiit.fi'
2727

2828
# make sure __version_ is on the last non-empty line (read by setup.py)
29-
__version__ = '0.7.4'
29+
__version__ = '0.7.5'

0 commit comments

Comments
 (0)