Skip to content
Snippets Groups Projects
MultilevelChainSampler.jl 750 B
Newer Older
Luca Lenz's avatar
Luca Lenz committed
module MultilevelChainSampler
Luca Lenz's avatar
Luca Lenz committed

#using AbstractMCMC
using Random, Distributions, StatsBase

import StatsBase: sample
import Distributions: logpdf
import Base: length, eltype, convert

export SimpleLogDensity
export propose, CyclicWalk
export MetropolisHastings
export flatten
export ksdist

include("utils.jl")
include("chain.jl")
include("proposal.jl")
include("model.jl")
include("sampler.jl")

Luca Lenz's avatar
Luca Lenz committed
end
Luca Lenz's avatar
Luca Lenz committed

#Test 
#=
using CairoMakie

σ = .1
w = CyclicWalk(-1,1,.5)
e = SimpleLogDensity(Normal(0, σ))

fig = Figure(); ax = Axis(fig[1,1])
x = collect(-1:1e-3:1)
#y = exp.( e.(x) ); y = y/(2 * mean(y))
y = e.(x)
lines!(ax, x, y)

#s = MetropolisHastings(e, w)
#@time c = sample(s, 100000)
#hist!(ax, flatten(c).states, normalization=:pdf)

display(fig)
=#