diff --git a/previews/PR96/.documenter-siteinfo.json b/previews/PR96/.documenter-siteinfo.json index 6b64497..0a979b9 100644 --- a/previews/PR96/.documenter-siteinfo.json +++ b/previews/PR96/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-05T08:17:14","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-05T08:18:02","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/previews/PR96/api/index.html b/previews/PR96/api/index.html index c015002..d0047c1 100644 --- a/previews/PR96/api/index.html +++ b/previews/PR96/api/index.html @@ -5,5 +5,5 @@ Other allowed proposals are

p1 = StaticProposal(Normal(0,1)) p2 = StaticProposal([Normal(0,1), InverseGamma(2,3)]) p3 = StaticProposal((a=Normal(0,1), b=InverseGamma(2,3))) p4 = StaticProposal((x=1.0) -> Normal(x, 1))


 The sampler is constructed using
-

julia spl = MetropolisHastings(proposal) ```

When using MetropolisHastings with the function sample, the following keyword arguments are allowed:

none is given, the initial parameters will be drawn from the sampler's proposals.

used if chain_type=Chains.

types are chain_type=Chains if MCMCChains is imported, or chain_type=StructArray if StructArrays is imported.

source

Functions

AdvancedMH.DensityModelType
DensityModel{F} <: AbstractModel

DensityModel wraps around a self-contained log-liklihood function logdensity.

Example:

l(x) = logpdf(Normal(), x)
-DensityModel(l)
source
+

julia spl = MetropolisHastings(proposal) ```

When using MetropolisHastings with the function sample, the following keyword arguments are allowed:

none is given, the initial parameters will be drawn from the sampler's proposals.

used if chain_type=Chains.

types are chain_type=Chains if MCMCChains is imported, or chain_type=StructArray if StructArrays is imported.

source

Functions

AdvancedMH.DensityModelType
DensityModel{F} <: AbstractModel

DensityModel wraps around a self-contained log-liklihood function logdensity.

Example:

l(x) = logpdf(Normal(), x)
+DensityModel(l)
source
diff --git a/previews/PR96/index.html b/previews/PR96/index.html index 43ee45b..42407c0 100644 --- a/previews/PR96/index.html +++ b/previews/PR96/index.html @@ -109,4 +109,4 @@ # Sample from the posterior. chain = sample(model, spl, 100000; initial_params=ones(2), chain_type=StructArray, param_names=["μ", "σ"])

Usage with LogDensityProblems.jl

As above, we can define the model with the LogDensityProblems.jl interface. We can implement the gradient of the log density function manually, or use LogDensityProblemsAD.jl to provide us with the gradient computation used in MALA. Using our implementation of the LogDensityProblems.jl interface above:

using LogDensityProblemsAD
 model_with_ad = LogDensityProblemsAD.ADgradient(Val(:ForwardDiff), LogTargetDensity())
-sample(model_with_ad, spl, 100000; initial_params=ones(2), chain_type=StructArray, param_names=["μ", "σ"])
+sample(model_with_ad, spl, 100000; initial_params=ones(2), chain_type=StructArray, param_names=["μ", "σ"])