Skip to content

Commit 13b4a0b

Browse files
authored
Release 0.7 (#252)
* Fix undefined variable * Bump version to 0.7, update API docs topics * Add scipy.linalg to mocked libraries * Update API docs
1 parent 24c17d8 commit 13b4a0b

File tree

8 files changed

+97
-44
lines changed

8 files changed

+97
-44
lines changed

CHANGELOG.rst

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
Changelog
22
=========
33

4-
dev
5-
---
6-
- Added new example: the stochastic Lotka-Volterra model
7-
- Fix methods.bo.utils.minimize to be strictly within bounds
8-
- Implemented the Two Stage Procedure, a method of summary-statistics diagnostics
4+
0.7 (2017-11-30)
5+
----------------
6+
97
- Added the MaxVar acquisition method
108
- Added the RandMaxVar acquisition method
11-
- Fix elfi.Distance to support scipy 1.0.0
129
- Added the ExpIntVar acquisition method
10+
- Implemented the Two Stage Procedure, a method of summary-statistics diagnostics
11+
- Added new example: the stochastic Lotka-Volterra model
12+
- Fix methods.bo.utils.minimize to be strictly within bounds
13+
- Fix elfi.Distance to support scipy 1.0.0
1314

1415
0.6.3 (2017-09-28)
1516
------------------

README.md

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

+72-22
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Modelling API
77
-------------
88
Below is the API for creating generative models.
99

10+
.. currentmodule:: .
11+
1012
.. autosummary::
1113
elfi.ElfiModel
1214

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

2931
**Other**
3032

31-
.. currentmodule:: elfi.model.elfi_model
32-
3333
.. autosummary::
3434
elfi.new_model
3535
elfi.load_model
3636
elfi.get_default_model
3737
elfi.set_default_model
3838

39-
.. currentmodule:: elfi.visualization.visualization
40-
4139
.. autosummary::
4240
elfi.draw
4341

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

53+
5554
**Result objects**
5655

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

64+
6565
**Post-processing**
6666

67-
.. currentmodule:: elfi
67+
.. currentmodule:: .
6868

6969
.. autosummary::
7070
elfi.adjust_posterior
@@ -74,20 +74,40 @@ Below is a list of inference methods included in ELFI.
7474
.. autosummary::
7575
LinearAdjustment
7676

77+
78+
**Diagnostics**
79+
80+
.. currentmodule:: .
81+
82+
.. autosummary::
83+
elfi.TwoStageSelection
84+
85+
86+
**Acquisition methods**
87+
88+
.. currentmodule:: elfi.methods.bo.acquisition
89+
90+
.. autosummary::
91+
LCBSC
92+
MaxVar
93+
RandMaxVar
94+
ExpIntVar
95+
UniformAcquisition
96+
7797
Other
7898
-----
7999

80100
**Data pools**
81101

102+
.. currentmodule:: .
103+
82104
.. autosummary::
83105
elfi.OutputPool
84106
elfi.ArrayPool
85107

86108

87109
**Module functions**
88110

89-
.. currentmodule:: elfi
90-
91111
.. autosummary::
92112
elfi.get_client
93113
elfi.set_client
@@ -102,6 +122,7 @@ Other
102122
elfi.tools.external_operation
103123

104124

125+
105126
Class documentations
106127
--------------------
107128

@@ -146,17 +167,15 @@ Modelling API classes
146167

147168
**Other**
148169

149-
.. currentmodule:: elfi.model.elfi_model
170+
.. autofunction:: elfi.new_model
150171

151-
.. automethod:: elfi.new_model
172+
.. autofunction:: elfi.load_model
152173

153-
.. automethod:: elfi.get_current_model
174+
.. autofunction:: elfi.get_default_model
154175

155-
.. automethod:: elfi.set_current_model
176+
.. autofunction:: elfi.set_default_model
156177

157-
.. currentmodule:: elfi.visualization.visualization
158-
159-
.. automethod:: elfi.visualization.visualization.nx_draw
178+
.. autofunction:: elfi.draw
160179

161180
.. This would show undocumented members :undoc-members:
162181
@@ -180,11 +199,11 @@ Inference API classes
180199
:members:
181200
:inherited-members:
182201

183-
.. currentmodule:: elfi.methods.results
184-
185202

186203
**Result objects**
187204

205+
.. currentmodule:: elfi.methods.results
206+
188207
.. autoclass:: OptimizationResult
189208
:members:
190209
:inherited-members:
@@ -204,22 +223,55 @@ Inference API classes
204223

205224
**Post-processing**
206225

207-
.. currentmodule:: elfi
226+
.. currentmodule:: .
208227

209-
.. automethod:: elfi.adjust_posterior
228+
.. autofunction:: elfi.adjust_posterior
210229

211230
.. currentmodule:: elfi.methods.post_processing
212231

213232
.. autoclass:: LinearAdjustment
214233
:members:
215234
:inherited-members:
216235

236+
**Diagnostics**
237+
238+
.. currentmodule:: .
239+
240+
.. autoclass:: elfi.TwoStageSelection
241+
:members:
242+
:inherited-members:
243+
244+
**Acquisition methods**
245+
246+
.. currentmodule:: elfi.methods.bo.acquisition
247+
248+
.. autoclass:: LCBSC
249+
:members:
250+
:inherited-members:
251+
252+
.. autoclass:: MaxVar
253+
:members:
254+
:inherited-members:
255+
256+
.. autoclass:: RandMaxVar
257+
:members:
258+
:inherited-members:
259+
260+
.. autoclass:: ExpIntVar
261+
:members:
262+
:inherited-members:
263+
264+
.. autoclass:: UniformAcquisition
265+
:members:
266+
:inherited-members:
217267

218268
Other
219269
.....
220270

221271
**Data pools**
222272

273+
.. currentmodule:: .
274+
223275
.. autoclass:: elfi.OutputPool
224276
:members:
225277
:inherited-members:
@@ -231,11 +283,9 @@ Other
231283

232284
**Module functions**
233285

234-
.. currentmodule:: elfi
235-
236-
.. automethod:: elfi.get_client
286+
.. autofunction:: elfi.get_client
237287

238-
.. automethod:: elfi.set_client
288+
.. autofunction:: elfi.set_client
239289

240290

241291
**Tools**

docs/conf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def __getattr__(cls, name):
3030
MOCK_MODULES = [
3131
'pygtk', 'gtk', 'gobject', 'argparse', 'numpy', 'pandas', 'scipy', 'unqlite', 'dask',
3232
'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'
33+
'dask.delayed', 'scipy.linalg', 'scipy.optimize', 'scipy.stats', 'scipy.spatial',
34+
'scipy.sparse', 'scipy.special', 'matplotlib.pyplot', 'numpy.random', 'networkx',
35+
'ipyparallel', 'numpy.lib', 'numpy.lib.format', 'sklearn.linear_model'
3636
]
3737
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
3838

docs/usage/external.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Let's begin by importing some libraries that we will be using:
2626
import scipy.stats as ss
2727
2828
import elfi
29-
import elfi.examples
29+
import elfi.examples.bdm
30+
import elfi.examples.ma2
3031
3132
%matplotlib inline
3233

docs/usage/parallelization.rst

-1
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,3 @@ Remember to stop the ipcluster when done
252252
253253
2017-07-19 16:20:58.662 [IPClusterStop] Stopping cluster [pid=21020] with [signal=<Signals.SIGINT: 2>]
254254
255-

elfi/__init__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
package for likelihood-free inference (LFI) such as Approximate Bayesian
66
Computation (ABC).
77
"""
8-
import logging
9-
logging.basicConfig(level=logging.INFO)
108

119
import elfi.clients.native
1210

1311
import elfi.methods.mcmc
1412
import elfi.model.tools as tools
1513
from elfi.client import get_client, set_client
14+
from elfi.methods.diagnostics import TwoStageSelection
1615
from elfi.methods.parameter_inference import *
1716
from elfi.methods.post_processing import adjust_posterior
1817
from elfi.model.elfi_model import *
@@ -25,4 +24,4 @@
2524
__email__ = 'elfi-support@hiit.fi'
2625

2726
# make sure __version_ is on the last non-empty line (read by setup.py)
28-
__version__ = '0.6.3'
27+
__version__ = '0.7'

elfi/methods/diagnostics.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ class TwoStageSelection:
1919
or provide some already combined summary statistics as prepared_ss.
2020
2121
The rationale of the Two Stage procedure procedure is the following:
22-
- First, the module computes or accepts the combinations of the candidate summary statistics;
22+
23+
- First, the module computes or accepts the combinations of the candidate summary statistics.
2324
- In Stage 1, each summary-statistics combination is evaluated using the
24-
Minimum Entropy algorithm;
25+
Minimum Entropy algorithm.
2526
- In Stage 2, the minimum-entropy combination is selected,
26-
and the `closest' datasets are identified;
27+
and the 'closest' datasets are identified.
2728
- Further in Stage 2, for each summary-statistics combination,
28-
the mean root sum of squared errors (MRSSE) is calculated over all `closest datasets',
29-
and the minimum-MRSSE combination is chosen as the one with the optimal performance.
29+
the mean root sum of squared errors (MRSSE) is calculated over all 'closest datasets',
30+
and the minimum-MRSSE combination is chosen as the one with the optimal performance.
3031
3132
References
3233
----------
@@ -109,7 +110,7 @@ def run(self, n_sim, n_acc=None, n_closest=None, batch_size=1, k=4):
109110
n_acc : int, optional
110111
Number of the accepted ABC-rejection simulations.
111112
n_closest : int, optional
112-
Number of the `closest' datasets
113+
Number of the 'closest' datasets
113114
(i.e., the closest n simulation datasets w.r.t the observations).
114115
batch_size : int, optional
115116
Number of samples per batch.
@@ -136,6 +137,7 @@ def run(self, n_sim, n_acc=None, n_closest=None, batch_size=1, k=4):
136137
# preserve the parameters (thetas) corresponding to the `closest' datasets.
137138
thetas = {}
138139
E_me = np.inf
140+
names_ss_me = []
139141
for set_ss in self.ss_candidates:
140142
names_ss = [ss.__name__ for ss in set_ss]
141143
thetas_ss = self._obtain_accepted_thetas(set_ss, n_sim, n_acc, batch_size)
@@ -151,8 +153,9 @@ def run(self, n_sim, n_acc=None, n_closest=None, batch_size=1, k=4):
151153
logger.info('\nThe minimum entropy of %f was found in %s.\n' % (E_me, names_ss_me))
152154

153155
# Find the summary-statistics combination with
154-
# the minimum mean root sum of squared error (MRRSE).
156+
# the minimum mean root sum of squared error (MRSSE).
155157
MRSSE_min = np.inf
158+
names_ss_MRSSE = []
156159
for set_ss in self.ss_candidates:
157160
names_ss = [ss.__name__ for ss in set_ss]
158161
MRSSE_ss = self._calc_MRSSE(set_ss, thetas_closest, thetas[set_ss])

0 commit comments

Comments
 (0)