Skip to content

Conversation

@cpfiffer
Copy link
Member

@cpfiffer cpfiffer commented Dec 2, 2019

This PR moves Turing over to using AbstractMCMC as the home of the interface methods. I have also added a guide on the use of AbstractMCMC's interface methods (a modified version of the one in #920), but currently it does not include any details on how to link up a foreign algorithm to Turing. I will follow up with that document in a separate PR after #997 and #965 go through, since they seem to be providing a couple of useful tools I want to be able to point people at.

One thing to note is that I have removed the <:Sampleable typing on model structs in favor of a much simpler AbstractModel, since we have not been using Sampleable and it's a bit of a headache to work with.

@yebai yebai merged commit 9a9ba63 into master Dec 2, 2019
@delete-merged-branch delete-merged-branch bot deleted the csp/abstractmcmc branch December 2, 2019 13:35
@cpfiffer cpfiffer mentioned this pull request Dec 2, 2019
end

# Default density constructor.
DensityModel::Function, data::T) where T = DensityModel{VariateForm, ValueSupport, T}(π, data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems wrong and does not match the struct definition above? Moreover, the static parameter could/should be removed (https://docs.julialang.org/en/v1/manual/style-guide/#Don't-use-unnecessary-static-parameters-1).

end

# Store the new draw and its log density.
Transition(model::M, θ::T) where {M<:DensityModel, T} = Transition(θ, ℓπ(model, θ))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The static parameters are not needed.

q(spl::MetropolisHastings, t1::Transition, t2::Transition) = q(spl, t1.θ, t2.θ)

# Calculate the density of the model given some parameterization.
ℓπ(model::DensityModel, θ::T) where T = model.ℓπ(θ)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, T could be removed.

ts::Vector{T};
param_names=missing,
kwargs...
) where {ModelType<:AbstractModel, T<:AbstractTransition}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ModelType seems wrong and should be removed, I guess, and T is not needed.

kwargs...
) where {
ModelType<:Sampleable,
ModelType<:AbstractModel,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems all static parameters could/should be removed?

kwargs...
) where {
ModelType<:Sampleable,
ModelType<:AbstractModel,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@cpfiffer cpfiffer mentioned this pull request Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants