Comments (3)
I'll do better than that and open a PR shortly with what I'm more or less sure of and add the explanation there.
from aemcmc.
I am currently not sure how to handle the sampler parameters in this situation. The caller, either machine or human, has to know that the sampling step requires extra parameters. I was first thinking of passing instructions in the form of a string, but this is not a good idea, at least not in AeMCMC: it complicates handling of these step functions by a program downstream.
A better idea is to deal with the distinction at the type level e.g. with SamplingAlgorithm
and ParametrizedSamplingAlgorithm
. NUTS
would be a ParametrizedSamplingAlgorithm
and contain the necessary information about its parameters (expected type, rank and shape for instance). These classes can return instructions that humans can understand with their __str__
method.
Something along the lines of (for a single variable):
# To be continued
class NUTS(ParametrizedSamplingAlgorithm):
def __init__(self, variable):
ndims = variable.shape[0]
self.parameters = {}
self.parameters["step_size"] = (None, config.floatX)}
self.parameters["inverse_mass_matrix"] = [
(ndims,config.floatX),
((ndims,ndims), config.floatX)
]
# Reparametrize the variables here
def construct_step(self):
"""Returns the step function for the given variable"""
pass
def __str__(self):
"""Print infotmation about this sampling step:
1. The variables being assigned the algorithms
2. The properties of the parameters
3. The algorithm
4. The transformations applied.
"""
pass
The adaptation that NUTS requires is an extra difficulty, but we don't need to figure this out to have a first working version of the sampler builder. I currently leans towards letting the caller handle this using the sampling step types since sampling steps and parameter updates are decoupled. We shouldn't make opinionated decisions about which adaptation algorithm to use in AeMCMC anyway.
(In lack of a better place, I'll also add here that our rewrites need to carry information that is both machine readable: "what distributions are involved?" "What kind of rewrite is this", which mean we could export a database of relation should we want to. And also readable for humans who will need to understand how we built samplers)
from aemcmc.
I am currently not sure how to handle the sampler parameters in this situation. The caller, either machine or human, has to know that the sampling step requires extra parameters. I was first thinking of passing instructions in the form of a string, but this is not a good idea, at least not in AeMCMC: it complicates handling of these step functions by a program downstream.
Can you provide pseudo-code examples for the relevant scenarios(s)? Without something like that, I'm not confident that I would end up addressing all the relevant concerns together.
from aemcmc.
Related Issues (20)
- Add `sample_prior`, `sample` and `sample_posterior_predictive` functions
- Add automatic Laplace approximation
- Use miniKanren to walk through mathematically equivalent model representations
- Gcc_flag issue with Max os HOT 1
- Dynamically generate lists in documentation
- Make sure `kanren` rewrites account for `SharedVariable.default_update`s
- Add AeMCMC logo to RTD?
- Demo automatic MAP estimation based on proximal operators
- Extend exact posteriors to condition on multiple observations HOT 7
- Assign FFBS sampler to variables in HMM models
- Refactor NUTS builder to use the new `logprob` interface
- Set up scheduled nightly builds
- Add a utility function to sample using `scan`
- Add examples to the README HOT 3
- Add a function to change the scan order of the sampling steps returned by `construct_sampler`
- Update the README with the new sampler interface
- Add standard HMC/NUTS defaults and options HOT 1
- `construct_sampler` does not support transformed observables HOT 1
- Logistic regression with time-varying coefficients: cannot construct sampler HOT 6
- Replacements need to apply to `SharedVariable.default_update` and `OpFromGraph`s
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aemcmc.