Skip to content

Commit

Permalink
Merge pull request #370 from elfi-dev/dev
Browse files Browse the repository at this point in the history
Release v.0.8.0
  • Loading branch information
hpesonen committed Mar 29, 2021
2 parents 5ce82ed + 147206c commit e735abb
Show file tree
Hide file tree
Showing 42 changed files with 6,007 additions and 1,556 deletions.
5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ Please provide a short summary here

If your contribution adds, removes or somehow changes the functional behavior of the package, please check that

- [ ] You have included or updated all the relevant documentation
- [ ] The proposed changes pass all unit tests (check step 6 of CONTRIBUTING.rst for details)
- [ ] You have included or updated all the relevant documentation
- [ ] You have added appropriate unit tests to ensure the new features behave as expected

and the proposed changes pass all unit tests (check step 6 of CONTRIBUTING.rst for details)

#### Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ install:
- pip install numpy
- pip install -r requirements-dev.txt
- pip install -e .
- pip install "dask[distributed]" --upgrade

script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ipcluster start -n 2 --daemonize ; fi
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Changelog
=========

0.8.0 (2021-03-29)
------------------
- Merge adaptive distance ABC-SMC and ABC-SMC functionalities
- Split `DensityRatioEstimation` from utils.py into separate file
- Refactor parameter_inferency.py into methodtype-wise individual files
- Rename `elfi.methods.mcmc.gelman_rubin` as `elfi.methods.mcmc.gelman_rubin_statistic`
- Refactor `class ModelPrior` from `methods.utils` to `model.extensions`.
- Add adaptive threshold selection method for ABC-SMC
- Modify ProgressBar-functionality
- Add constrains to ExpIntVar-acquisition so that no queries will be outside prior support
- Add ABC-SMC with adaptive distance
- Add Robust optimisation Monte Carlo method
- Fix small issues in ABC-SMC which did not work in 1-dimensional problems or with output names
- Update README.md

0.7.7 (2020-10-12)
------------------
Expand Down
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,29 @@ docs: ## generate Sphinx HTML documentation, including API docs
$(MAKE) -C docs html
# $(BROWSER) docs/_build/html/index.html

CONTENT_URL := http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/
CONTENT_URL := https://raw.githubusercontent.com/elfi-dev/notebooks/dev/figures/

notebook-docs: ## Conver notebooks to rst docs. Assumes you have them in `notebooks` directory.
jupyter nbconvert --to rst ../notebooks/quickstart.ipynb --output-dir docs
sed -i '' 's|\(quickstart_files/quickstart.*\.\)|'${CONTENT_URL}'\1|g' docs/quickstart.rst

jupyter nbconvert --to rst ../notebooks/tutorial.ipynb --output-dir docs/usage
sed -i '' 's|\(tutorial_files/tutorial.*\.\)|'${CONTENT_URL}usage/'\1|g' docs/usage/tutorial.rst
sed -i '' 's|\(tutorial_files/tutorial.*\.\)|'${CONTENT_URL}'\1|g' docs/usage/tutorial.rst

jupyter nbconvert --to rst ../notebooks/adaptive_distance.ipynb --output-dir docs/usage
sed -i '' 's|\(adaptive_distance_files/adaptive_distance.*\.\)|'${CONTENT_URL}'\1|g' docs/usage/adaptive_distance.rst

jupyter nbconvert --to rst ../notebooks/adaptive_threshold_selection.ipynb --output-dir docs/usage
sed -i '' 's|\(adaptive_threshold_selection_files/adaptive_threshold_selection.*\.\)|'${CONTENT_URL}'\1|g' docs/usage/adaptive_threshold_selection.rst

jupyter nbconvert --to rst ../notebooks/BOLFI.ipynb --output-dir docs/usage
sed -i '' 's|\(BOLFI_files/BOLFI.*\.\)|'${CONTENT_URL}usage/'\1|g' docs/usage/BOLFI.rst
sed -i '' 's|\(BOLFI_files/BOLFI.*\.\)|'${CONTENT_URL}'\1|g' docs/usage/BOLFI.rst

jupyter nbconvert --to rst ../notebooks/parallelization.ipynb --output-dir docs/usage
sed -i '' 's|\(parallelization_files/parallelization.*\.\)|'${CONTENT_URL}usage/'\1|g' docs/usage/parallelization.rst
sed -i '' 's|\(parallelization_files/parallelization.*\.\)|'${CONTENT_URL}'\1|g' docs/usage/parallelization.rst

