Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make argdiff an optional keyword argument to update #229

Open
marcoct opened this issue Apr 2, 2020 · 3 comments
Open

Make argdiff an optional keyword argument to update #229

marcoct opened this issue Apr 2, 2020 · 3 comments

Comments

@marcoct
Copy link
Collaborator

marcoct commented Apr 2, 2020

It would default to the n-tuple of NoChange() values where n is the number of arguments to the generatiev function. Passing in the tuple of NoChange() values is common when doing operations on the top-level generative function of a model in e.g. MCMC.

@marcoct
Copy link
Collaborator Author

marcoct commented Apr 11, 2020

I started implementing this here (including making the other arguments excluding the trace itself into keyword arguments): https://github.com/probcomp/Gen/tree/20200410-marcoct-argdiffoptional, but the extra typing for the keyword arguments almost makes the change not worth it.

@marcoct
Copy link
Collaborator Author

marcoct commented Apr 11, 2020

Actually, on second thought, we can keep the GFI interface signature the same (no keyword args), but then just the keyword argument wrapper for use by the inference library.

function update(trace;
        args=get_args(trace),
        argdiffs=map((_) -> NoChange(), args),
        constraints=EmptyChoiceMap())
    update(trace, args, argdiffs, constraints)
end

This is indeed what I implemented, so all the extra keyword arguments in calls were unnecessary.

@marcoct
Copy link
Collaborator Author

marcoct commented Apr 11, 2020

The same defaults for regenerate should be implemented as part of the same PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant