Suggestion about sampling methods


It looks like the three sampling methods all treat their vars arguments differently. sample_posterior_predictive wants an iterable of Distribution objects. sample_prior_predictive wants a list of variable names (strings). sample doesn’t take any vars argument (or only to pass through to somewhere else – I didn’t chase this down carefully enough).
The clash in argument type between posterior and prior predictive seems unnecessary and it’s a pain for the programmer.
I’m willing to submit a PR given a little guidance about which is best to use. Ideally, I think it would be great to have a general protocol for passing vars arguments.


Indeed currently there are some inconsistencies of API (eg., see long discussion in

I think to make all API consistence, I would pass variable names to sample_* functions as a general protocol. However, for sampling the option passing vars should not be removed for backward compatibility.


Right. I think the two functions should both accept either an iterable of variables or of variable names (the Common Lisp spec would refer to this as an iterable of “variable designators”), and then internally they can translate one way or the other, as preferred. I suppose one could even accept a dictionary of names to variables, since that’s what named_vars holds.

There should be one or more library functions that will regularize these arguments to either an iterable of names or an iterable of variables.