Skip to content

Commit

Permalink
address Hong's comments on ambigious interface
Browse files Browse the repository at this point in the history
  • Loading branch information
xukai92 committed Apr 3, 2019
1 parent 961b2c8 commit 21389e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/adaptation.jl
Expand Up @@ -19,9 +19,9 @@ function update(h::Hamiltonian, prop::AbstractProposal, dpc::Adaptation.Abstract
end

function update(h::Hamiltonian, prop::AbstractProposal, da::NesterovDualAveraging)
return h, prop(getϵ(da))
return h, prop(prop.integrator(getϵ(da)))
end

function update(h::Hamiltonian, prop::AbstractProposal, ca::Adaptation.AbstractCompositeAdaptor)
return h(getM⁻¹(ca.pc)), prop(getϵ(ca.ssa))
return h(getM⁻¹(ca.pc)), prop(prop.integrator(getϵ(ca.ssa)))
end
12 changes: 6 additions & 6 deletions src/proposal.jl
Expand Up @@ -7,9 +7,9 @@ struct TakeLastProposal{I<:AbstractIntegrator} <: StaticTrajectory{I}
n_steps :: Int
end

# Create a `TakeLastProposal` with a new `ϵ`
function (tlp::TakeLastProposal)(ϵ::AbstractFloat)
return TakeLastProposal(tlp.integrator(ϵ), tlp.n_steps)
# Create a `TakeLastProposal` with a new integrator
function (tlp::TakeLastProposal)(integrator::AbstractIntegrator)
return TakeLastProposal(integrator, tlp.n_steps)
end

function transition(prop::TakeLastProposal, h::Hamiltonian, θ::AbstractVector{T}, r::AbstractVector{T}) where {T<:Real}
Expand All @@ -28,9 +28,9 @@ end
# Helper function to use default values
NUTS(integrator::AbstractIntegrator) = NUTS(integrator, 10, 1000.0)

# Create a `NUTS` with a new `ϵ`
function (snuts::NUTS)(ϵ::AbstractFloat)
return NUTS(snuts.integrator(ϵ), snuts.max_depth, snuts.Δ_max)
# Create a `NUTS` with a new integrator
function (snuts::NUTS)(integrator::AbstractIntegrator)
return NUTS(integrator, snuts.max_depth, snuts.Δ_max)
end

struct MultinomialNUTS{I<:AbstractIntegrator} <: NoUTurnTrajectory{I}
Expand Down

0 comments on commit 21389e5

Please sign in to comment.