-
Notifications
You must be signed in to change notification settings - Fork 230
Migrate to AbstractMCMC, add interface manual #1007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| end | ||
|
|
||
| # Default density constructor. | ||
| DensityModel(π::Function, data::T) where T = DensityModel{VariateForm, ValueSupport, T}(π, data) |
There was a problem hiding this comment.
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, θ)) |
There was a problem hiding this comment.
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.ℓπ(θ) |
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
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
<:Sampleabletyping on model structs in favor of a much simplerAbstractModel, since we have not been usingSampleableand it's a bit of a headache to work with.