de valpine nimble
TRANSCRIPT
![Page 1: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/1.jpg)
NIMBLE
(First release by summer)
model language (BUGS)
Algorithm language
![Page 2: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/2.jpg)
Why algorithm programmability?
• Simple advanced MCMC: block updaters, mulHple updaters, mulHple scales, modularity
• Advanced advanced MCMC: bridge sampling, reversible jump, adapHve MCMC, tempering, approximaHng models
• ParHcle filtering • Importance sampling • Laplace approximaHon, adapHve Gaussian quadrature • Kalman Filtering, Unscented KF, extended KF • Prior sensiHvity analysis by reweighHng • Monte Carlo ExpectaHon MaximizaHon (MCEM) • Data cloning • Approximate Bayesian ComputaHon • Posterior predicHve checks (without re-‐running MCMC) • Normalizing constants: bridge sampling; see above • CombinaHon algorithms: PF + MCMC, MCMC + Laplace
Algorithm developers need a system for model-‐flexibility and distribuHon.
![Page 3: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/3.jpg)
What we do with BUGS models
model { mu ~ dnorm(0, 10) logit(p) ~ dnorm(mu, sigma) y ~ dbin(N, p) }
![Page 4: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/4.jpg)
What we do with BUGS models
model { mu ~ dnorm(0, 10) logit(p) ~ dnorm(mu, sigma) y ~ dbin(N, p) }
Extract all semanHc relaHonships. Build a graphical model object R (igraph). Generate C++ code Compile, load, and provide interface objects.
![Page 5: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/5.jpg)
What we do with BUGS models
model { mu ~ dnorm(0, 10) logit(p) ~ dnorm(mu, sigma) y ~ dbin(N, p) }
Extract all semanHc relaHonships. Build a graphical model object R (igraph). Generate C++ code Compile, load, and provide interface objects.
mymodel$mu <-‐ 5 toCalc <-‐ getDependencies(mymodel, "mu") calculate(mymodel, toCalc)
![Page 6: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/6.jpg)
What we do with BUGS models
Some "automaHc" extensions of BUGS 1. Expressions as arguments 2. MulHple parameterizaHons for distribuHons (e.g. precision or std. deviaHon) 3. Compile-‐Hme if-‐then-‐else 4. Single-‐line moHfs: y[1:10] ~ glmm(X * A + (1 | Group), family = "binomial")
model { mu ~ dnorm(0, 10) logit(p) ~ dnorm(mu, sigma) y ~ dbin(N, p) }
Extract all semanHc relaHonships. Build a graphical model object R (igraph). Generate C++ code Compile, load, and provide interface objects.
mymodel$mu <-‐ 5 toCalc <-‐ getDependencies(mymodel, "mu") calculate(mymodel, toCalc)
![Page 7: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/7.jpg)
How we write algorithms Random-‐walk MCMC updater
1. setup arguments: model, targetNode
![Page 8: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/8.jpg)
How we write algorithms Random-‐walk MCMC updater
1. setup arguments: model, targetNode
2. setup code: use model structure to query targetNode dependencies
Processed ONCE, in R
![Page 9: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/9.jpg)
How we write algorithms Random-‐walk MCMC updater
1. setup arguments: model, targetNode
2. setup code: use model structure to query targetNode dependencies
Processed ONCE, in R
3. run-‐Hme code: (i) put a proposal value in the targetNode (ii) calculate needed log likelihoods (iii) accept or reject
Becomes C++ code, compiled & interfaced
![Page 10: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/10.jpg)
How we write algorithms Random-‐walk MCMC updater
1. setup arguments: model, targetNode
2. setup code: use model structure to query targetNode dependencies
Processed ONCE, in R
3. run-‐Hme code: (i) put a proposal value in the targetNode (ii) calculate needed log likelihoods (iii) accept or reject
Becomes C++ code, compiled & interfaced
Building a program with many funcHons: • model structure (setup arguments) processed in R • algorithm executed in C++
![Page 11: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/11.jpg)
How we write algorithms Random-‐walk MCMC updater
1. setup arguments: model, targetNode
2. setup code: use model structure to query targetNode dependencies
Processed ONCE, in R
3. run-‐Hme code: (i) put a proposal value in the targetNode (ii) calculate needed log likelihoods (iii) accept or reject
Becomes C++ code, compiled & interfaced
Building a program with many funcHons: • model structure (setup arguments) processed in R • algorithm executed in C++
We provide data structures for sets of model values (e.g. MCMC output)
![Page 12: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/12.jpg)
ConnecHons to other engines
When another system has a great algorithm, we want to wrap access to it.
![Page 13: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/13.jpg)
ConnecHons to other engines
When another system has a great algorithm, we want to wrap access to it.
Example: Monte Carlo ExpectaHon MaximizaHon (MCEM) • Uses MCMC repeatedly on latent states • Parameters updated between MCMCs • We don't have to use our own MCMC if someone else has a great one
![Page 14: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/14.jpg)
ConnecHons to other engines
When another system has a great algorithm, we want to wrap access to it.
Example: Monte Carlo ExpectaHon MaximizaHon (MCEM) • Uses MCMC repeatedly on latent states • Parameters updated between MCMCs • We don't have to use our own MCMC if someone else has a great one
How? We have high-‐level representaHon of model structure. Can generate specificaHons needed for other packages.
![Page 15: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/15.jpg)
Who we think will use NIMBLE
1. Algorithm developers
2. Data analysts
3. Workflow pipelines
![Page 16: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/16.jpg)
Numerical!Integration of!Mixture Models for!Bayesian and !Likelihood!Estimation!
Team:!Perry de Valpine!Chris Paciorek!Daniel Turek!Cliff Anderson-Bergmann!Ras Bodik!Duncan Temple Lang!
Funding:!NSF Advances in !Biological Informatics!
![Page 17: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/17.jpg)
![Page 18: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/18.jpg)
Common situaHon
model language
(Black box algorithm)
![Page 19: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/19.jpg)
How we build an MCMC
1. R funcHons use model/graph objects in R to inspect a parHcular model: -‐ Build list of updaters
-‐ Can be inspected, modified -‐ You can write your own
![Page 20: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/20.jpg)
How we build an MCMC
1. R funcHons use model/graph objects in R to inspect a parHcular model: -‐ Build list of updaters
-‐ Can be inspected, modified -‐ You can write your own
2. Generate C++ code for all updaters.
![Page 21: de Valpine NIMBLE](https://reader034.vdocuments.pub/reader034/viewer/2022042514/559868241a28ab9f738b4608/html5/thumbnails/21.jpg)
How we build an MCMC
1. R funcHons use model/graph objects in R to inspect a parHcular model: -‐ Build list of updaters
-‐ Can be inspected, modified -‐ You can write your own
2. Generate C++ code for all updaters.
3. Compile, load, build and interface to objects.