Comments (6)
Hi
I reread the code in SerialMC.jl and apparently we don't store the log posterior in the diagnostics field (even though the samplers apparently return them).
I'll see if I can add that... (no delay promises ! ).
from klara.jl.
I think it is better to store and return the absolute minimum in order to avoid excessive storage requirements for the output. It is easy to evaluate the log-posterior using the returned chain if desired. I will write up a simple example to clarify how the user can achieve this.
from klara.jl.
Ok, here is the example:
using MCMC
mymodel1 = model(v-> -dot(v,v), init=ones(3))
mychain = run(mymodel1, RWM(0.1), SerialMC(steps=1000, burnin=100))
# Compute the log-posterior for the first sample (i.e. first MCMC iteration)
mymodel1.eval(mychain.samples[1, :])
# Compute the log-posterior for all the samples
[mymodel1.eval(mychain.samples[i, :]) for i in 1:size(mychain.samples, 1)]
from klara.jl.
This is a good point, we should be parcimonious in the data stored especially for very long chains. On the other hand this would not significantly increase the memory requirements : we already store the parameter vector, gradient and diagnostics for each iteration, adding a single float will not change much. Secondly, recalculating the log-posterior after the run will take about the same time as the run itself so it is not viable for very long runs.
Perhaps we could add some kind of opting-out of the diagnostics produced ? (that the user could choose if allocations made at the run initiation fail).
from klara.jl.
Yes, maybe we can provide the user with the option of choosing what to return. At the same time, I think that if we decide to return the log-posterior, it should be a standalone field outside the diagnostics; we provide the gradient outside the diagnostics which is more secondary than the log-posterior.
from klara.jl.
@carloalbert : the current master should provide the return value of the function (in the field logtargets
of the MCMCChain type).
The new version of MCMC is 0.0.6 (run Pkg.update()
)
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.