Skip to content

Commit 66283bf

Browse files
authored
Fix option to continue model-based inference (#460)
* move init round move init round from update to prepare new batch so that the fit method in BOLFIRE can be called to continue optimisation * update changelog * move init round move init round from prepare new batch to iterate * move init round move init round back to update but additionally check in infer if inference is continued and a new round needs to be initialised
1 parent c8083e3 commit 66283bf

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CHANGELOG.rst

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

4+
- Fix the option to continue inference in model-based inference
45
- Move classifiers
56
- Fix readthedocs configuration
67
- Update penalty to shrinkage parameter conversion in synthetic likelihood calculation

elfi/methods/inference/parameter_inference.py

+15
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,21 @@ def current_params(self):
515515
"""
516516
raise NotImplementedError
517517

518+
def infer(self, *args, **kwargs):
519+
"""Set the objective and start the iterate loop until the inference is finished.
520+
521+
Initialise a new data collection round if needed.
522+
523+
Returns
524+
-------
525+
result : Sample
526+
527+
"""
528+
if self.state['round'] > 0:
529+
self._init_round()
530+
531+
return super().infer(*args, **kwargs)
532+
518533
def _merge_batch(self, batch):
519534
simulated = batch_to_arr2d(batch, self.feature_names)
520535
n_sim = self.state['n_sim_round']

0 commit comments

Comments
 (0)