-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Fundamentally all of these functions take some input, run the model, collect some accumulator's output (or the return value), and then give that back to the user.
Traditionally these have all taken a VarInfo argument. That's because they all used to call evaluate!!(model, varinfo). This makes little sense nowadays. It should take an AbstractInitStrategy argument, with some common overloads for parameter types that wrap them in InitFromParams before calling the main function. For example, logjoint(model, ...) already follows this pattern, along with returned; so the point would be to unify all of these things into a single internal method, and have logjoint, ... etc defined in terms of that method.
I think there's a reasonable amount of code duplication that could be reduced in this too. Because at the end of the day really all you're saying is: this is my model, these are my params, I want these accumulators, I want to evaluate the model and return this thing.
We could even keep the VarInfo methods; they just need to dispatch to InitFromParams(vi.values).