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

Changes to trace update interface methods #54

Closed
marcoct opened this issue Jan 30, 2019 · 8 comments
Closed

Changes to trace update interface methods #54

marcoct opened this issue Jan 30, 2019 · 8 comments
Labels

Comments

@marcoct
Copy link
Collaborator

marcoct commented Jan 30, 2019

Fix-update is an interesting type of trace update, that is intermediate between free update and force update. However, it's not clear that it is needed. Remove fix-update.

@marcoct
Copy link
Collaborator Author

marcoct commented Feb 3, 2019

Also make the trace the first argument of all the update methods

@marcoct marcoct closed this as completed Feb 3, 2019
@marcoct marcoct reopened this Feb 3, 2019
@marcoct marcoct changed the title Remove fix_update and just have one 'update' method that is overloaded. Changes to trace update interface methods Feb 3, 2019
@marcoct
Copy link
Collaborator Author

marcoct commented Feb 3, 2019

Also, reorder the values in the return tuple of the force_update variant of update, so that the first three arguments are the same as the other update variants:

(new_trace, weight, retdiff, discard)

@marcoct
Copy link
Collaborator Author

marcoct commented Feb 3, 2019

Rename force_update to constrain_update, and rename free_update to select_update, and rename extend to extend_update. Having separate names for these (instead of relying on dispatch of one function update based on types of its arguments) can be helpful, especially if we want to port the GFI to other languages or interfaces that don't support the same type of overloading.

@alex-lew
Copy link
Contributor

alex-lew commented Feb 3, 2019

I like bringing the signatures into closer alignment (re: ordering of return values). I'm not sure select_update, constrain_update, etc. are the clearest names we can find. It sounds to me like I'm constraining an update, or selecting an update, when what I'm actually doing is updating.

Is there a reason to call them all update in the first place? In my mind, force_update is the most update-like, and deserves to be called update (or perhaps update_trace): you pass in new arguments and new choice values, and get back an updated trace.

Of the GFI methods, free_update seems closest to initialize (which we are renaming to generate_trace): it uses an internal proposal to regenerate some of the choices in the trace. Why not call it regenerate, or maybe regenerate_selection?

As for extend, I think its name is fine as it is (though perhaps it could be changed to extend_trace). It is a special version of update (currently force_update) that can be used when no existing choices need to change.

This would make the methods

generate_trace: generate a trace and a score from the internal proposal, subject to constraints

update_trace: change the arguments and choice values of a trace, automatically updating its score.

extend_trace: a special version of update_trace for when only new choices are being added.

regenerate: use the internal proposal to regenerate a selection of addresses from a trace, and to add any new randomness as required.


Another direction I can see the names going is automatic_update for free_update and manual_update for force_update. extend could be left as is.

@marcoct
Copy link
Collaborator Author

marcoct commented Feb 4, 2019 via email

@marcoct
Copy link
Collaborator Author

marcoct commented Feb 4, 2019 via email

@fsaad
Copy link
Collaborator

fsaad commented Feb 4, 2019

Keep the _trace suffix, it adds clarity for probabilistic programming with first-class traces.

@marcoct
Copy link
Collaborator Author

marcoct commented Feb 9, 2019

These changes were made in probcomp/GenExperimental.jl#67

@marcoct marcoct closed this as completed Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants