Open eerolinna opened 5 years ago
Hmmm. I think the R-version is a little more clear with regards to our abstractions. We have the PDB and a cfg that contain everything. So for an IE creator the R version is more inline with abstractions. But this is not clear cut how to do.
We could also have
stan_vb <- function(cfg){
model <- stan_model(cfg)
data <- cfg$data
inference_engine_args <- inference_engine_arguments(cfg)
...
}
Where we would still have everything in one object but bayesbench core would do some preprocessing, such as loading the json.
Slightly unrelated: how does stan_model(cfg)
find the model as the config only specifies a posterior name and not the file paths etc? Wouldn't it need the posterior database also as a parameter? Or is stan_model(cfg)
essentially an alias for (stan_model(cfg, posterior_database = get_default_posterior_database())
?
Currently in this R version of
bayesbench
inference engines are defined like this(simplified from ie_stan.R)
In python version of
bayesbench
I have used something likeWhich one should we use?
Things I like with the python version
cfg
for example includes a field inference_engine, which is never used by the inference engine itself, only to select which inference engine to calljsonlite::read_json
directly in bayesbench core instead of having to always call it in inference engines. This also makes it easier to write inference engines when some of the work has already been taken care ofDownsides to the python version
cfg
in place)