jupyter nbconvert --to rst ../notebooks/non_python_operations.ipynb --output-dir docs/usage --output=external
sed -i '' 's|\(external_files/external.*\.\)|'${CONTENT_URL}usage/'\1|g' docs/usage/external.rst
sed -i '' 's|\(external_files/external.*\.\)|'${CONTENT_URL}'\1|g' docs/usage/external.rst

# release: clean ## package and upload a release
# python setup.py sdist upload
Expand Down
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
**Version 0.7.7 released!** See the [CHANGELOG](CHANGELOG.rst) and [notebooks](https://github.com/elfi-dev/notebooks).

**NOTE:** For the time being NetworkX 2 is incompatible with ELFI.
**Version 0.8.0 released!** See the [CHANGELOG](CHANGELOG.rst) and [notebooks](https://github.com/elfi-dev/notebooks).

ELFI - Engine for Likelihood-Free Inference
===========================================
Expand All @@ -22,7 +20,10 @@ inference out of the box.
Currently implemented LFI methods:
- ABC Rejection sampler
- Sequential Monte Carlo ABC sampler
- SMC-ABC sampler with [adaptive threshold selection](https://projecteuclid.org/journals/bayesian-analysis/advance-publication/Adaptive-Approximate-Bayesian-Computation-Tolerance-Selection/10.1214/20-BA1211.full)
- SMC-ABC sampler with [adaptive distance](https://projecteuclid.org/euclid.ba/1460641065)
- [Bayesian Optimization for Likelihood-Free Inference (BOLFI)](http://jmlr.csail.mit.edu/papers/v17/15-017.html)
- [Robust Optimisation Monte Carlo](https://arxiv.org/abs/1904.00670)

Other notable included algorithms and methods:
- Bayesian Optimization
Expand All @@ -37,8 +38,8 @@ asked from elfi-support.at.hiit.fi, but the
is preferable.


Installation
------------
Installation with pip
---------------------

ELFI requires Python 3.6 or greater. You can install ELFI by typing in your terminal:

Expand All @@ -53,6 +54,27 @@ pip3 install elfi
Note that in some environments you may need to first install `numpy` with
`pip install numpy`. This is due to our dependency to `GPy` that uses `numpy` in its installation.

Installation from conda-forge
-----------------------------

Installing `elfi` from the `conda-forge` channel can be achieved by adding `conda-forge` to your channels with:

```
conda config --add channels conda-forge
```

Once the `conda-forge` channel has been enabled, `elfi` can be installed with:

```
conda install elfi
```

It is possible to list all of the versions of `elfi` available on your platform with:

```
conda search elfi --channel conda-forge
```

### Optional dependencies

- `graphviz` for drawing graphical models (needs [Graphviz](http://www.graphviz.org)), highly recommended
Expand Down Expand Up @@ -100,7 +122,7 @@ Resolving these may sometimes go wrong:
- If you receive an error about `yaml.load`, install `pyyaml`.
- On OS X with Anaconda virtual environment say `conda install python.app` and then use
`pythonw` instead of `python`.
- Note that ELFI requires Python 3.5 or greater so try `pip3 install elfi`.
- Note that ELFI requires Python 3.6 or greater so try `pip3 install elfi`.
- Make sure your Python installation meets the versions listed in `requirements.txt`.


Expand Down
23 changes: 23 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Below is the API for creating generative models.
elfi.Summary
elfi.Discrepancy
elfi.Distance
elfi.AdaptiveDistance

**Other**

Expand All @@ -48,8 +49,11 @@ Below is a list of inference methods included in ELFI.
.. autosummary::
elfi.Rejection
elfi.SMC
elfi.AdaptiveDistanceSMC
elfi.AdaptiveThresholdSMC
elfi.BayesianOptimization
elfi.BOLFI
elfi.ROMC


**Result objects**
Expand Down Expand Up @@ -165,6 +169,10 @@ Modelling API classes
:members:
:inherited-members:

.. autoclass:: elfi.AdaptiveDistance
:members:
:inherited-members:


**Other**

Expand Down Expand Up @@ -194,6 +202,14 @@ Inference API classes
:members:
:inherited-members:

.. autoclass:: elfi.AdaptiveDistanceSMC
:members:
:inherited-members:

.. autoclass:: elfi.AdaptiveThresholdSMC
:members:
:inherited-members:

.. autoclass:: elfi.BayesianOptimization
:members:
:inherited-members:
Expand All @@ -202,6 +218,10 @@ Inference API classes
:members:
:inherited-members:

.. autoclass:: elfi.ROMC
:members:
:inherited-members:


**Result objects**

Expand All @@ -223,6 +243,9 @@ Inference API classes
:members:
:inherited-members:

.. autoclass:: RomcSample
:members:
:inherited-members:

**Post-processing**

Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def __getattr__(cls, name):
'distributed', 'distributed.client', 'graphviz', 'matplotlib', 'sobol_seq', 'GPy',
'dask.delayed', 'scipy.linalg', 'scipy.optimize', 'scipy.stats', 'scipy.spatial',
'scipy.sparse', 'scipy.special', 'matplotlib.pyplot', 'numpy.random', 'networkx',
'ipyparallel', 'numpy.lib', 'numpy.lib.format', 'sklearn.linear_model'
'ipyparallel', 'numpy.lib', 'numpy.lib.format', 'sklearn.linear_model',
'sklearn.pipeline', 'sklearn.preprocessing'
]
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

Expand Down
8 changes: 8 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ Currently implemented LFI methods:

- ABC rejection sampler
- Sequential Monte Carlo ABC sampler
- ABC-SMC sampler with `adaptive distance`_
- ABC-SMC sampler with `adaptive threshold selection`_
- Bayesian Optimization for Likelihood-Free Inference (BOLFI_) framework
- Robust Optimization Monte Carlo (ROMC_) framework

.. _adaptive distance: https://projecteuclid.org/euclid.ba/1460641065
.. _adaptive threshold selection: https://projecteuclid.org/journals/bayesian-analysis/advance-publication/Adaptive-Approximate-Bayesian-Computation-Tolerance-Selection/10.1214/20-BA1211.full
.. _BOLFI: http://jmlr.org/papers/v17/15-017.html
.. _ROMC: http://proceedings.mlr.press/v108/ikonomov20a.html

ELFI also has the following non LFI methods:

Expand All @@ -52,6 +58,8 @@ Additionally, ELFI integrates tools for visualization, model comparison, diagnos
:caption: Usage

usage/tutorial
usage/adaptive_distance
usage/adaptive_threshold_selection
usage/parallelization
usage/BOLFI
usage/external
Expand Down
4 changes: 2 additions & 2 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ visualize the model:
.. image:: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/quickstart_files/quickstart_11_0.svg
.. image:: https://raw.githubusercontent.com/elfi-dev/notebooks/dev/figures/quickstart_files/quickstart_11_0.svg



Expand Down Expand Up @@ -134,5 +134,5 @@ Let’s plot also the marginal distributions for the parameters:
.. image:: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/quickstart_files/quickstart_16_0.png
.. image:: https://raw.githubusercontent.com/elfi-dev/notebooks/dev/figures/quickstart_files/quickstart_16_0.png

12 changes: 6 additions & 6 deletions docs/usage/BOLFI.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ the basic tutorial, and load it from ready-made examples:
.. image:: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/usage/BOLFI_files/BOLFI_5_0.svg
.. image:: https://raw.githubusercontent.com/elfi-dev/notebooks/dev/figures/BOLFI_files/BOLFI_5_0.svg



Expand Down Expand Up @@ -166,7 +166,7 @@ investigated further:
.. image:: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/usage/BOLFI_files/BOLFI_15_1.png
.. image:: https://raw.githubusercontent.com/elfi-dev/notebooks/dev/figures/BOLFI_files/BOLFI_15_1.png


It may be useful to see the acquired parameter values and the resulting
Expand All @@ -178,7 +178,7 @@ discrepancies:
.. image:: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/usage/BOLFI_files/BOLFI_17_0.png
.. image:: https://raw.githubusercontent.com/elfi-dev/notebooks/dev/figures/BOLFI_files/BOLFI_17_0.png


There could be an unnecessarily high number of points at parameter
Expand Down Expand Up @@ -212,7 +212,7 @@ triangle):
.. image:: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/usage/BOLFI_files/BOLFI_23_0.png
.. image:: https://raw.githubusercontent.com/elfi-dev/notebooks/dev/figures/BOLFI_files/BOLFI_23_0.png


Sampling
Expand Down Expand Up @@ -300,7 +300,7 @@ convenience methods:
.. image:: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/usage/BOLFI_files/BOLFI_29_0.png
.. image:: https://raw.githubusercontent.com/elfi-dev/notebooks/dev/figures/BOLFI_files/BOLFI_29_0.png


The black vertical lines indicate the end of warmup, which by default is
Expand All @@ -312,5 +312,5 @@ half of the number of iterations.
.. image:: http://research.cs.aalto.fi/pml/software/elfi/docs/0.6.2/usage/BOLFI_files/BOLFI_31_0.png
.. image:: https://raw.githubusercontent.com/elfi-dev/notebooks/dev/figures/BOLFI_files/BOLFI_31_0.png

0 comments on commit e735abb

Please sign in to comment.