Comments (10)
They all seem well-thought and useful suggestions @fredo-dedup:
- It is definitely better to remove the size argument from the model constructors, since it can be deduced from the vector size, and sure, it is good to keep it as a field.
- It is true that we repeat some parameter validation in the samplers that could be done only once in the inner constructor of the model, I haven't noticed this before.
- Having a
model()
function is a much more practical (and inviting) user interface, so thumbs up. Maybe we could have a named argumenttype
in themodel()
function, with default valuetype="likelihood"
(referring to the most common typeMCMCLikelihoodModel
), and then other boolean named arguments, such asgradient=false
andhessian=false
? I was thinking of a function signature along the linesmodel(; type::ASCIIString="likelihood", gradient::Bool="false", hessian::Bool="false")
, but this naive scaffold can be thought more thoroughly... - The
scale
field sounds great too.
A quick thought that I had the other day; RMHMC and MMALA need the derivatives of the Hessian, so shall we add another type MCMCLikelihoodModelWithTensor
? In general, I was debating with myself wether we need all three types MCMCLikelihoodWithGradient
, MCMCLikelihoodWithHessian
and MCMCLikelihoodWithTensor
or not really, given that they are nested and that an important part of source code is repeated there. We could have for instance MCMCLikelihoodWithTensor
only, and the hessian or tensor-related fields could be empty depending on the sampler. I am not sure yet how we could improve on this, just sharing my scepticism on this part of our code.
from klara.jl.
Regarding your last point, I think there is a lot of duplicated code between those Model definitions (consistency controls, constructors). This could be a sign that we should instead create a single type with boolean fields hasGradient
, hasHessian
, etc.. and then have the samplers check those fields to see if the model is usable for them.
As a bonus, this would allow more readable error messages instead of the "ERROR: *no method spinTask(MCMCLikelihoodModel,HMC)" we are getting today.
What do you think ?
I could start a devel branch along those lines to check there is no stumbling blocks following this strategy leaving master intact. I would need your help for some of the models you have created though.
from klara.jl.
Yes, a single type with boolean fields seems to be the right improvement and a clearer design (as long as we don't run into any complications that we haven't thought in advance). Sure, go ahead with the devel branch and of course, I am more than happy to help with the models I created. Would you like to create the single type so that it becomes operational for the existing samplers (RWM, HMC, MALA)? Then I could take it from there to add SMMALA, MMALA, RMHMC, trying to adhere to your code, and then at a third stage you can further improve this coding addition - is this a plausible plan (or would you like me to help in another way)?
from klara.jl.
I started pursuing the idea in the devel branch. I fused basic / gradient / hessian model types into a single one.
The helper function model() is not finished yet, and I didn't finish adding tuning types to RWM().
I'll get back to this in the next days. Feel free to comment and criticize..
from klara.jl.
Thanks @fredo-dedup, no rush, I am abroad this week until 30 Aug working, so somewhat slower. I will look at your code over the weekend.
from klara.jl.
@fredo-dedup, I read your code in devel, it looks good. I attached 3 comments to it (via the commenting facility of github). Give me a shout if my thoughts there are not clear.
from klara.jl.
2 more points @fredo-dedup:
- I added the
tensor
field toMCMCLikelihoodModel
from now because it is needed while I am looking into the process of adding the geometric MCMC samplers (RMHMC and MMALA). I made this change in devel so as to leave master in its working state. - I realized that so far the autodiff tools are used only for computing the gradient. We certainly need to use them for computing the hessian and tensors too, whenever these are not provided by the user as functions.
from klara.jl.
@fredo-dedup I made tiny steps towards adding the tuning feature to the samplers. It takes some thinking, thus the slow (ongoing) progress. Feel free to criticize/change/improve the ongoing effort.
from klara.jl.
I fixed some bugs, and the examples work with the newly defined model-related types. I made 2 comments on my last commit in devel @fredo-dedup, let me know what you think about these remarks. I will port the empirical tuners I used for some samplers soon - feel free to make any changes, however drastic they may be.
from klara.jl.
We have made all the changes suggested in the initial list of this issue.
from klara.jl.
Related Issues (20)
- Decide whether to add univariate AM or drop AM sampler HOT 1
- Possible DSL sitting atop of existing functionality
- Drop Basic prefix in various type names
- Add some simple examples from OpenBUGS, volume 1
- MethodError: Cannot `convert` an object of type Array{Float64,1} to an object of type Float64 HOT 3
- Add option to bound parameters HOT 3
- Deprecation warnings for v0.6 HOT 2
- World age issue due to code generation inside an inner constructor HOT 2
- Issue related to where keyword and parametric types HOT 7
- How to replace consume and produce with Channels HOT 1
- Implement AMWG sampler
- MCMC in GaussianProcesses.jl HOT 24
- Eliminate code generation to avoid world age issues in Julia v0.6
- HMC with reverse-mode autodiff HOT 1
- ForwardDiff 0.4 0.6 HOT 4
- Is there any guidance for custom sample space HOT 2
- Monitoring Metropolis-Hastings Internal Quantities
- Support Julia 1.0 HOT 5
- Gibbs sampling from a posterior distribution kernel
- Package compatibility caps
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 klara.jl.