update_interval
keyword argument to the BOLFI constructor, see http://elfi.readthedocs.io/en/latest/usage/BOLFI.html This will set the period of automatically optimizing the GP hyperparameters.become
method and then setup a new BOLFI instance using the previous points as initial_evidence
. (However, note that BOLFI’s fit
method doesn’t use ELFI priors with the default acquisition function.) I’m not sure why you would want to do that though
pip install -U elfi
Summary
node: currently, my simulator generates a random sample, then my summary statistics are a set of distribution quantiles. However, given a set of parameters, I could also produce the theoretical quantiles directly and avoid simulation and computation of empirical quantiles. If I want to pass a set of quantiles directly from theSimulator
to the Distance
node, do I just pass the exact vector through the Summary
node, or is there a better way? Thanks!
elfi.adjust_posterior(model=mod, sample=res, summary_names=[sim.name])
, I get the following error: The node _sim_observed is not in the digraph.
Observations were passed in the simulator node, named sim
. Is this a bug I should report?
def match_quantile(q, idx):
if len(q.shape) != 2:
return np.expand_dims(np.array(q[idx]), axis=0)
else:
return q[:, idx]
summary_stats = list()
for idx in range(len(observed_data)):
summary_stats.append(elfi.Summary(match_quantile, model, idx, name=f"S{idx}"))
Hi. Thanks for the great software! I have managed to create a simulator node y
and a summary statistic node s
. If I run their respective generate methods, it produces the expected output with the correct shapes:
test_y = y.generate(3)
test_s = s.generate(3)
print(f"test_y {test_y.shape} test_s {test_s.shape}")
>> test_y (3, 1) test_s (3, 102)
However, when I try to run rejection sampling, I get an error:
“TypeError: In executing node '_s_observed': iteration over a 0-d array.”
For some reason when my summary statistic function is called, it gets passed a 0 dimensional array from the simulator. Any idea why this could be? By the speed the error is thrown, it doesn't seem like the simulator is even run. Thanks a lot for any help it is much appreciated!