extending Predictive to support sampling by plate name
See original GitHub issueFollowing our earlier discussion with @fritzo and @adamgayoso , creating this issue. Would be great if Predictive
class can support sampling of all variables in a given plate, automatically pulling all site values in a given plate(plate_name
) or all sites not is that plate, including both samples and observed values:
trace = poutine.trace(model).get_trace(*args, **kwargs) # you'll need to fill in args,kwargs
cell_samples = {
name: site["value"]
for name, site in trace.nodes.items()
if site["type"] == "sample"
if any(f.name == plate_name for f in site["cond_indep_stack"])
}
This functionality would simplify dealing with local variables within a minibatch plate, by making it easy to do separate predictive calls for the minibatch plate variables and global variables.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
§ 1002.2 Definitions. | Consumer Financial Protection Bureau
(v) A refusal to extend credit because the creditor does not offer the type of credit or credit plan requested. Official interpretation of...
Read more >SVI — Pyro documentation
A trace implementation of ELBO-based SVI that supports - exhaustive enumeration over discrete sample sites, and - local parallel sampling over any sample...
Read more >pyro-ppl/numpyro - GitHub
As you may have noticed from the examples, NumPyro supports all Pyro primitives like sample , param , plate and module , and...
Read more >Predicting Antibody Developability Profiles Through Early ...
The term 'developability' encompasses the feasibility of molecules to successfully progress from discovery to development via evaluation of their ...
Read more >Class Prediction with Agilent Mass Profiler Professional
Introduction to class prediction 2 ... the class membership of unknown samples. ... (7) Select one or more prediction model algorithms that support...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, exactly like @jamestwebber described - we need a way to sample both the global variables and the local variables (including amortised variables). The idea is that by doing predictive sampling by plate name you can isolate local variables from global variables and sample them via 2 separate calls. I think 2 separate calls are needed because if you iterate over the data loader global variables will be sampled in every iteration of the data loader whereas local variable will be only sampled once in their respective minibatch. Separating allows sampling global variable once (where I count
y_fg
as global:d_cg = x_cf @ y_fg
andx_cf
is minibatched inc
plate).I see 2 separate problems:
It’s very possible that I just don’t understand the right pattern for accomplishing this. For me, the intended workflow is something like
Predictive
instance withpred = Predictive(model, guide=guide, num_samples=1000)
So that in the end I’d have a posterior over both the global variables (i.e. some background effect) and the minibatch-specific ones (for example, cell-specific loading factors).