Skip to content

Commit

Permalink
Release 0.7 (#252)
Browse files Browse the repository at this point in the history
* Fix undefined variable

* Bump version to 0.7, update API docs topics

* Add scipy.linalg to mocked libraries

* Update API docs
  • Loading branch information
vuolleko committed Nov 30, 2017
1 parent 24c17d8 commit 13b4a0b
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 44 deletions.
13 changes: 7 additions & 6 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
Changelog
=========

dev
---
- Added new example: the stochastic Lotka-Volterra model
- Fix methods.bo.utils.minimize to be strictly within bounds
- Implemented the Two Stage Procedure, a method of summary-statistics diagnostics
0.7 (2017-11-30)
----------------

- Added the MaxVar acquisition method
- Added the RandMaxVar acquisition method
- Fix elfi.Distance to support scipy 1.0.0
- Added the ExpIntVar acquisition method
- Implemented the Two Stage Procedure, a method of summary-statistics diagnostics
- Added new example: the stochastic Lotka-Volterra model
- Fix methods.bo.utils.minimize to be strictly within bounds
- Fix elfi.Distance to support scipy 1.0.0

0.6.3 (2017-09-28)
------------------
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**Version 0.6.3 released!** See the CHANGELOG and [notebooks](https://github.com/elfi-dev/notebooks).
**Version 0.7 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
94 changes: 72 additions & 22 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Modelling API
-------------
Below is the API for creating generative models.

.. currentmodule:: .

.. autosummary::
elfi.ElfiModel

Expand All @@ -28,16 +30,12 @@ Below is the API for creating generative models.

**Other**

.. currentmodule:: elfi.model.elfi_model

.. autosummary::
elfi.new_model
elfi.load_model
elfi.get_default_model
elfi.set_default_model

.. currentmodule:: elfi.visualization.visualization

.. autosummary::
elfi.draw

Expand All @@ -52,6 +50,7 @@ Below is a list of inference methods included in ELFI.
elfi.BayesianOptimization
elfi.BOLFI


**Result objects**

.. currentmodule:: elfi.methods.results
Expand All @@ -62,9 +61,10 @@ Below is a list of inference methods included in ELFI.
SmcSample
BolfiSample


**Post-processing**

.. currentmodule:: elfi
.. currentmodule:: .

.. autosummary::
elfi.adjust_posterior
Expand All @@ -74,20 +74,40 @@ Below is a list of inference methods included in ELFI.
.. autosummary::
LinearAdjustment


**Diagnostics**

.. currentmodule:: .

.. autosummary::
elfi.TwoStageSelection


**Acquisition methods**

.. currentmodule:: elfi.methods.bo.acquisition

.. autosummary::
LCBSC
MaxVar
RandMaxVar
ExpIntVar
UniformAcquisition

Other
-----

**Data pools**

.. currentmodule:: .

.. autosummary::
elfi.OutputPool
elfi.ArrayPool


**Module functions**

.. currentmodule:: elfi

.. autosummary::
elfi.get_client
elfi.set_client
Expand All @@ -102,6 +122,7 @@ Other
elfi.tools.external_operation



Class documentations
--------------------

Expand Down Expand Up @@ -146,17 +167,15 @@ Modelling API classes

**Other**

.. currentmodule:: elfi.model.elfi_model
.. autofunction:: elfi.new_model

.. automethod:: elfi.new_model
.. autofunction:: elfi.load_model

.. automethod:: elfi.get_current_model
.. autofunction:: elfi.get_default_model

.. automethod:: elfi.set_current_model
.. autofunction:: elfi.set_default_model

.. currentmodule:: elfi.visualization.visualization

.. automethod:: elfi.visualization.visualization.nx_draw
.. autofunction:: elfi.draw

.. This would show undocumented members :undoc-members:
Expand All @@ -180,11 +199,11 @@ Inference API classes
:members:
:inherited-members:

.. currentmodule:: elfi.methods.results


**Result objects**

.. currentmodule:: elfi.methods.results

.. autoclass:: OptimizationResult
:members:
:inherited-members:
Expand All @@ -204,22 +223,55 @@ Inference API classes

**Post-processing**

.. currentmodule:: elfi
.. currentmodule:: .

.. automethod:: elfi.adjust_posterior
.. autofunction:: elfi.adjust_posterior

.. currentmodule:: elfi.methods.post_processing

.. autoclass:: LinearAdjustment
:members:
:inherited-members:

**Diagnostics**

.. currentmodule:: .

.. autoclass:: elfi.TwoStageSelection
:members:
:inherited-members:

**Acquisition methods**

.. currentmodule:: elfi.methods.bo.acquisition

.. autoclass:: LCBSC
:members:
:inherited-members:

.. autoclass:: MaxVar
:members:
:inherited-members:

.. autoclass:: RandMaxVar
:members:
:inherited-members:

.. autoclass:: ExpIntVar
:members:
:inherited-members:

.. autoclass:: UniformAcquisition
:members:
:inherited-members:

Other
.....

**Data pools**

.. currentmodule:: .

.. autoclass:: elfi.OutputPool
:members:
:inherited-members:
Expand All @@ -231,11 +283,9 @@ Other

**Module functions**

.. currentmodule:: elfi

.. automethod:: elfi.get_client
.. autofunction:: elfi.get_client

.. automethod:: elfi.set_client
.. autofunction:: elfi.set_client


**Tools**
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def __getattr__(cls, name):
MOCK_MODULES = [
'pygtk', 'gtk', 'gobject', 'argparse', 'numpy', 'pandas', 'scipy', 'unqlite', 'dask',
'distributed', 'distributed.client', 'graphviz', 'matplotlib', 'sobol_seq', 'GPy',
'dask.delayed', 'scipy.optimize', 'scipy.stats', 'scipy.spatial', 'scipy.sparse',
'matplotlib.pyplot', 'numpy.random', 'networkx', 'ipyparallel', 'numpy.lib',
'numpy.lib.format', 'sklearn.linear_model'
'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'
]
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

Expand Down
3 changes: 2 additions & 1 deletion docs/usage/external.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Let's begin by importing some libraries that we will be using:
import scipy.stats as ss
import elfi
import elfi.examples
import elfi.examples.bdm
import elfi.examples.ma2
%matplotlib inline
Expand Down
1 change: 0 additions & 1 deletion docs/usage/parallelization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,3 @@ Remember to stop the ipcluster when done
2017-07-19 16:20:58.662 [IPClusterStop] Stopping cluster [pid=21020] with [signal=<Signals.SIGINT: 2>]
5 changes: 2 additions & 3 deletions elfi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
package for likelihood-free inference (LFI) such as Approximate Bayesian
Computation (ABC).
"""
import logging
logging.basicConfig(level=logging.INFO)

import elfi.clients.native

import elfi.methods.mcmc
import elfi.model.tools as tools
from elfi.client import get_client, set_client
from elfi.methods.diagnostics import TwoStageSelection
from elfi.methods.parameter_inference import *
from elfi.methods.post_processing import adjust_posterior
from elfi.model.elfi_model import *
Expand All @@ -25,4 +24,4 @@
__email__ = 'elfi-support@hiit.fi'

# make sure __version_ is on the last non-empty line (read by setup.py)
__version__ = '0.6.3'
__version__ = '0.7'
17 changes: 10 additions & 7 deletions elfi/methods/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ class TwoStageSelection:
or provide some already combined summary statistics as prepared_ss.
The rationale of the Two Stage procedure procedure is the following:
- First, the module computes or accepts the combinations of the candidate summary statistics;
- First, the module computes or accepts the combinations of the candidate summary statistics.
- In Stage 1, each summary-statistics combination is evaluated using the
Minimum Entropy algorithm;
Minimum Entropy algorithm.
- In Stage 2, the minimum-entropy combination is selected,
and the `closest' datasets are identified;
and the 'closest' datasets are identified.
- Further in Stage 2, for each summary-statistics combination,
the mean root sum of squared errors (MRSSE) is calculated over all `closest datasets',
and the minimum-MRSSE combination is chosen as the one with the optimal performance.
the mean root sum of squared errors (MRSSE) is calculated over all 'closest datasets',
and the minimum-MRSSE combination is chosen as the one with the optimal performance.
References
----------
Expand Down Expand Up @@ -109,7 +110,7 @@ def run(self, n_sim, n_acc=None, n_closest=None, batch_size=1, k=4):
n_acc : int, optional
Number of the accepted ABC-rejection simulations.
n_closest : int, optional
Number of the `closest' datasets
Number of the 'closest' datasets
(i.e., the closest n simulation datasets w.r.t the observations).
batch_size : int, optional
Number of samples per batch.
Expand All @@ -136,6 +137,7 @@ def run(self, n_sim, n_acc=None, n_closest=None, batch_size=1, k=4):
# preserve the parameters (thetas) corresponding to the `closest' datasets.
thetas = {}
E_me = np.inf
names_ss_me = []
for set_ss in self.ss_candidates:
names_ss = [ss.__name__ for ss in set_ss]
thetas_ss = self._obtain_accepted_thetas(set_ss, n_sim, n_acc, batch_size)
Expand All @@ -151,8 +153,9 @@ def run(self, n_sim, n_acc=None, n_closest=None, batch_size=1, k=4):
logger.info('\nThe minimum entropy of %f was found in %s.\n' % (E_me, names_ss_me))

# Find the summary-statistics combination with
# the minimum mean root sum of squared error (MRRSE).
# the minimum mean root sum of squared error (MRSSE).
MRSSE_min = np.inf
names_ss_MRSSE = []
for set_ss in self.ss_candidates:
names_ss = [ss.__name__ for ss in set_ss]
MRSSE_ss = self._calc_MRSSE(set_ss, thetas_closest, thetas[set_ss])
Expand Down

0 comments on commit 13b4a0b

Please sign in to comment.